{"title":"Gift cards Android Drop-in integration","category":"default","creationDate":1672931220,"content":"<div class=\"sc-notice info\"><div>\n<p><strong>If you are using Android Drop-in v5.0.0 or later:<\/strong><\/p>\n<p>This payment method requires no additional configuration.<\/p>\n<p>Follow the  <a href=\"\/pt\/online-payments\/build-your-integration\/sessions-flow?platform=Android&amp;integration=Drop-in\">Drop-in integration guide<\/a>.<\/p>\n<\/div><\/div>\n<p>Our <a href=\"\/pt\/online-payments\/build-your-integration\/sessions-flow?platform=Android&amp;integration=Drop-in\">Android Drop-in<\/a> renders gift cards in your payment form, allowing the shopper to pay with their gift card.<\/p>\n<h2>Requirements<\/h2>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Requirement<\/th>\n<th style=\"text-align: left;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><strong>Integration type<\/strong><\/td>\n<td style=\"text-align: left;\">Make sure that you have built an Advanced flow <a href=\"\/pt\/online-payments\/build-your-integration\/advanced-flow\/?platform=Android&amp;integration=Drop-in\">Android Drop-in integration<\/a>. <\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>Setup steps<\/strong><\/td>\n<td style=\"text-align: left;\">Before you begin, <a href=\"\/pt\/payment-methods\/add-payment-methods\">add  in your Customer Area<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"show-gift-cards\">Show gift cards in your payment form<\/h2>\n<p>Drop-in uses the <code>countryCode<\/code> and the <code>amount.currency<\/code> from your  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/paymentMethods<\/a> request to show the available payment methods to your shopper. From your server, make a  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/paymentMethods<\/a> request specifying:<\/p>\n<ul>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods#request-countryCode\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">countryCode<\/a>&#58; Countries\/regions where the gift card you are using is supported. For example, <span translate=\"no\"><strong>NL<\/strong><\/span>.<\/li>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods#request-amount-currency\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">amount.currency<\/a>&#58; Any supported currency. For example, <span translate=\"no\"><strong>EUR<\/strong><\/span>.<\/li>\n<\/ul>\n<h2>Drop-in configuration<\/h2>\n<h3>Required configuration<\/h3>\n<p>You must implement some extra methods in your Drop-in Service class to let the shopper make a <a href=\"\/pt\/online-payments\/partial-payments\">partial payment<\/a> 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.<\/p>\n<p>To configure drop-in to create and cancel orders, implement the following methods in your DropInService:<\/p>\n<table>\n<thead>\n<tr>\n<th>Event name<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>checkBalance(paymentMethodData: PaymentMethodDetails)<\/code><\/td>\n<td>Called when the shopper pays with gift card. Make a  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/paymentMethods\/balance\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/paymentMethods\/balance<\/a> request.<\/td>\n<\/tr>\n<tr>\n<td><code>createOrder()<\/code><\/td>\n<td>Called when the gift card balance is less than the transaction amount. Make an  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/orders\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/orders<\/a> request with the <code>amount<\/code> of the total transaction amount.<\/td>\n<\/tr>\n<tr>\n<td><code>cancelOrder(order: OrderRequest, shouldUpdatePaymentMethods: Boolean)<\/code><\/td>\n<td>Called when the shopper cancels the gift card transaction. Make an <a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/CheckoutService\/latest\/post\/orders\/cancel\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">orders\/cancel<\/a> request.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The following example shows how to configure Drop-in for gift cards:<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'Your DropInService'\" :id=\"''\" :code-data='[{\"language\":\"kotlin\",\"tabTitle\":\"\",\"content\":\"override fun checkBalance(paymentMethodData: PaymentMethodDetails) {\\n\\\/\\\/ Make a POST \\\/paymentMethods\\\/balance request\\n        if (isSuccessfulResponse()) {\\n        val balanceResult = BalanceResult.SERIALIZER.deserialize(jsonResponse)\\n        val dropInServiceResult = BalanceDropInServiceResult.Balance(balanceResult)\\n        sendBalanceResult(dropInServiceResult)\\n    } else {\\n        val dropInServiceResult = BalanceDropInServiceResult.Error(...)\\n        sendBalanceResult(dropInServiceResult)\\n    }\\n    }\\n\\noverride fun createOrder() {\\n    \\\/\\\/ Make a POST \\\/orders request\\n    if (isSuccessfulResponse()) {\\n        val orderResponse = OrderResponse.SERIALIZER.deserialize(jsonResponse)\\n        val dropInServiceResult = OrderDropInServiceResult.OrderCreated(orderResponse)\\n        sendOrderResult(dropInServiceResult)\\n    } else {\\n        val dropInServiceResult = OrderDropInServiceResult.Error(...)\\n        sendOrderResult(dropInServiceResult)\\n    }\\n}\\n    \\\/\\\/ Create an order for the total transaction amount\\n\\noverride fun cancelOrder(order: OrderRequest, shouldUpdatePaymentMethods: Boolean) {\\n    val orderJson = OrderRequest.SERIALIZER.serialize(order)\\n    \\\/\\\/ Make a POST \\\/orders\\\/cancel request\\n    \\\/\\\/ Call the update function and pass the payment methods response to update the instance of checkout\\n    if (isSuccessfulResponse()) {\\n\\n        if (shouldUpdatePaymentMethods) fetchAndUpdatePaymentMethods()\\n        val dropInServiceResult = DropInServiceResult.Update(paymentMethods, orderOrNull) \\\/\\\/ Update the payment methods\\n        sendResult(dropInServiceResult)\\n        \\\/\\\/ shouldUpdatePaymentMethods is true when the shopper manually removes their gift cards and cancels the order\\n        \\\/\\\/ The total reverts to the original amount and you might need to fetch your payment methods again\\n        \\\/\\\/ shouldUpdatePaymentMethods is false when Drop-in is closed while the order is in progress\\n        \\\/\\\/ If this happens, cancel the order\\n        } else {\\n        val dropInServiceResult = DropInServiceResult.Error(...)\\n        sendResult(dropInServiceResult)\\n    }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h2 id=\"test-and-go-live\">Test and go live<\/h2>\n<p>Before making live gift card payments, simulate transactions:<\/p>\n<ol>\n<li>\n<p>Test your integration using our <a href=\"\/pt\/development-resources\/test-cards-and-credentials\/alternative-payment-method-credentials#gift-cards\">test card numbers<\/a> 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.<\/p>\n<p>To simulate a scenario, send one of the following amounts in the test payment request:<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Amount (last three digits)<\/th>\n<th style=\"text-align: left;\"><code>resultCode<\/code><\/th>\n<th style=\"text-align: left;\"><code>refusalReason<\/code><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">100<\/td>\n<td style=\"text-align: left;\">Authorised<\/td>\n<td style=\"text-align: left;\"><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">123<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">124<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<td style=\"text-align: left;\">Not enough balance<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">125<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<td style=\"text-align: left;\">Blocked Card<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">126<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<td style=\"text-align: left;\">Expired Card<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">130<\/td>\n<td style=\"text-align: left;\">Error<\/td>\n<td style=\"text-align: left;\">Acquirer Error<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">134<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<td style=\"text-align: left;\">Invalid Pin<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">135<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<td style=\"text-align: left;\">Pin tries exceeded<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<!--list separator-->\n<p>For example, send a payment amount with <strong>100<\/strong> as the last three digits, such as 1.00 or 11.00. This will result in an <strong>Authorised<\/strong> transaction.<\/p>\n<\/li>\n<li>\n<p>Check the status of test payments in your <a href=\"https:\/\/ca-test.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">test Customer Area<\/a>\u00a0&gt;\u00a0<strong>Transactions<\/strong>\u00a0&gt;\u00a0<strong>Payments<\/strong>.<\/p>\n<\/li>\n<\/ol>\n<p>When you are ready to go live:<\/p>\n<ol>\n<li>Onboard with a gift card provider and add the <a href=\"\/pt\/payment-methods\/gift-cards#supported-gift-cards\">gift card variant<\/a> to your <a href=\"https:\/\/ca-live.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">live Customer Area<\/a>.<\/li>\n<li>\n<p>Contact our <a href=\"https:\/\/ca-test.adyen.com\/ca\/ca\/contactUs\/support.shtml?form=other\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Support Team<\/a> to add the gift card to your <a href=\"https:\/\/ca-live.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">live Customer Area<\/a>.<\/p>\n<p><div class=\"sc-notice info\"><div>You can test end-to-end scenarios in your live environment using real gift card details and small amounts.<\/div><\/div><\/p>\n<\/li>\n<\/ol>","url":"https:\/\/docs.adyen.com\/pt\/payment-methods\/gift-cards\/android-drop-in","articleFields":{"description":"Add gift cards to an existing Drop-in integration.","feedback_component":true,"parameters":{"payment_method_type":null,"integration":"Drop-in","platform":"Android"},"last_edit_on":"05-01-2023 16:11"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/payment-methods\/gift-cards\/android-drop-in","title":"Gift cards Android Drop-in integration","content":"\nIf you are using Android Drop-in v5.0.0 or later:\nThis payment method requires no additional configuration.\nFollow the  Drop-in integration guide.\n\nOur Android Drop-in renders gift cards in your payment form, allowing the shopper to pay with their gift card.\nRequirements\n\n\n\nRequirement\nDescription\n\n\n\n\nIntegration type\nMake sure that you have built an Advanced flow Android Drop-in integration. \n\n\nSetup steps\nBefore you begin, add  in your Customer Area.\n\n\n\nShow gift cards in your payment form\nDrop-in uses the countryCode and the amount.currency from your  \/paymentMethods request to show the available payment methods to your shopper. From your server, make a  \/paymentMethods request specifying:\n\n countryCode&#58; Countries\/regions where the gift card you are using is supported. For example, NL.\n amount.currency&#58; Any supported currency. For example, EUR.\n\nDrop-in configuration\nRequired configuration\nYou must implement some extra methods in your Drop-in Service class to let the shopper make a partial payment 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.\nTo configure drop-in to create and cancel orders, implement the following methods in your DropInService:\n\n\n\nEvent name\nDescription\n\n\n\n\ncheckBalance(paymentMethodData: PaymentMethodDetails)\nCalled when the shopper pays with gift card. Make a  \/paymentMethods\/balance request.\n\n\ncreateOrder()\nCalled when the gift card balance is less than the transaction amount. Make an  \/orders request with the amount of the total transaction amount.\n\n\ncancelOrder(order: OrderRequest, shouldUpdatePaymentMethods: Boolean)\nCalled when the shopper cancels the gift card transaction. Make an orders\/cancel request.\n\n\n\nThe following example shows how to configure Drop-in for gift cards:\n\n    \n\nTest and go live\nBefore making live gift card payments, simulate transactions:\n\n\nTest 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.\nTo simulate a scenario, send one of the following amounts in the test payment request:\n\n\n\nAmount (last three digits)\nresultCode\nrefusalReason\n\n\n\n\n100\nAuthorised\n\n\n\n123\nRefused\nRefused\n\n\n124\nRefused\nNot enough balance\n\n\n125\nRefused\nBlocked Card\n\n\n126\nRefused\nExpired Card\n\n\n130\nError\nAcquirer Error\n\n\n134\nRefused\nInvalid Pin\n\n\n135\nRefused\nPin tries exceeded\n\n\n\n\nFor 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.\n\n\nCheck the status of test payments in your test Customer Area\u00a0&gt;\u00a0Transactions\u00a0&gt;\u00a0Payments.\n\n\nWhen you are ready to go live:\n\nOnboard with a gift card provider and add the gift card variant to your live Customer Area.\n\nContact our Support Team to add the gift card to your live Customer Area.\nYou can test end-to-end scenarios in your live environment using real gift card details and small amounts.\n\n","type":"page","locale":"pt","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Payment methods","lvl2":"Gift cards","lvl3":"Gift cards Android Drop-in integration"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/payment-methods","lvl2":"https:\/\/docs.adyen.com\/pt\/payment-methods\/gift-cards","lvl3":"\/pt\/payment-methods\/gift-cards\/android-drop-in"},"levels":4,"category":"Payment method","category_color":"green","tags":["cards","Android","Drop-in","integration"]}}
