Skip to main content
Let agents buy credits first and use them later. The agent pays for a top-up. Your service adds credits to the account.

The rule

Add credits only after the payment completes. Add credits only one time for each payment. InFlow blocks duplicate payments, but your service must block duplicate credits.

Make a top-up endpoint

  1. Set a fixed price for each top-up package. See Write a price for x402 and Choose the currency for MPP.
  2. Protect the endpoint with MPP, x402, or both. See Get paid by agents.
  3. Find the account from your usual authentication. With Onboard, the enrollment credential of the agent identifies the account.
  4. Make a top-up ID for each request. Keep it with the transaction ID of the payment.

Add the credits

The two protocols run your handler at different times. For x402, add the credits when you know that the payment settled. A TRANSACTION_UPDATED webhook with the status SETTLED tells you. The SDKs have no shared callback for after settlement.

If adding credits fails

Do not ask for a second payment. Try again to add the credits for the same top-up ID. Use the transaction ID to find the payment. If your server did not see the result, get the payment status from a webhook.

Let the buyer choose the amount

Fixed packages are the simplest. With MPP, you can also set the price from the request. With x402, use fixed packages.

Next step

Webhooks

Get a signed event when a transaction changes.
Last modified on November 13, 2026