--- title: "Gift cards Android Drop-in integration" description: "Add gift cards to an existing Drop-in integration." url: "https://docs.adyen.com/payment-methods/gift-cards/android-drop-in" source_url: "https://docs.adyen.com/payment-methods/gift-cards/android-drop-in.md" canonical: "https://docs.adyen.com/payment-methods/gift-cards/android-drop-in" last_modified: "2023-01-05T16:11:00+01:00" language: "en" --- # Gift cards Android Drop-in integration Add gift cards to an existing Drop-in integration. [View source](/payment-methods/gift-cards/android-drop-in.md) **If you are using Android Drop-in v5.0.0 or later:** This payment method requires no additional configuration. Follow the [Drop-in integration guide](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Drop-in). Our [Android Drop-in](/online-payments/build-your-integration/sessions-flow?platform=Android\&integration=Drop-in) renders gift cards in your payment form, allowing the shopper to pay with their gift card. ## Requirements | Requirement | Description | | -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built an Advanced flow [Android Drop-in integration](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Drop-in). | | **Setup steps** | Before you begin, [add in your Customer Area](/payment-methods/add-payment-methods). | ## Show gift cards in your payment form Drop-in uses the `countryCode` and the `amount.currency` from your [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) request to show the available payment methods to your shopper. From your server, make a [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) request specifying: * [countryCode](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-countryCode): Countries/regions where the gift card you are using is supported. For example, **NL**. * [amount.currency](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods#request-amount-currency): Any supported currency. For example, **EUR**. ## Drop-in configuration ### Required configuration You must implement some extra methods in your Drop-in Service class to let the shopper make a [partial payment](/online-payments/partial-payments) with a gift card and pay the rest with another payment method. Configure drop-in to create an order or cancel an order. After an order is created, make partial payments from your drop-in service. To configure drop-in to create and cancel orders, implement the following methods in your DropInService: | Event name | Description | | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `checkBalance(paymentMethodData: PaymentMethodDetails)` | Called when the shopper pays with gift card. Make a [/paymentMethods/balance](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods/balance) request. | | `createOrder()` | Called when the gift card balance is less than the transaction amount. Make an [/orders](https://docs.adyen.com/api-explorer/Checkout/latest/post/orders) request with the `amount` of the total transaction amount. | | `cancelOrder(order: OrderRequest, shouldUpdatePaymentMethods: Boolean)` | Called when the shopper cancels the gift card transaction. Make an [orders/cancel](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/post/orders/cancel) request. | The following example shows how to configure Drop-in for gift cards: **Your DropInService** ```kotlin override fun checkBalance(paymentMethodData: PaymentMethodDetails) { // Make a POST /paymentMethods/balance request if (isSuccessfulResponse()) { val balanceResult = BalanceResult.SERIALIZER.deserialize(jsonResponse) val dropInServiceResult = BalanceDropInServiceResult.Balance(balanceResult) sendBalanceResult(dropInServiceResult) } else { val dropInServiceResult = BalanceDropInServiceResult.Error(...) sendBalanceResult(dropInServiceResult) } } override fun createOrder() { // Make a POST /orders request if (isSuccessfulResponse()) { val orderResponse = OrderResponse.SERIALIZER.deserialize(jsonResponse) val dropInServiceResult = OrderDropInServiceResult.OrderCreated(orderResponse) sendOrderResult(dropInServiceResult) } else { val dropInServiceResult = OrderDropInServiceResult.Error(...) sendOrderResult(dropInServiceResult) } } // Create an order for the total transaction amount override fun cancelOrder(order: OrderRequest, shouldUpdatePaymentMethods: Boolean) { val orderJson = OrderRequest.SERIALIZER.serialize(order) // Make a POST /orders/cancel request // Call the update function and pass the payment methods response to update the instance of checkout if (isSuccessfulResponse()) { if (shouldUpdatePaymentMethods) fetchAndUpdatePaymentMethods() val dropInServiceResult = DropInServiceResult.Update(paymentMethods, orderOrNull) // Update the payment methods sendResult(dropInServiceResult) // shouldUpdatePaymentMethods is true when the shopper manually removes their gift cards and cancels the order // The total reverts to the original amount and you might need to fetch your payment methods again // shouldUpdatePaymentMethods is false when Drop-in is closed while the order is in progress // If this happens, cancel the order } else { val dropInServiceResult = DropInServiceResult.Error(...) sendResult(dropInServiceResult) } } ``` ## Test and go live Before making live gift card payments, simulate transactions: 1. Test your integration using our [test card numbers](/development-resources/test-cards-and-credentials/alternative-payment-method-credentials#gift-cards) 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](https://ca-test.adyen.com/) > **Transactions** > **Payments**. When you are ready to go live: 1. Onboard with a gift card provider and add the [gift card variant](/payment-methods/gift-cards#supported-gift-cards) to your [live Customer Area](https://ca-live.adyen.com/). 2. Contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other) to add the gift card to your [live Customer Area](https://ca-live.adyen.com/). You can test end-to-end scenarios in your live environment using real gift card details and small amounts.