Skip to main content
Some companies operate with a monthly prepaid package: you pay a plan in advance, and Kravata draws the service costs of your operations from that balance, as set in your agreement. If your company has the prepaid package enabled and this month’s payment is missing, new operations are blocked until it is paid: both the ones your users create and the ones your server creates through the API with your partner token. This guide shows how to list the plans, pay with PSE, Bre-B, USDC or USDT, and check the balance.

Who can pay

Only one user per company, the payer user, can list plans, pay and check the balance. By default it is your company’s own user in Kravata, the one whose user id is your client id. Kravata can configure another user as the payer instead: ask your Kravata point of contact which user it is, or to change it. Any other user gets 403 PREPAID_PAYER_ONLY. The calls are made as the payer user, with that user’s own token, like the Kravata widget. They do not use the partner token of your server.
Send the user token in both headers on every call: Authorization: Bearer <token> and Cookie: accessToken=<token>. Some routes check one header at the gateway and some check the other. See WhatsApp channel for how user tokens work.
The examples below use the test domain.

How the month works

  • The month is the calendar month in Colombia time (America/Bogota).
  • A payment counts in the month in which it is completed, not the month in which you created it. A payment still pending at midnight on the last day of the month counts in the next month.
  • Your first package payment is prorated: you pay for the days left in a 30-day month, counting today. prorateDays is 30 on day 1, 16 on day 15 and 1 from day 30 on. The amount is monthlyAmount × prorateDays / 30, rounded to 2 decimals.
  • The balance you can still use is paid − used. At the end of the month the unused balance is not carried over.
  • Your company can have one pending payment at a time.

1. List the plans

Call GET /api/v1/prepaid/plans. It returns your company’s active plans, cheapest first.
An empty list means your company has no active plans. If the plans cannot be read right now you get 503 PREPAID_PLANS_UNAVAILABLE: try again in a moment.

2. Pay

Call POST /api/v1/prepaid/payments with exactly one of planCode (a plan from step 1) or amount (a custom amount in the balance currency). The response is 201 and the payment starts in PENDING:
The balance is in USD or COP. If it is in USD, the amount is converted to COP at the current exchange rate and rounded up to whole pesos.
paymentInstructions contains amount and currency (COP), paymentMethod, and pseLink. Send the user to pseLink to pay.
The operation object has more fields; the example shows only the ones you need here. The payment is COMPLETED when the money arrives, and REJECTED if it fails or the payment is rejected. A REJECTED payment adds nothing to your balance and you can pay again.

Errors when paying

Errors have the shape {"error": {"code": "...", "message": "...", "request_id": "..."}}.

3. Check the status

Call GET /api/v1/prepaid/status.

The PREPAID_REQUIRED error

When the prepaid package is enabled for your company and paidAmount is below minimumRequired, these calls are rejected. Made by your users, with their user token:
  • POST /api/v1/operations
  • POST /api/v1/operations/deposit
  • POST /api/v1/operations/withdrawal
  • POST /api/v1/operations/transfer
Made by your server through the API, with your partner token:
  • POST /api/v1/admin/operation/{user_id}/deposit
  • POST /api/v1/admin/operation/{user_id}/withdrawal
  • POST /api/v1/admin/operation/{user_id}/transfer
The status is 403. The message is in Spanish. It points to this guide. What to do:
1

Pay the package

Have the payer user pay as in step 2.
2

Wait for COMPLETED

The block ends when the payment is COMPLETED and paidAmount reaches minimumRequired. Check it with the status.
3

Try the operation again

Operations that were rejected with PREPAID_REQUIRED were not created: create them again.
Paying is never blocked by this error. If your company has no active plans, the error does not apply.