Authentication

API apps, key types, restricted keys, and rotation.

API Apps

Watenga uses API apps to manage your keys. Each app has a Client ID and a Secret Key.

You can create multiple apps — one for your website, one for your mobile app, one for WHMCS, etc. Each has independent keys and webhook configuration.

Create and manage apps in the Developer Console at https://developer.watenga.africa/apps.

Key Types

KeyUseExposure
Client ID (pk_live_ or pk_test_)Browser / frontend (Watenga.js)Safe to expose publicly
Secret Key (sk_live_ or sk_test_)Server-side API onlyNever expose — full account access
Restricted Key (rk_live_ or rk_test_)Limited integrationsScoped permissions only

Public key — Watenga.js and the mobile sheets. A publishable key only pays what your server decided: a checkout session's client_secret (from POST /v1/checkout/sessions with your secret key), a payment link or an invoice.

javascript
const w = Watenga('pk_test_abc123...');
w.mount('#pay', { clientSecret: session.client_secret, amount: 25, currency: 'USD', reference: 'INV-001' });

Secret key — server-side API call:

http
Authorization: Bearer sk_test_abc123...

Never expose your Secret Key

Never put your Secret Key in frontend code, browser extensions, or mobile apps. It gives full access to your account.

Restricted Keys

Give a system only the access it needs: a restricted key (rk_test_…, rk_live_…) holds one scope per resource, each none, read (GET) or write (everything). Create them in the developer console under your API app (two-step verification); a key can expire on a date you choose.

ScopeWhat it reaches
transactionsCheckout and checkout sessions, payments, saved cards, disputes, splits, TrustPay
refundsRefunds (write: refund, within the key’s own per-currency limits)
payment_linksPayment links
invoicesInvoices and quotations
subscriptionsPlans, subscriptions, usage and entitlements
customersCustomers
shopStores, products and orders
donationsDonation campaigns and gifts
bookingsBooking services and appointments
elementsSecure Elements sessions
accountBalance, profile, subaccounts, bank accounts
webhooksWebhook endpoints, listen sessions and trigger

A route no scope covers is refused with 403 SCOPE_FORBIDDEN: use a secret key for it. Payouts and disbursements are dashboard-only, with two-step verification, and no key reaches them.

Ask the API what the key in use may do:

bash
curl https://api.watenga.africa/v1/account/api-key -H "Authorization: Bearer rk_test_..."
# { "kind": "restricted", "livemode": false, "scopes": { "transactions": "read", "refunds": "none", ... }, "features": { ... } }

Key Rotation

Rotate a secret key in the developer console (your app → Credentials → Rotate secret, two-step verification). If the key may have leaked, end the old key at once. Otherwise keep it working for an overlap (1 hour to 7 days) while your servers move to the new key; the console shows when it stops and lets you stop it early.

Webhook signing secrets rotate the same way: during the overlap every delivery is signed with both secrets (Webhooks). Rotate keys you suspect, and at least yearly.