Skip to main content

Configuration

A client is built once from six values and reused for the life of the process. It is safe to share between threads or requests.

Required values​

ValueWhere it comes fromNotes
Base URLhttps://panama.deepayment.com/api/v1Scheme and host only, https required. A path, query or fragment is rejected; the SDK appends /api/v1/... itself.
Access KeyMerchant portalPublic identifier. Sent in Merchant-Access-Key; the platform uses it to find your registered public key.
Merchant private keyGenerated by youEd25519, base64. Both the 32-byte seed that libsodium and OpenSSL produce and the 64-byte seed-plus-public-key form are accepted. Never leaves your servers. See Key setup.
Platform body key idMerchant portalNames the platform X25519 key that seals your POST bodies. It travels in the envelope so the gateway knows which private key opens it.
Platform body public keyMerchant portalX25519, base64, 32 bytes. Must be the key named by the body key id.
Platform webhook public keysMerchant portalMap of keyId to Ed25519 public key, base64, 32 bytes each. Required even if you do not consume webhooks.

Keys are environment specific. Do not reuse production keys in a test environment.

Webhook key rotation​

The webhook carries the keyid it was signed with, and the SDK looks that id up in the map you configured. During a rotation the platform announces the new key before signing with it; add it to the map so both keys are present, and remove the old one after the platform stops using it. A webhook signed with a key that is not in the map fails verification.

Building the client​

import deepayment "github.com/deepayment/sdk-go"

c, err := deepayment.NewClient(deepayment.Config{
BaseURL: "https://panama.deepayment.com",
AccessKey: "mak_live_xxx",
MerchantPrivateKeyBase64: merchantPrivateKey,
PlatformBodyKeyID: "body_20260827_01",
PlatformBodyPublicKeyBase64: platformBodyPublicKey,
PlatformWebhookPublicKeys: map[string]string{
"pwhk_20260827_01": platformWebhookPublicKey,
},
// optional
Timeout: 30 * time.Second, // ignored when HTTPClient is set
HTTPClient: nil, // your own *http.Client, e.g. with a proxy
UserAgent: "", // default merchant-sdk-go
AcceptLanguage: "", // default en-US; message language of error text
MaxResponseBytes: 0, // default 8 MiB
})

NewClient returns an error, not a client, when a value is missing or malformed. The error names the field.

Optional settings​

SettingDefaultEffect
Timeout30 sWhole request, connect to last byte. On timeout the SDK returns a transport error; the outcome is unknown, see Errors.
User-Agentmerchant-sdk-<lang>Sent on every request. Append your own product name if you want to identify your integration in platform logs.
Accept-Languageen-USLanguage of the human-readable message in error responses.
Max response bytes8 MiBA larger response is discarded and reported as a response-too-large error.
HTTP client / transport / fetchbuilt inInject your own when you need a proxy, custom TLS or connection pooling. Go ignores Timeout when HTTPClient is set; configure the timeout on your client instead.

Clock​

Signatures carry created and expires timestamps at most 300 seconds apart and the platform rejects signatures outside the window. Keep the server clock synchronized with NTP; a drift of more than a few minutes makes every request fail with UNAUTHORIZED.