Skip to content

SDK naming conventions

What the SDKs rename, what they leave alone, and where the line falls.

The Wajub API speaks snake_case on the wire. created_at, authorization_url, per_page. The question every SDK has to answer is how much of that to translate into the host language.

Wajub's answer is deliberately narrow. Method names follow your language. Payload field names do not. A field keeps the name the API gave it, in all seven SDKs.

What changes, and what does not

LayerFollows the languageExample
Client, resource and method namesYeswajub.payments.listRefunds(), client.Payments.ListRefunds()
Fields you sendNo"authorization_url", "per_page", "decline_code"
Fields you read backNopayment.authorization_url, payment["created_at"]
HTTP paths and query parametersNo/webhooks, ?per_page=50
Header namesNoIdempotency-Key, X-Wajub-Signature
Enum valuesNopayment.succeeded, pending, XAF
Resource idsNotrx_…, cus_…, po_…

So the same field is spelled the same way whichever SDK you are in, and the API reference is readable from any of them without a mental mapping step.

"authorization_url": "https://pay.wajub.com/test_xxxxx"

In Ruby it is payment.authorization_url, in Java payment.getAuthorizationUrl(), and in C# payment.AuthorizationUrl. Go, Java and C# give the payment's main fields as typed fields named the language's way; their Raw holds the transaction object only, where authorization_url is not (the API returns it beside the transaction), so Raw["authorization_url"] finds nothing.

The method names, by language

SDKStyleA method that shows it
Node.jscamelCasewajub.webhookEndpoints.rotateSecret()
Pythonsnake_casewajub.webhook_endpoints.rotate_secret()
PHPcamelCase$wajub->webhookEndpoints->rotateSecret()
GoPascalCaseclient.WebhookEndpoints.RotateSecret()
Rubysnake_caseclient.webhook_endpoints.rotate_secret
JavacamelCaseclient.webhookEndpoints().rotateSecret()
C#PascalCase with Asyncclient.WebhookEndpoints.RotateSecretAsync()

One name had to bend further than the rest, because the obvious one was already taken.

WhereWhy
wajub.global_ in Pythonglobal is a keyword. Every other SDK calls the accessor global

payments.initialize, an alias of create, is left in the PHP SDK only. The other six removed it, Node.js in 1.5.0 and Python, Go, Ruby, Java and C# in 1.2, where it was initialize_payment in Ruby and InitializeAsync in C#. Call create everywhere.

The typed languages decode a few fields

Go, Java and C# are statically typed, so they cannot hand you an arbitrary bag of fields and let you reach into it. They decode a small struct and keep everything else raw.

payment.id
payment.status
payment.amount
payment.currency
payment.authorization_url
payment.authorization_token
payment.reference         // an index signature covers the rest

Those are the only renamed fields in the whole surface, and the rename is mechanical: authorization_url becomes AuthorizationURL in Go, getAuthorizationUrl() in Java, AuthorizationUrl in C#.

The mobile SDKs made the opposite choice, twice

They are the one place where this is not consistent.

SDKField styleExample
wajub_mobile (Flutter)Renamed to camelCaseerror.declineCode, transaction.amountTotal
com.wajub:wajub-mobile-core (Android)Renamed to camelCaseerror.declineCode, channel.publishableKey
@wajub/react-nativeKept as snake_caseerror.decline_code, channel.publishable_key

Flutter and Android decode into data classes and rename as they go. React Native keeps the wire shape. Porting a handler between React Native and Flutter therefore means renaming every field, which is worth knowing before you start.

Reading the API reference from any SDK

The reference documents the wire. Apply exactly one transformation.

In the referenceIn your code
POST /webhooks/{id}/rotate-secretThe method, in your language's style
authorization_url in the response bodyThe same string, unchanged
per_page as a query parameterThe same string, unchanged

Without an SDK, everything is snake_case

A raw HTTP call sends and receives snake_case in JSON bodies and query strings. There is no endpoint that accepts camelCase.

What did you think of this content?