Choose how the customer pays
Hosted checkout
Redirect the browser to the checkout URL. Vestrapay renders the pay screen, collects card details in processor-hosted fields, runs 3-D Secure and shows transfer details. Least code, fastest to production.
Custom checkout
Build your own pay screen and call the checkout endpoints with the access code. You control every pixel and every state, and you take on the 3-D Secure and countdown handling.
Hosted checkout
- Your server sends POST
/v1/payment/initializewith your secret key. - You store
data.referenceon the order and redirect the browser todata.checkoutUrl. - The customer picks a channel and pays. Hosted checkout handles card entry, 3-D Secure, transfer details, retries and expiry.
- Vestrapay sends the browser to your
callbackUrland posts a webhook to your server. - You verify the payment and fulfil the order.
Custom checkout
- Initialise as above. Keep
data.accessCodeanddata.reference. - For card, create a hosted card session, mount the processor’s fields, then charge. See Pay with card.
- For transfer, request a virtual account and show the bank, account number and countdown. See Pay with transfer.
- For pay with bank and USSD, see Other channels.
- Optionally subscribe to GET
/v1/payment/checkout/eventsso the pay page updates live. - Confirm with a webhook and verify, exactly as for hosted checkout.
x-access-code header, never with the secret key. The access code expires after 60 minutes.
What initialise accepts
Send a JSON body to POST/v1/payment/initialize with your secret key.
A successful call returns HTTP 201 and the session in the data object:
distribution property so you can confirm what was applied.
The callback query string
When checkout finishes, the customer’s browser is sent to your callback URL with these query parameters added:
The callback page is for the customer’s experience: show a receipt, a failure message or a “we are confirming your payment” screen. It is not a trusted signal. Anyone can type a URL into a browser, so never fulfil from these parameters. Call verify from your server with the reference and decide there.
Metadata
Metadata is your own correlation data. Use it to carry whatever you need to find the order again, such as an order ID, a customer ID or a campaign tag.Metadata on a payment link is different. On a link it defines the form the customer fills in before paying. See Payment links.
Fees and who pays them
Vestrapay charges a fee per collection, and the fee depends on the channel. Initialise tells you the fee for each so you can display totals.
The default comes from your payment settings in the dashboard. Pass
merchantBearsCost on initialise to override it for one payment.
- Customer bears the fee (default for most accounts): the customer pays the total. You settle the full amount.
- You bear the fee: the customer pays the amount. You settle the amount less the fee. Verify reports this as
amountSettled.
Channels
Initialise returns the channels available for this payment:card, bank_transfer, bank_payment and ussd. Hosted checkout shows only the ones enabled for your account. Your enabled set can be narrower than the list the platform supports. If a channel you expect is missing, check your dashboard settings or contact tech@vestrapay.com.
Splitting a payment
If the money from one payment should reach more than one account, add a distribution map to the initialise body. Each key is the service key of a service you have already configured, and each value is the amount to route to that service. Whatever you do not allocate goes to your primary settlement account.After the customer pays
- Receive the signed webhook and the browser callback.
- Verify the reference with your secret key.
- Fulfil the order once, only on
successwith a matching amount.