Payment-method icon

Gift card Component

Add gift card payments to an existing Components integration.

  Postman collection

Implementation examples
  Java Spring
  .NET
  Node.js

This page explains how to add gift cards to your existing Web Components integration.

Requirements

Requirement Description
Integration type Make sure that you have built your Components integration.
Setup steps Before you begin, in your Customer Area add each gift card variant that you want to test.

Import resources for v6

If you are using Web Components v6, import the Component that you need for gift cards:

import { AdyenCheckout, Giftcard } from '@adyen/adyen-web'

API reference

You do not need to send additional fields for gift cards. To see optional fields that you can send for all payment methods, choose the endpoint you integrated:

  • /sessions: This is the default with Components v5.0.0 or later. For partial payments, you do not implement additional API requests. You only make the /sessions request from your server, with the full amount of the purchase. The Component handles the complete partial payment flow.
  • /payments: This is for the Advanced flow. If you accept partial payments, you must implement additional API requests that are triggered by events in the Component configuration.

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

Select your integration:

(Optional) Customize logos

You can specify a custom logo for a gift card brand when creating a configuration object. This example shows a custom icon for Plastix:

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. 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:

    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.

  2. Check the status of test payments in your test Customer Area > Payments > Payment list.

When you are ready to go live:

  1. Onboard with a gift card provider and add the gift card variant to your live Customer Area.
  2. 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.

Partial payments

For the Sessions flow:

When the gift card balance or transaction limit is less than the payment amount, the shopper can pay the rest with another payment method. A partial payment with a gift card works as follows:

  1. Your server makes a /sessions request with the full amount of the purchase.
  2. The Component sets up the session.
  3. The shopper enters their gift card details, and the Component checks the gift card balance.

    If the balance and the transaction limit cover the full amount, the Component makes the payment with the gift card, and does not create an order.

  4. If the balance or the transaction limit is less than the amount, the Component creates an order for the full amount. We send you a webhook message with eventCode: ORDER_OPENED.
  5. The Component makes the first partial payment with the gift card. We send you a webhook message with eventCode: AUTHORISATION.
  6. The Component updates the amount to the remaining amount, and calls onOrderUpdated. In this event, you create Components for the payment methods that the shopper can use to pay the remaining amount.
  7. The shopper pays the remaining amount with another payment method, for example a card. Additional actions, like 3D Secure authentication or a redirect, work the same way as for any other payment. We send you a webhook message with eventCode: AUTHORISATION.
  8. When the authorized payments cover the full amount, we send you a webhook message with eventCode: ORDER_CLOSED and success: true. You can use this to fulfill the order, without waiting for the payments to be captured.
CnNlcXVlbmNlRGlhZ3JhbQogICAgcGFydGljaXBhbnQgU2VydmVyIGFzIFlvdXIgc2VydmVyCiAgICBwYXJ0aWNpcGFudCBDb21wb25lbnQgYXMgQ29tcG9uZW50cwogICAgcGFydGljaXBhbnQgQWR5ZW4KCiAgICBTZXJ2ZXItPj5BZHllbjogUE9TVCAvc2Vzc2lvbnMgd2l0aCB0aGUgZnVsbCBhbW91bnQKICAgIEFkeWVuLS0+PlNlcnZlcjogU2Vzc2lvbiBpZCBhbmQgc2Vzc2lvbkRhdGEKICAgIFNlcnZlci0+PkNvbXBvbmVudDogQ3JlYXRlIHRoZSBDb21wb25lbnQgd2l0aCB0aGUgc2Vzc2lvbgogICAgTm90ZSBvdmVyIENvbXBvbmVudCxBZHllbjogVGhlIENvbXBvbmVudHMgbWFrZSBhbGwgb2YgdGhlIGZvbGxvd2luZyByZXF1ZXN0cy4gWW91IGRvIG5vdCBtYWtlIHRoZW0uCiAgICBDb21wb25lbnQtPj5BZHllbjogL3Nlc3Npb25zL3tpZH0vc2V0dXAKICAgIEFkeWVuLS0+PkNvbXBvbmVudDogUGF5bWVudCBtZXRob2RzCiAgICBDb21wb25lbn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B3ZWJob29rLCBzdWNjZXNzIHRydWUK

If the shopper does not pay the remaining amount, the order expires. We then cancel or refund the partial payments, and we send you a webhook message with eventCode: ORDER_CLOSED and success: false.

See also