NyukiAIPayment

Documentation

Take your first payment.

Everything below is the real contract: the routes, the statuses, the failure codes, and the rules a correct integration follows.

The three kinds of key

A key is minted in the dashboard and returned exactly once. Only a selector and a hash of the verifier are stored, so there is no reveal endpoint and there never will be.

nyk_sk_live_…

Secret key

Server-side only. Full authority over your app, and optionally bound to one wallet so a key separates one project’s money from another’s.

nyk_pk_live_…

Publishable key

Safe in a browser or an app, but it cannot create a payment or read your data. It lists the methods available for a corridor and, with a payment’s client secret, confirms and follows that one payment.

nyk_rk_live_…

Restricted key

Server-side, limited to an explicit list of permission scopes. One per integration, so a compromise has a blast radius rather than a total.

Which key for which call

Every endpoint, and what each kind of key needs to call it. A restricted key needs the scope shown; a secret key needs nothing extra.

EndpointSecretRestricted — scopePublishable
POST /v1/payment_intentsYespayments.intents.createNo
POST /v1/payment_intents/:id/confirmYespayments.intents.createWith the client secret
GET /v1/payment_intents/:idYespayments.intents.readWith the client secret
GET /v1/payment_intentsYespayments.intents.readNo
POST /v1/customersYescustomers.writeNo
GET /v1/providersYesAny keyYes
POST /v1/payment_linksYesbilling.links.manageNo
GET /v1/payment_links/:idYesbilling.links.readNo
POST /v1/payment_links/:id/deactivateYesbilling.links.manageNo
POST /v1/sellersYessellers.manageNo
GET /v1/sellersYessellers.readNo
GET /v1/sellers/:idYessellers.readNo
PATCH /v1/sellers/:idYessellers.manageNo
POST /v1/sellers/:id/payout_destinationsYessellers.manageNo
POST /v1/sellers/:id/payoutsYessellers.payouts.createNo
GET /v1/sellers/:id/payoutsYessellers.readNo
GET /v1/sellers/:id/payouts/:payoutIdYessellers.readNo
POST /v1/disputesYespayments.disputes.manageNo
GET /v1/disputesYespayments.disputes.readNo
GET /v1/disputes/:idYespayments.disputes.readNo
POST /v1/disputes/:id/acceptYespayments.disputes.manageNo
POST /v1/disputes/:id/rejectYespayments.disputes.manageNo
POST /v1/refundsYespayments.refunds.createNo
GET /v1/refunds/:idYespayments.refunds.readNo

Using a publishable key

For a checkout you build yourself. Your server creates the payment with the secret key and gives the browser two things: the payment id and its clientSecret. The browser then confirms it and follows its progress with the publishable key, sending the client secret each time. The key is public by design; the client secret is what limits it to the one payment it was handed.

// 1. Your server creates the payment with the SECRET key, and hands the
//    browser only the id and the client secret.
app.post('/pay', async (req, res) => {
  const response = await fetch('https://secure.nyukiai.com/v1/payment_intents', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.NYUKIAI_SECRET_KEY}`,
      'Idempotency-Key': `order-${req.body.orderId}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      amount: '500000',
      currency: 'XAF',
      country: 'CM',
      methodType: 'MOBILE_MONEY',
      reference: req.body.orderId,
      providerParams: { msisdn: req.body.phone },
    }),
  });
  const intent = await response.json();
  res.json({ id: intent.id, clientSecret: intent.clientSecret });
});

Scopes

A restricted key carries permission codes and may exercise only the intersection of its own scopes and what its app is allowed to do. Widening an app’s permissions never silently widens a key.

Create one under Developers → API keys: choose Restricted, then tick the scopes. You can only grant scopes you hold yourself. The key works exactly like a secret key for everything in its scopes, and answers 403 for everything else.

IP allowlist

Each key can name the source addresses permitted to use it. It defaults to empty, meaning any address, because an app on dynamic egress would otherwise lock itself out — but on a fixed egress it is the strongest single control you have.