Card Collection
Accept card payments from customers in NGN and USD with 3-D Secure where required. Transfaar hosts the payment UI, so raw card data never touches your servers and you do not need PCI certifications.
Quick Facts
- Supported currencies:
NGN,USD - Base URL:
https://api.transfaar.com/api/v1 - Authentication: HMAC (
X-API-Key,X-Timestamp,X-Signature) — required only forinitialize/ verify / refund; the payment itself runs on the public hosted checkout, authenticated by theaccess_code - PCI model: hosted checkout — card data is encrypted client-side and handled by Transfaar's payment provider
Quote vs checkout: card collection is a checkout flow, not a Quotes flow. Only initialization (and verify/refund) use your signed API key. The customer completes payment on the public hosted page, authenticated by the
access_codealone, so it runs in a browser or mobile client without exposing your keys.
Flow
- Initialize — Create a checkout session from your backend (
POST /client/checkout/initialize). - Redirect — Send the customer to the returned
checkout_linkto pay on the hosted page. - Confirm — Receive the result via webhooks (source of truth) and optionally the verify API.
- Reconcile — Store your
referencewith the returnedtransactionReffor support and reconciliation.
If you want to build your own card form instead of the hosted page, see API-driven card checkout.
Initialize Payment
POST /client/checkout/initialize (protected — HMAC API key)
This is the only step that uses your signed API key — never perform it on the browser or mobile client.
Request Body
Success Response
Keep the access_code — it authenticates the payment endpoints below.
Payment Endpoints (Public)
These endpoints are used by the hosted checkout page and are public — no API key or signature is required. They are authenticated by the access_code returned from initialization.
1. Discover methods for a currency
GET /checkout/currency-methods/:currency
Lists the payment methods available for a currency, so you can render the right options without hardcoding them.
Example — GET /checkout/currency-methods/USD
Response:
Example — GET /checkout/currency-methods/NGN
Response:
2. Select the payment method
POST /checkout/:access_code/select-method
Selects the payment method for the checkout session. For card payments, send CARD.
Request Body
Success Response
3. Charge the card
POST /card/card-charge
Submits the card payment for a checkout session. The request is a hybrid-encrypted envelope: the card data payload is encrypted with AES-256-GCM, and the AES key is encrypted with RSA-OAEP-SHA256 using the checkout public key. The envelope is authenticated by the access_code in the payload, so no HMAC signature is required.
Envelope Request Body
Decrypted inner payload (encrypted_payload before encryption)
Success Response (payment completed)
Response (3-D Secure required)
When 3-D Secure is required, the payment is not yet complete. Redirect the customer to the returned threeDsUrl to complete the challenge, then poll for the final status:
4. Check payment status
GET /checkout/:access_code/payment-status
Returns the current payment status for a checkout session.
Example — GET /checkout/AbCdEfGhIjKlMnOpQrStUv/payment-status
Response:
Verify Payment Status
GET /client/payment/verify?reference={transaction_reference} (protected — HMAC API key)
or, for checkout sessions, use the reference you supplied during initialization:
GET /client/payment/verify?origin_reference={your_checkout_reference}
When origin_reference is used, Transfaar resolves the matching checkout quote/transaction and returns the same response shape.
Success Response
Refunds
Refunds share a single endpoint across all supported currencies — see the full Refunds page for request/response fields, eligibility rules, status values, and error handling. When initiating a refund, pass the deposit's transaction_reference, not its internal transaction_id UUID.
POST /client/payment/refund— initiate a refundGET /client/payment/refund/status/:refund_reference— check refund statusGET /client/payment/refund/history— list refund history
Testing
Use staging for all test card scenarios and webhook validation.
Test Cards
To simulate failures, use these expiry dates:
05/39for decline04/27for expired card08/28for timeout behavior
Recommended Test Matrix
- Successful 3DS payment
- Successful non-3DS payment
- Declined card scenario
- Expired card scenario
- Timeout scenario
- Webhook retry handling
- Manual verify fallback after checkout completion
Best Practices
- Always use webhooks — network issues can prevent a customer from reaching your
redirectUrl. Webhooks ensure you never miss a payment. - Verify amounts — before providing service, verify that the
amountin the webhook/verify response matches your expected order total. - Use unique references — unique
referencevalues for every initialization prevent duplicate charges for the same order. - Secure your keys — never perform API calls or HMAC signing on the frontend. These should always happen on your secure backend.
- Keep references together — store your
referencewith the returnedtransactionReffor support and reconciliation.