Skip to main content

Charge a customer using tokenized card data

Step 3 of 5. When a payment is due, send the card token and the order details to Nomba. The customer doesn’t need to be on your site, unless their bank asks for an OTP.

POST /v1/checkout/tokenized-card-payment

Don’t use description to decide what happened. It says "tokenized transaction completed successfully" whenever Nomba reached the bank, even when the charge was declined or is still waiting for an OTP. Read data.status and data.otpRequired.

Headers

string
required
Bearer <access_token>
string
required
Your account ID. Nomba credits the charge to this account.

Request body

string
required
The card token you stored from the webhook
object
required
Details of this charge
Sub-account (order.accountId) and split (order.splitRequest) settings aren’t applied to charges on a saved card yet. callbackUrl isn’t needed, because there’s no page to redirect the customer to.

Response body

string
required
"00" when Nomba sent the charge to the bank. "400" when Nomba rejected the request before charging the card.
string
required
Response description. Don’t use it to decide the outcome.
object
required

Read the response

An OTP is the only challenge you can complete on a saved-card charge. If the bank asks for a 3D Secure check instead, the charge fails. Ask the customer to make a new card-saving payment with that card.

Charge on a schedule

Nomba doesn’t schedule API charges. Your server decides when each customer is due. A common setup is a scheduled job, such as a cron job, that runs every day:
  1. Find every customer whose payment is due today.
  2. Charge each one with a new orderReference.
  3. Record the result against the customer’s subscription.
A scheduled charge runs when the customer isn’t using your app. If their bank asks for an OTP, the customer still has to enter it within 15 minutes, or the charge fails. Run scheduled charges during the day, and when otpRequired is true, notify the customer straight away with a link to a page where they can enter the code.

When a charge fails

Rejected by Nomba (code "400"). Nothing was sent to the bank. Common messages: Declined by the bank (code "00", data.status false). The bank’s reason is in data.message, for example Insufficient funds. or Your card has expired. Please use a different card. The exact wording depends on the bank and card network. To retry safely:
  • If you don’t know whether a charge went through (for example, your request timed out), send it again with the same orderReference. Nomba never charges the same orderReference twice. If the first request reached Nomba, the retry is rejected with β€œAn order already exists with this order reference”. Verify that orderReference to see the result.
  • If the bank declined the charge, don’t retry straight away. Wait, for example 24 hours, and stop after a few attempts. Use a new orderReference for each new attempt.
  • Ask the customer for a new card if the charge keeps failing, or if the card has expired.

Next: Complete an OTP challenge

Finish a charge when the customer’s bank asks for an OTP.