Are you looking for test card numbers?

Would you like to contact support?

No momento, esta página não está disponível em inglês
Payment-method icon

Gift cards Component

Add gift card payments to an existing Components integration.

On this page, you can find additional configuration for adding gift card to your Components integration.

Before you begin

This page assumes you've already:

API reference

You don't need to send additional fields for gift card. To see optional fields that you can send for all payment methods, choose the endpoint you integrated:

Component configuration

Step 1: Create a DOM element

Create a DOM element on your checkout page, placing it where you want the payment method form to be rendered:

 <div id="giftcard-container"></div>

Step 2: Create an instance of the Component


Add the following event to your gift card configuration object:

Event name Description
onBalanceCheck(resolve, reject, data) Called when the shopper pays with gift card. Make a /paymentMethods/balance request and check if the balance amount is greater than or equal to the total transaction amount.

(Optional) Accepting partial payments

If you want to accept partial payments, you can configure the gift card Component to create an order or cancel an order. After an order is created, you must make partial payments outside of the Component.
To configure the Component to create and cancel orders, add the following events to your gift card configuration object:

Event name Description
onOrderRequest(resolve, reject, data) Called when the gift card balance is less than the transaction amount. Make an /orders request with the amount of the total transaction amount.
onOrderCancel(order) Called when the shopper cancels the gift card transaction. Make an orders/cancel request.

The following example shows how to configure the gift card Component:

Gift card configuration
const giftcardConfiguration = {
    onBalanceCheck: function (resolve, reject, data) {
        // Make a POST /paymentMethods/balance request
        // Check if the balance is greater than or equal to the transaction amount
    onOrderRequest: function (resolve, reject, data) {
        // Make a POST /orders request
        // Create an order for the total transaction amount
    onOrderCancel: function(Order) {
        // Make a POST /orders/cancel request

Use the create method of your AdyenCheckout instance, in this case checkout, to create the Component. Pass the configuration object if you created one:

const giftcardComponent = checkout.create('giftcard', giftcardConfiguration);

Step 3: Mount the Component

Mount the Component only after checking that gift card is available to the shopper:

   .then(() => {
   .catch(e => {
       //gift card is not available

(Optional) Making partial payments

When balance of the shopper's gift card is less than the payment amount, no payment is made. Instead, the onOrderRequest event creates an order for the full payment amount. After the order is created, you can start making partial payments:

  1. The response to the onOrderRequest event includes the following fields that you need for payment:

    Field Description
    pspReference The unique reference for the order.
    orderData The details needed to make payments for the order.
    remainingAmount The full payment amount.
    Example order object
      "pspReference": "MLSPNCQ8HXSKGK82",
      "resultCode": "Success",
      "reference": "YOUR_ORDER_REFERENCE",
      "remainingAmount": {
        "value": 250,
        "currency": "EUR"
      "expiresAt": "2022-01-01T14:21:00",
      "orderData": "823fh892f8f18f4...148f13f9f3f"
  2. Use the values from the Component and the /payments endpoint to make partial payments and complete the order outside of the Component.

Test and go live

Before making live gift card payments, simulate transactions:

  1. Test your integration using our test card numbers depending on your gift card provider. To simulate a scenario, send one of the following amounts in the test payment request:
    Amount (last three digits) resultCode refusalReason
    100 Authorised
    123 Refused Refused
    124 Refused Not enough balance
    125 Refused Blocked Card
    126 Refused Expired Card
    130 Error Acquirer Error
    134 Refused Invalid Pin
    135 Refused Pin tries exceeded
    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.
    You can test other scenarios in your live environment using real gift card details and small amounts.
    You can check the status of test payments in your test Customer Area > Transactions > Payments.
  2. Contact our Support Team to add the gift card to your live Customer Area.

See also