Guides
Card acceptance

Card acceptance

Accept card payments from your customers, with 3-D Secure and refunds. Card data is encrypted end-to-end — Swahilies gives you a public key, and you send card details only as ciphertext.

Scope required: psp:nuvion-merchant

1. Get the encryption key

curl https://engine.swahilies.net/api/psp/nuvion/encryption-key \
  -H "Authorization: Bearer swh_live_<prefix>_<secret>"
{ "algorithm": "RSA-OAEP-SHA256", "public_key": "-----BEGIN PUBLIC KEY-----\n..." }

Encrypt the card object (PAN, expiry, CVV) client-side with RSA-OAEP / SHA-256 using this key. Raw card numbers never touch your server or ours in the clear.

2. Create a payment

curl -X POST https://engine.swahilies.net/api/psp/nuvion/payments \
  -H "Authorization: Bearer swh_live_<prefix>_<secret>" \
  -H "Content-Type: application/json" \
  -d '{
    "reference": "order_1042",
    "amount_minor": 1999,
    "currency": "USD",
    "encrypted_card": "<base64 RSA-OAEP ciphertext>"
  }'
{
  "reference": "order_1042",
  "status": "requires_action",
  "next_action": { "type": "3ds_redirect", "url": "https://..." }
}

3. Complete 3-D Secure

If status is requires_action, redirect the cardholder to the next_action URL to complete 3-D Secure. The final result (succeeded / failed) arrives via a payment webhook.

Retrieve, cancel, refund

# Fetch a payment
curl .../api/psp/nuvion/payments/<reference>             -H "Authorization: Bearer <key>"
# Cancel one that hasn't completed
curl -X POST .../api/psp/nuvion/payments/<reference>/cancel -H "Authorization: Bearer <key>"
# Refund (full or partial)
curl -X POST .../api/psp/nuvion/payments/<reference>/refunds \
  -H "Authorization: Bearer <key>" -H "Content-Type: application/json" \
  -d '{ "amount_minor": 1999 }'
⚠️

Treat requires_action and pending as not yet paid. Fulfil the order only after the webhook reports succeeded, reconciled by your reference.

The flow

Encrypt

Fetch the public key and encrypt the card client-side.

Create

POST the payment with the ciphertext and your reference.

Authenticate

Redirect for 3-D Secure if required.

Confirm

Act on the payment webhook's final status.