Requirements
These instructions explain how to add gift cards to your existing API-only integration. The API-only integration works the same way for all payment methods. If you haven’t done this integration yet, refer to our API-only integration guide. Before starting your integration make sure you:- Set up your back end implementation.
- Added each gift card variant that you want to test in your Customer Area. You can test a limited number of gift card variants and simulate gift card payments. When testing, you use a simulator that tries to behave and respond in the same way as an end-to-end connection with a gift card provider. Before you go live, you must onboard with a gift card provider and add the gift card variant to your live Customer Area.
Build your payment form for gift cards
You must build a separate integration for each gift card provider. You can process payments for supported gift cards or manage other transactions like adding to the balance of a gift card. If you are using the /paymentMethods request to show the available payment methods to your shopper, specify the following in your request:- countryCode: Country where that gift card is supported, for example, NL.
- amount.currency: Any supported currency, for example, EUR.
- channel: Set to Web.
paymentMethods array, for example:
Check the balance
After the shopper enters the gift card details, check if the balance is enough to make a full payment.-
Make a /paymentMethods/balance request including:
/paymentMethods/balance request
curl
Java
PHP
C#
NodeJS (JavaScript)
Go
Python
Ruby
NodeJS (TypeScript)
The response includes the balance of the gift card. /paymentMethods/balance response - If the balance amount is equal to or greater than the full payment amount, then continue to make a payment. If the balance is less than the full payment amount, make an /orders request. This lets you create partial payments: a payment with the gift card, and a payment for the remaining amount using a different payment method.
Make a payment
From your server, make a /payments request, specifying:
For some gift cards, there are regulatory limits on transaction amounts. Check with your gift card provider to learn if these limits affect you.
JSON
request
response
- pspReference: Our unique identifier for the transaction.
resultCode: Use this to present the payment result to your shopper.merchantReference: Thereferencefrom the /payments request.
Show the payment result
Use the resultCode from the /payments response to show the payment result to your shopper. You will also receive the outcome of the payment asynchronously in a webhook. For gift card payments, you can receive the followingresultCode values:
Test and go live
Before making live gift card payments, simulate transactions:-
Test your integration using our test card numbers depending on your gift card provider. When testing, you use a simulator that tries to behave and respond in the same way as an end-to-end connection.
To simulate a scenario, send one of the following amounts in the test payment request:
For example, send a payment amount with 100 as the last three digits, such as 1.00 or 11.00. This will result in an Authorised transaction.
- Check the status of test payments in your test Customer Area > Transactions > Payments.
- Onboard with a gift card provider and add the gift card variant to your live Customer Area.
- Contact our Support Team to add the gift card to your live Customer Area. You can test end-to-end scenarios in your live environment using real gift card details and small amounts.
