Payments API

Accept payments by card, mobile money and bank transfer, then confirm, cancel and refund them. This page summarises the routes and the rules that apply to all of them; the API reference has every field and error per endpoint, and the integration guide walks through a full integration.

Base URLs

  • https://api.swiftdime.com — live
  • https://sandbox.swiftdime.com — test

Both hosts serve the same payment routes. The key decides the environment: an fl_sk_test_ key only ever touches test data, an fl_sk_live_ key only live data. Plain HTTP is refused (403 HTTPS_REQUIRED).

Request headers

  • Authorization: Bearer fl_sk_… — required on authenticated routes.
  • Content-Type: application/json
  • X-Idempotency-Key — on initialize, session and refund; makes retries safe.
  • API-Version: 2025-11-26 — optional; defaults to your pinned version.

Every key has an allowed-IP list, and a request from any other IP is refused with 403 IP_NOT_ALLOWED. Never put the secret key or the fl_enck_ encryption key in a browser or mobile app.

Two ways to take a payment

Hosted checkout — POST /payments/sessionDirect charge — POST /payments/initialize
Who collects payment detailsSwiftDime's hosted pageYour server
Your reference fieldtx_ref (required)reference (optional; SwiftDime's transaction_reference is used if omitted)
Payment optionspayment_options: card, mobilemoney (comma-separated)payment_type: card, mobile_money or bank_transfer
redirect_urlRequiredRequired for card
customeremail requiredemail or phone_number required
Card dataNever reaches your serverEncrypted client payload or card_token — never raw
Split subaccount idUUID onlyUUID or FL_… id
Success HTTP status201 with checkout_url201 (in progress or completed), 202 (3-D Secure), 200 (declined: status failed)

Endpoints

Take a payment

Server-to-server. Send your secret key.

POST/api/v1/payments/sessionSecret key · payments:writeCreate a hosted checkout session and get a checkout_url.
POST/api/v1/payments/initializeSecret key · payments:writeCreate and charge a payment directly (card, mobile money, bank transfer).
POST/api/v1/payment-methods/cards/tokenizeSecret keyStore a card without charging it; returns a card_token.
GET/api/v1/payments/verify/{reference}Secret key · payments:readRead a payment's current status by its reference.

Manage a payment

Every route takes the payment's reference, never an internal id.

GET/api/v1/transactionsSecret keyList payments with filters (reference, status, payment_type, dates).
GET/api/v1/transactions/{reference}Secret keyFull record: fees, net amount, metadata, failure_reason, timestamps.
GET/api/v1/transactions/{reference}/verifySecret key · payments:readAsk the provider for the latest status and record it.
PUT/api/v1/transactions/{reference}/authorizeSecret key · payments:writeSend a card PIN, OTP or extra fields the provider asked for.
POST/api/v1/transactions/{reference}/cancelSecret key · payments:writeMark a pending or processing payment cancelled (no provider call).
POST/api/v1/transactions/{reference}/refundSecret key · refunds:writeRefund a completed payment in full or in part.

Availability

Public lookups, no API key.

GET/api/v1/payments/initialize/mobile-money-providers?country=XXNoneMobile money networks SwiftDime can charge in a country right now.
GET/api/v1/payments/initialize/methodsNonePayment methods configured on the platform, filterable by country and currency.
GET/api/v1/payments/initialize/methods/{id}NoneOne payment method.

Payment statuses

  • pending — Created, not yet handed to a provider.
  • processing — With the provider or waiting on the customer (for example a mobile money prompt).
  • pending_3ds — A card 3-D Secure challenge is outstanding.
  • completed — Paid. The only success state — fulfil on this.
  • failed — Declined or errored. failure_reason explains why, in buyer-safe words.
  • cancelled — Cancelled before completion.
  • expired — No outcome within the payment window (default 15 minutes for mobile money and cards; 60 minutes for bank transfer).
  • refunded — Refunded in full. A partly refunded payment stays completed.

On the hosted checkout, a customer whose payment fails can try again on the same page until the checkout link expires; the payment keeps its reference.

next_action

Present on a charge response while the payment is pending, processing or pending_3ds and something is left for the customer to do.

  • payment_instruction — Show next_action.note. The customer approves a prompt on their phone (mobile money); wait for the webhook.
  • redirect_url — Send the customer to next_action.url (3-D Secure challenge or a provider page).
  • requires_pin — Collect the card PIN and send it with PUT /transactions/{reference}/authorize (type pin).
  • requires_otp — Collect the OTP and send it with PUT /transactions/{reference}/authorize (type otp).
  • requires_additional_fields — Collect the fields named in next_action.fields and send them with authorize (type avs).
  • requires_bank_transfer — The customer completes a bank transfer; wait for the webhook.

Response conventions

  • Success: { success: true, data, meta: { request_id, timestamp, version } }. Errors: { success: false, error: { code, message, details } }. Quote meta.request_id when contacting support.
  • Amounts are decimal strings without trailing zeros ("150", "49.99"); timestamps are RFC 3339.
  • A declined direct charge is HTTP 200 with data.status: "failed", not a 4xx — always branch on data.status.
  • When the customer bears the fee (the account default) the charged amount can be higher than the amount you sent. Your amount is kept in metadata.merchant_requested_amount and what you receive is net_amount, both on GET /transactions/{reference}.
  • Webhooks notify you; GET /payments/verify/{reference} confirms. Fulfil only on completed. See Webhooks.

Errors you are most likely to meet

IP_NOT_ALLOWED403Add your server's outbound IP to the key's allowed IPs. A key with no allowed IPs accepts no requests.
PUBLIC_KEY_NOT_ALLOWED401An fl_pk_ key was sent as Authorization. Use the fl_sk_ secret key; the publishable key only goes in public_key.
INVALID_API_KEY_PREFIX401The Bearer value must start with fl_sk_live_ or fl_sk_test_.
INSUFFICIENT_SCOPE403The key lacks the scope the route needs (payments:write, payments:read or refunds:write).
REDIRECT_URL_REQUIRED400Card charges need redirect_url.
DUPLICATE_REFERENCE409That reference (or tx_ref) is already used on your account. Use a new one.
DUPLICATE_REQUEST409A request with this X-Idempotency-Key is still being processed. Wait and retry with the same key.
INITIALIZATION_FAILED400Checkout sessions only: the message names the problem, e.g. payment_options must say mobilemoney, not mobile_money.
kill_switch503Payments (or refunds) are halted by an operator. Retry later.

Every endpoint's full error list is in the API reference; see also Error codes.

Integration guideAPI referencePayment methods

🚧 Development Notice

This payment gateway is currently under development and not authorized for commercial use. We are actively working on:

  • Regulatory compliance and licensing
  • Payment gateway aggregator registration
  • Security audits and certifications
  • Production infrastructure setup
Sandbox Mode Available: Test our payment system without real transactions