Skip to content

Authentication

Key types

TypePrefixUse
Secret keysk_Server-side only - full API access
Publishable keypk_Client-side - widget initialisation and tokenisation only
OAuth tokenoa_Platform integrations acting on behalf of a biller account

Never expose a secret key in browser code, mobile apps, or source control.

Sending a secret key

Pass your secret key as a Bearer token in the Authorization header:

Terminal window
curl https://api.elasticpay.co/api/v1/payment_intents \
-H "Authorization: Bearer sk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Client secret header

When confirming a payment from the client side with a publishable key, include the payment intent’s client_secret in X-Client-Secret:

Terminal window
curl -X POST https://api.elasticpay.co/api/v1/payment_intents/pi_0abc123/confirm \
-H "Authorization: Bearer pk_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "X-Client-Secret: pi_0abc123_secret_xyz987" \
-H "Content-Type: application/json" \
-d '{"payment_method": "pm_0xyz789"}'

The widget handles this automatically - you only need this header if calling confirm directly from the browser.

OAuth tokens

OAuth tokens (oa_...) act on behalf of multiple biller accounts. Include X-Biller-Account with every request:

Terminal window
curl https://api.elasticpay.co/api/v1/payment_intents \
-H "Authorization: Bearer oa_sandbox_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "X-Biller-Account: biller_abc123"

Key formats

TypeFormat
Secret sandboxsk_sandbox_[32 alphanumeric]
Secret livesk_live_[32 alphanumeric]
Publishable sandboxpk_sandbox_[32 alphanumeric]
Publishable livepk_live_[32 alphanumeric]
OAuthoa_sandbox_... / oa_live_...

Keeping keys safe

  • Use pk_ keys on the client side - they are scoped to tokenisation only and cannot charge or refund.
  • Never commit keys to source control. Use environment variables or a secrets manager.
  • Rotate keys immediately if you suspect exposure. Revocation takes effect instantly.