{"title":"Auto Rescue for card payments","category":"default","creationDate":1776961627,"content":"<p>On this page, you will learn how to:<\/p>\n<ol>\n<li><a href=\"#step-1-enable-auto-rescue\">Enable Auto Rescue<\/a> for card payments.<\/li>\n<li><a href=\"#step-2-receive-auto-rescue-updates\">Receive updates on the Auto Rescue process<\/a>.<\/li>\n<\/ol>\n<p>We also explain how you can:<\/p>\n<ul>\n<li><a href=\"#send-a-payment-link\">Send a payment link<\/a> when the Auto Rescue process ends unsuccessfully.<\/li>\n<li><a href=\"#cancel-auto-rescue-process\">Cancel the Auto Rescue process<\/a> for a payment.<\/li>\n<li><a href=\"#test-auto-rescue\">Test how your integration handles Auto Rescue updates<\/a>.<\/li>\n<li><a href=\"#auto-rescue-reports\">Reconcile retry attempts in Adyen-generated reports<\/a>.<\/li>\n<\/ul>\n<h2>How it works<\/h2>\n<p><img alt=\"\" src=\"\/user\/pages\/docs\/02.online-payments\/23.auto-rescue\/01.cards\/autorescue-cards.svg?decoding=auto&amp;fetchpriority=auto\" \/><\/p>\n<h2 id=\"step-1-enable-auto-rescue\">Step 1: Enable Auto Rescue<\/h2>\n<p>You can enable Auto Rescue at either:<\/p>\n<ul>\n<li><a href=\"#enable-at-account-level\">Account level<\/a>: Auto Rescue is used on all eligible payments.<\/li>\n<li><a href=\"#enable-at-transaction-level\">Transaction level<\/a>: You choose when Auto Rescue can be used for a payment, using the <code>autoRescue<\/code> flag.<\/li>\n<\/ul>\n<h3>Enable at account level<\/h3>\n<p>To enable Auto Rescue for all payments, 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> or your Adyen Account Manager.<\/p>\n<p>When enabled, Auto Rescue works for payments that have:<\/p>\n<ul>\n<li>The <code>shopperInteraction<\/code> <strong>ContAuth<\/strong>.<\/li>\n<li>A <code>value<\/code> greater than <strong>0<\/strong>.<\/li>\n<\/ul>\n<div class=\"notices blue\">\n<p>If you enable Auto Rescue at account level, a rescue window of one calendar month is used. If you prefer to use another rescue window you need to <a href=\"#enable-at-transaction-level\">enable Auto Rescue at the transaction level<\/a>.<\/p>\n<\/div>\n<p>You <a href=\"#step-2-receive-auto-rescue-updates\">receive updates to the Auto Rescue process<\/a> in webhook events.<\/p>\n<h3>Enable at transaction level<\/h3>\n<p>To enable Auto Rescue on a transaction level, you need to:<\/p>\n<ol>\n<li>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> or your Adyen Account Manager to configure this for you.<\/li>\n<li>Add the <code>autoRescue<\/code> flag to your payment request to enable Auto Rescue for that transaction.<\/li>\n<li>In the payment request, provide a unique <code>merchantOrderReference<\/code>. This should represent a specific billing cycle or subscription, and will appear in any <a href=\"#step-2-receive-auto-rescue-updates\">Auto Rescue updates<\/a> or <a href=\"#auto-rescue-reports\">reports<\/a>.<\/li>\n<\/ol>\n<div class=\"notices green\">\n<p>With <code>merchantOrderReference<\/code> you can connect any Auto Rescue retry attempts to a payment request.<\/p>\n<\/div>\n<p>To enable Auto Rescue for a transaction:<\/p>\n<ol>\n<li>\n<p>Make a payment request, and additionally specify:<\/p>\n<ul>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-shopperInteraction\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">shopperInteraction<\/a>&#58; <strong>ContAuth<\/strong><\/li>\n<li><code>autoRescue<\/code>:\u00a0<strong>true<\/strong><\/li>\n<li><code>maxDaysToRescue<\/code>: The rescue window, in days. You can specify between\u00a0<strong>1<\/strong>\u00a0and\u00a0<strong>48<\/strong> days. We recommend using a rescue window of one calendar month (<strong>30<\/strong> days).<\/li>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-reference\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">reference<\/a>&#58; Your unique reference for this\u00a0payment request.<\/li>\n<li> <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments#request-merchantOrderReference\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">merchantOrderReference<\/a>&#58; Your unique order reference. For example, a concatenation of a unique shopper reference and the transaction date.<\/li>\n<\/ul>\n<p>The example below shows how to enable Auto Rescue for a shopper-not-present payment submitted to the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> endpoint. If this payment is <strong>Refused<\/strong>, Auto Rescue will automatically retry this payment for a maximum of <strong>40<\/strong> days.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Enable Auto Rescue in a payments request'\" :id=\"'enable-auto-rescue-in-a-payments-request-8007607543'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;curl&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/checkout-test.adyen.com\\\/v68\\\/payments \\\\\\n-H 'x-api-key: ADYEN_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n \\&quot;paymentMethod\\&quot;:{\\n    \\&quot;type\\&quot;:\\&quot;scheme\\&quot;,\\n    \\&quot;storedPaymentMethodId\\&quot;:\\&quot;7218395820498475\\&quot;\\n },\\n \\&quot;amount\\&quot;:{\\n    \\&quot;currency\\&quot;:\\&quot;USD\\&quot;,\\n    \\&quot;value\\&quot;:1000\\n },\\n \\&quot;returnUrl\\&quot;:\\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;,\\n \\&quot;merchantAccount\\&quot;:\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n \\&quot;recurringProcessingModel\\&quot;:\\&quot;Subscription\\&quot;,\\n \\&quot;shopperInteraction\\&quot;:\\&quot;ContAuth\\&quot;,\\n \\&quot;reference\\&quot;:\\&quot;Trans987654321\\&quot;,\\n   \\&quot;shopperReference\\&quot;:\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n \\&quot;merchantOrderReference\\&quot;:\\&quot;Cust12345_Nov19\\&quot;,\\n \\&quot;additionalData\\&quot;:{\\n    \\&quot;autoRescue\\&quot;:\\&quot;true\\&quot;,\\n    \\&quot;maxDaysToRescue\\&quot;:\\&quot;40\\&quot;\\n }\\n}'&quot;},{&quot;language&quot;:&quot;java&quot;,&quot;tabTitle&quot;:&quot;Java&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Java API Library v25.0.0\\nimport com.adyen.Client;\\nimport com.adyen.enums.Environment;\\nimport com.adyen.model.checkout.*;\\nimport java.time.OffsetDateTime;\\nimport java.util.*;\\nimport com.adyen.model.RequestOptions;\\nimport com.adyen.service.checkout.*;\\n\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nClient client = new Client(\\&quot;ADYEN_API_KEY\\&quot;, Environment.TEST);\\n\\n\\\/\\\/ Create the request object(s)\\nAmount amount = new Amount()\\n  .currency(\\&quot;USD\\&quot;)\\n  .value(1000L);\\n\\nCardDetails cardDetails = new CardDetails()\\n  .storedPaymentMethodId(\\&quot;7218395820498475\\&quot;)\\n  .type(CardDetails.TypeEnum.SCHEME);\\n\\nPaymentRequest paymentRequest = new PaymentRequest()\\n  .reference(\\&quot;Trans987654321\\&quot;)\\n  .merchantOrderReference(\\&quot;Cust12345_Nov19\\&quot;)\\n  .amount(amount)\\n  .merchantAccount(\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;)\\n  .recurringProcessingModel(PaymentRequest.RecurringProcessingModelEnum.SUBSCRIPTION)\\n  .paymentMethod(new CheckoutPaymentMethod(cardDetails))\\n  .shopperInteraction(PaymentRequest.ShopperInteractionEnum.CONTAUTH)\\n  .additionalData(new HashMap&lt;String, String&gt;(Map.of(\\n    \\&quot;autoRescue\\&quot;, \\&quot;true\\&quot;,\\n    \\&quot;maxDaysToRescue\\&quot;, \\&quot;40\\&quot;\\n  )))\\n  .returnUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;)\\n  .shopperReference(\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;);\\n\\n\\\/\\\/ Make the API call\\nPaymentsApi service = new PaymentsApi(client);\\nPaymentResponse response = service.payments(paymentRequest, new RequestOptions().idempotencyKey(\\&quot;UUID\\&quot;));&quot;},{&quot;language&quot;:&quot;php&quot;,&quot;tabTitle&quot;:&quot;PHP&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen PHP API Library v17.4.0\\nuse Adyen\\\\Client;\\nuse Adyen\\\\Environment;\\nuse Adyen\\\\Model\\\\Checkout\\\\Amount;\\nuse Adyen\\\\Model\\\\Checkout\\\\CheckoutPaymentMethod;\\nuse Adyen\\\\Model\\\\Checkout\\\\PaymentRequest;\\nuse Adyen\\\\Service\\\\Checkout\\\\PaymentsApi;\\n\\n$client = new Client();\\n$client-&gt;setXApiKey(\\&quot;ADYEN_API_KEY\\&quot;);\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\n$client-&gt;setEnvironment(Environment::TEST);\\n\\n\\n\\\/\\\/ Create the request object(s)\\n$amount = new Amount();\\n$amount\\n  -&gt;setCurrency(\\&quot;USD\\&quot;)\\n  -&gt;setValue(1000);\\n\\n$checkoutPaymentMethod = new CheckoutPaymentMethod();\\n$checkoutPaymentMethod\\n  -&gt;setStoredPaymentMethodId(\\&quot;7218395820498475\\&quot;)\\n  -&gt;setType(\\&quot;scheme\\&quot;);\\n\\n$paymentRequest = new PaymentRequest();\\n$paymentRequest\\n  -&gt;setReference(\\&quot;Trans987654321\\&quot;)\\n  -&gt;setMerchantOrderReference(\\&quot;Cust12345_Nov19\\&quot;)\\n  -&gt;setAmount($amount)\\n  -&gt;setMerchantAccount(\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;)\\n  -&gt;setRecurringProcessingModel(\\&quot;Subscription\\&quot;)\\n  -&gt;setPaymentMethod($checkoutPaymentMethod)\\n  -&gt;setShopperInteraction(\\&quot;ContAuth\\&quot;)\\n  -&gt;setAdditionalData(\\n    array(\\n      \\&quot;autoRescue\\&quot; =&gt; \\&quot;true\\&quot;,\\n      \\&quot;maxDaysToRescue\\&quot; =&gt; \\&quot;40\\&quot;\\n    )\\n  )\\n  -&gt;setReturnUrl(\\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;)\\n  -&gt;setShopperReference(\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;);\\n\\n$requestOptions['idempotencyKey'] = 'UUID';\\n\\n\\\/\\\/ Make the API call\\n$service = new PaymentsApi($client);\\n$response = $service-&gt;payments($paymentRequest, $requestOptions);&quot;},{&quot;language&quot;:&quot;cs&quot;,&quot;tabTitle&quot;:&quot;C#&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen .net API Library v14.4.0\\nusing Adyen;\\nusing Environment = Adyen.Model.Environment;\\nusing Adyen.Model;\\nusing Adyen.Model.Checkout;\\nusing Adyen.Service.Checkout;\\n\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nvar config = new Config()\\n{\\n    XApiKey = \\&quot;ADYEN_API_KEY\\&quot;,\\n    Environment = Environment.Test\\n};\\nvar client = new Client(config);\\n\\n\\\/\\\/ Create the request object(s)\\nAmount amount = new Amount\\n{\\n  Currency = \\&quot;USD\\&quot;,\\n  Value = 1000\\n};\\n\\nCardDetails cardDetails = new CardDetails\\n{\\n  StoredPaymentMethodId = \\&quot;7218395820498475\\&quot;,\\n  Type = CardDetails.TypeEnum.Scheme\\n};\\n\\nPaymentRequest paymentRequest = new PaymentRequest\\n{\\n  Reference = \\&quot;Trans987654321\\&quot;,\\n  MerchantOrderReference = \\&quot;Cust12345_Nov19\\&quot;,\\n  Amount = amount,\\n  MerchantAccount = \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  RecurringProcessingModel = PaymentRequest.RecurringProcessingModelEnum.Subscription,\\n  PaymentMethod = new CheckoutPaymentMethod(cardDetails),\\n  ShopperInteraction = PaymentRequest.ShopperInteractionEnum.ContAuth,\\n  AdditionalData = new Dictionary&lt;string, string&gt;\\n  {\\n\\n    { \\&quot;autoRescue\\&quot;, \\&quot;true\\&quot; },\\n    { \\&quot;maxDaysToRescue\\&quot;, \\&quot;40\\&quot; }\\n  },\\n  ReturnUrl = \\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;,\\n  ShopperReference = \\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;\\n};\\n\\n\\\/\\\/ Make the API call\\nvar service = new PaymentsService(client);\\nvar response = service.Payments(paymentRequest, requestOptions: new RequestOptions { IdempotencyKey = \\&quot;UUID\\&quot;});&quot;},{&quot;language&quot;:&quot;js&quot;,&quot;tabTitle&quot;:&quot;NodeJS (JavaScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v16.2.0\\n\\\/\\\/ Require the parts of the module you want to use\\nconst { Client, CheckoutAPI } = require('@adyen\\\/api-library');\\n\\\/\\\/ Initialize the client object\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Create the request object(s)\\nconst paymentRequest = {\\n  paymentMethod: {\\n    type: \\&quot;scheme\\&quot;,\\n    storedPaymentMethodId: \\&quot;7218395820498475\\&quot;\\n  },\\n  amount: {\\n    currency: \\&quot;USD\\&quot;,\\n    value: 1000\\n  },\\n  returnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;,\\n  merchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  recurringProcessingModel: \\&quot;Subscription\\&quot;,\\n  shopperInteraction: \\&quot;ContAuth\\&quot;,\\n  reference: \\&quot;Trans987654321\\&quot;,\\n  shopperReference: \\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n  merchantOrderReference: \\&quot;Cust12345_Nov19\\&quot;,\\n  additionalData: {\\n    autoRescue: \\&quot;true\\&quot;,\\n    maxDaysToRescue: \\&quot;40\\&quot;\\n  }\\n}\\n\\n\\\/\\\/ Make the API call\\nconst checkoutAPI = new CheckoutAPI(client);\\nconst response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: \\&quot;UUID\\&quot; });&quot;},{&quot;language&quot;:&quot;go&quot;,&quot;tabTitle&quot;:&quot;Go&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Go API Library v9.3.0\\nimport (\\n  \\&quot;context\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/common\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/adyen\\&quot;\\n  \\&quot;github.com\\\/adyen\\\/adyen-go-api-library\\\/v9\\\/src\\\/checkout\\&quot;\\n)\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nclient := adyen.NewClient(&amp;common.Config{\\n  ApiKey:      \\&quot;ADYEN_API_KEY\\&quot;,\\n  Environment: common.TestEnv,\\n})\\n\\n\\\/\\\/ Create the request object(s)\\namount := checkout.Amount{\\n  Currency: \\&quot;USD\\&quot;,\\n  Value: 1000,\\n}\\n\\ncardDetails := checkout.CardDetails{\\n  StoredPaymentMethodId: common.PtrString(\\&quot;7218395820498475\\&quot;),\\n  Type: common.PtrString(\\&quot;scheme\\&quot;),\\n}\\n\\npaymentRequest := checkout.PaymentRequest{\\n  Reference: \\&quot;Trans987654321\\&quot;,\\n  MerchantOrderReference: common.PtrString(\\&quot;Cust12345_Nov19\\&quot;),\\n  Amount: amount,\\n  MerchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  RecurringProcessingModel: common.PtrString(\\&quot;Subscription\\&quot;),\\n  PaymentMethod: checkout.CardDetailsAsCheckoutPaymentMethod(&amp;cardDetails),\\n  ShopperInteraction: common.PtrString(\\&quot;ContAuth\\&quot;),\\n  AdditionalData: &amp;map[string]string{\\n    \\&quot;autoRescue\\&quot;: \\&quot;true\\&quot;,\\n    \\&quot;maxDaysToRescue\\&quot;: \\&quot;40\\&quot;,\\n  },\\n  ReturnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;,\\n  ShopperReference: common.PtrString(\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;),\\n}\\n\\n\\\/\\\/ Make the API call\\nservice := client.Checkout()\\nreq := service.PaymentsApi.PaymentsInput().IdempotencyKey(\\&quot;UUID\\&quot;).PaymentRequest(paymentRequest)\\nres, httpRes, err := service.PaymentsApi.Payments(context.Background(), req)&quot;},{&quot;language&quot;:&quot;py&quot;,&quot;tabTitle&quot;:&quot;Python&quot;,&quot;content&quot;:&quot;# Adyen Python API Library v12.2.0\\nimport Adyen\\n\\nadyen = Adyen.Adyen()\\nadyen.client.xapikey = \\&quot;ADYEN_API_KEY\\&quot;\\n# For the live environment, additionally include your liveEndpointUrlPrefix.\\nadyen.client.platform = \\&quot;test\\&quot; # The environment to use library in.\\n\\n# Create the request object(s)\\njson_request = {\\n  \\&quot;paymentMethod\\&quot;: {\\n    \\&quot;type\\&quot;: \\&quot;scheme\\&quot;,\\n    \\&quot;storedPaymentMethodId\\&quot;: \\&quot;7218395820498475\\&quot;\\n  },\\n  \\&quot;amount\\&quot;: {\\n    \\&quot;currency\\&quot;: \\&quot;USD\\&quot;,\\n    \\&quot;value\\&quot;: 1000\\n  },\\n  \\&quot;returnUrl\\&quot;: \\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;,\\n  \\&quot;merchantAccount\\&quot;: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  \\&quot;recurringProcessingModel\\&quot;: \\&quot;Subscription\\&quot;,\\n  \\&quot;shopperInteraction\\&quot;: \\&quot;ContAuth\\&quot;,\\n  \\&quot;reference\\&quot;: \\&quot;Trans987654321\\&quot;,\\n  \\&quot;shopperReference\\&quot;: \\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n  \\&quot;merchantOrderReference\\&quot;: \\&quot;Cust12345_Nov19\\&quot;,\\n  \\&quot;additionalData\\&quot;: {\\n    \\&quot;autoRescue\\&quot;: \\&quot;True\\&quot;,\\n    \\&quot;maxDaysToRescue\\&quot;: \\&quot;40\\&quot;\\n  }\\n}\\n\\n# Make the API call\\nresult = adyen.checkout.payments_api.payments(request=json_request, idempotency_key=\\&quot;UUID\\&quot;)&quot;},{&quot;language&quot;:&quot;rb&quot;,&quot;tabTitle&quot;:&quot;Ruby&quot;,&quot;content&quot;:&quot;# Adyen Ruby API Library v9.3.0\\nrequire \\&quot;adyen-ruby-api-library\\&quot;\\n\\nadyen = Adyen::Client.new\\nadyen.api_key = 'ADYEN_API_KEY'\\n# For the live environment, additionally include your liveEndpointUrlPrefix.\\nadyen.env = :test # Set to \\&quot;live\\&quot; for live environment\\n\\n# Create the request object(s)\\nrequest_body = {\\n  :paymentMethod =&gt; {\\n    :type =&gt; 'scheme',\\n    :storedPaymentMethodId =&gt; '7218395820498475'\\n  },\\n  :amount =&gt; {\\n    :currency =&gt; 'USD',\\n    :value =&gt; 1000\\n  },\\n  :returnUrl =&gt; 'https:\\\/\\\/your-company.example.com\\\/...',\\n  :merchantAccount =&gt; 'YOUR_MERCHANT_ACCOUNT',\\n  :recurringProcessingModel =&gt; 'Subscription',\\n  :shopperInteraction =&gt; 'ContAuth',\\n  :reference =&gt; 'Trans987654321',\\n  :shopperReference =&gt; 'YOUR_UNIQUE_SHOPPER_ID',\\n  :merchantOrderReference =&gt; 'Cust12345_Nov19',\\n  :additionalData =&gt; {\\n    :autoRescue =&gt; 'true',\\n    :maxDaysToRescue =&gt; '40'\\n  }\\n}\\n\\n# Make the API call\\nresult = adyen.checkout.payments_api.payments(request_body, headers: { 'Idempotency-Key' =&gt; 'UUID' })&quot;},{&quot;language&quot;:&quot;ts&quot;,&quot;tabTitle&quot;:&quot;NodeJS (TypeScript)&quot;,&quot;content&quot;:&quot;\\\/\\\/ Adyen Node API Library v16.2.0\\n\\\/\\\/ Require the parts of the module you want to use\\nimport { Client, CheckoutAPI, Types } from \\&quot;@adyen\\\/api-library\\&quot;;\\n\\\/\\\/ Initialize the client object\\n\\\/\\\/ For the live environment, additionally include your liveEndpointUrlPrefix.\\nconst client = new Client({apiKey: \\&quot;ADYEN_API_KEY\\&quot;, environment: \\&quot;TEST\\&quot;});\\n\\n\\\/\\\/ Create the request object(s)\\nconst amount: Types.checkout.Amount = {\\n  currency: \\&quot;USD\\&quot;,\\n  value: 1000\\n};\\n\\nconst cardDetails: Types.checkout.CardDetails = {\\n  storedPaymentMethodId: \\&quot;7218395820498475\\&quot;,\\n  type: Types.checkout.CardDetails.TypeEnum.Scheme\\n};\\n\\nconst paymentRequest: Types.checkout.PaymentRequest = {\\n  reference: \\&quot;Trans987654321\\&quot;,\\n  merchantOrderReference: \\&quot;Cust12345_Nov19\\&quot;,\\n  amount: amount,\\n  merchantAccount: \\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n  recurringProcessingModel: Types.checkout.PaymentRequest.RecurringProcessingModelEnum.Subscription,\\n  paymentMethod: cardDetails,\\n  shopperInteraction: Types.checkout.PaymentRequest.ShopperInteractionEnum.ContAuth,\\n  additionalData: {\\n    \\&quot;autoRescue\\&quot;: \\&quot;true\\&quot;,\\n    \\&quot;maxDaysToRescue\\&quot;: \\&quot;40\\&quot;\\n  },\\n  returnUrl: \\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;,\\n  shopperReference: \\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;\\n};\\n\\n\\\/\\\/ Make the API call\\nconst checkoutAPI = new CheckoutAPI(client);\\nconst response = checkoutAPI.PaymentsApi.payments(paymentRequest, { idempotencyKey: \\&quot;UUID\\&quot; });&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<p><a id=\"payment-response\"><\/a><\/p>\n<ol start=\"2\">\n<li>\n<p>You receive a payment response. If the payment is refused, this contains:<\/p>\n<ul>\n<li>\n<p><code>resultCode<\/code>:\u00a0<strong>Refused<\/strong><\/p>\n<\/li>\n<li>\n<p><code>refusalReason<\/code>: The reason the payment was refused. For more information, see <a href=\"\/pt\/development-resources\/refusal-reasons\">Refusal reasons<\/a>.<\/p>\n<\/li>\n<li>\n<p><code>retry.rescueScheduled<\/code>:\u00a0Indicates whether Auto Rescue will try to rescue the payment:<\/p>\n<ul>\n<li><strong>true<\/strong>: Auto Rescue <em>will<\/em> try to rescue the payment. You receive <a href=\"#step-2-receive-auto-rescue-updates\">updates on the rescue process<\/a> in webhook events.<\/li>\n<li><strong>false<\/strong>: Auto Rescue <em>will not<\/em> try to rescue the payment. This happens when a payment cannot be rescued. For example, because of account closure or fraud.<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><code>retry.rescueReference<\/code>: Unique Auto Rescue reference for this payment.<br \/>\nYou can use this to <a href=\"#cancel-auto-rescue-process\">cancel the Auto Rescue process<\/a> if, for example, the shopper provides you with a new payment details, or cancels their subscription.<\/p>\n<\/li>\n<\/ul>\n<p>The example response below is for a payment that was <strong>Refused<\/strong>. In this response, <code>retry.rescueScheduled<\/code> is set to <strong>true<\/strong>, indicating that Auto Rescue <em>will<\/em> attempt to rescue this payment.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Response'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"\\t{\\n\\t\\t\\\"pspReference\\\":\\\"HWL5D5BDLSGLNK82\\\",\\n\\t\\t\\\"resultCode\\\":\\\"Refused\\\",\\n\\t\\t\\\"refusalReason\\\":\\\"NOT_ENOUGH_BALANCE\\\",\\n\\t\\t\\\"additionalData\\\":{\\n\\t \\t\\t\\\"retry.rescueScheduled\\\":\\\"true\\\",\\n\\t\\t\\t\\\"retry.rescueReference\\\":\\\"865497581465325B\\\"\\n\\t\\t}\\n\\t}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<p>You <a href=\"#step-2-receive-auto-rescue-updates\">receive updates to the Auto Rescue process<\/a> in webhook events.<\/p>\n<h2 id=\"step-2-receive-auto-rescue-updates\">Step 2: Receive Auto Rescue updates<\/h2>\n<p>To update you on the Auto Rescue process, we send you <a href=\"\/pt\/development-resources\/webhooks\">webhook events<\/a>. We send you a webhook event when:<\/p>\n<ul>\n<li>A retry attempt was made, and it was:\n<ul>\n<li><a href=\"#retry-attempt-successful\">Successful<\/a>.<\/li>\n<li><a href=\"#retry-attempt-unsuccessful\">Unsuccessful<\/a>.<\/li>\n<\/ul><\/li>\n<li>The <a href=\"#rescue-process-ended\">rescue process ended<\/a>, either because the payment was rescued, or the Auto Rescue process was unsuccessful.<\/li>\n<\/ul>\n<div class=\"notices blue\">\n<p>Before using Auto Rescue for live payments, we recommend that you <a href=\"#test-auto-rescue\">test how your integration handles these webhook events<\/a>.<\/p>\n<\/div>\n<h3>Retry attempt successful<\/h3>\n<p>If a retry attempt is successful, you receive a webhook event with:<\/p>\n<ul>\n<li><code>eventCode<\/code>: <strong>AUTHORISATION<\/strong><\/li>\n<li><code>eventDate<\/code>: The date of the retry attempt.<\/li>\n<li><code>success<\/code>: <strong>true<\/strong><\/li>\n<li><code>pspReference<\/code>: Adyen's unique reference for the successful retry attempt.<\/li>\n<li><code>merchantOrderReference<\/code>: Unique order reference that you provided in the <a href=\"#enable-at-transaction-level\">payment request<\/a>.<\/li>\n<\/ul>\n<p>The example below is for a retry attempt that was successful.<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'AUTHORISATION webhook for a successful retry'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n   \\\"live\\\":\\\"false\\\",\\n   \\\"notificationItems\\\":[\\n      {\\n         \\\"NotificationRequestItem\\\":{\\n            \\\"additionalData\\\":{\\n               \\\"retry.rescueScheduled\\\":\\\"false\\\",\\n               \\\"retry.rescueReference\\\":\\\"88HH88HH88HH88HH\\\",\\n               \\\"retry.orderAttemptNumber\\\":3,\\n               \\\"merchantOrderReference\\\":\\\"Cust12345_Nov19\\\",\\n               ...\\n            },\\n            \\\"pspReference\\\":\\\"PPKFQ89R6QRXGN82\\\",\\n            \\\"eventCode\\\":\\\"AUTHORISATION\\\",\\n            \\\"eventDate\\\":\\\"2019-11-12T12:00:01+01:00\\\",\\n            \\\"reason\\\": \\\"035450:2909:10\\\/2020\\\",\\n            \\\"success\\\":\\\"true\\\",\\n            ...\\n         }\\n      }\\n   ]\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>You can view how much revenue has been recovered with Auto Rescue in your <a href=\"https:\/\/ca-live.adyen.com\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">Customer Area<\/a>, under <strong>Reports<\/strong>. Search for the <strong>RevenueAccelerate<\/strong> report.<\/p>\n<div class=\"notices yellow\">\n<p>If you use manual capture, you need to <a href=\"\/pt\/online-payments\/capture#manual-capture\">capture<\/a> each rescued payment to transfer it to your account.<\/p>\n<\/div>\n<h3>Retry attempt unsuccessful<\/h3>\n<p>If a retry attempt is unsuccessful, you receive a webhook event with:<\/p>\n<ul>\n<li><code>eventCode<\/code>:\u00a0<strong>AUTHORISATION<\/strong><\/li>\n<li><code>eventDate<\/code>: The date of the retry attempt.<\/li>\n<li><code>success<\/code>: <strong>false<\/strong><\/li>\n<li><code>merchantOrderReference<\/code>:\u00a0Unique order reference that you provided in the <a href=\"#enable-at-transaction-level\">payment request<\/a>.<\/li>\n<li><code>retry.rescueScheduled<\/code>: Indicates whether Auto Rescue will attempt the payment again:\n<ul>\n<li><strong>true<\/strong>:\u00a0Another retry attempt has been scheduled.\u00a0<\/li>\n<li><strong>false<\/strong>: We are <a href=\"#rescue-process-ended\">unable to schedule another retry attempt<\/a>.<br \/>\nThis usually happens when you have reached the maximum number of retries.<\/li>\n<\/ul><\/li>\n<\/ul>\n<p>The example below is for a retry attempt that was unsuccessful (<code>success<\/code> is <strong>false<\/strong>). Another retry attempt has been scheduled (<code>retry.rescueScheduled<\/code> is <strong>true<\/strong>).<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'AUTHORISATION webhook an unsuccessful retry attempt'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n   \\\"live\\\":\\\"false\\\",\\n   \\\"notificationItems\\\": [\\n      {\\n         \\\"NotificationRequestItem\\\":{\\n            \\\"additionalData\\\":{\\n               \\\"retry.rescueScheduled\\\":\\\"true\\\",\\n               \\\"retry.rescueReference\\\": \\\"88HH88HH88HH88HH\\\",\\n               \\\"retry.orderAttemptNumber\\\": 1,\\n               \\\"merchantOrderReference\\\":\\\"Cust12345_Nov19\\\",\\n               ...\\n            },\\n            \\\"pspReference\\\":\\\"R8QTPCQ8HXSKGK82\\\",\\n            \\\"eventDate\\\":\\\"2019-11-12T12:00:01+01:00\\\",\\n            \\\"eventCode\\\":\\\"AUTHORISATION\\\",\\n            \\\"reason\\\": \\\"Refused\\\",\\n            \\\"success\\\":\\\"false\\\",\\n            ...\\n         }\\n      }\\n   ]\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h3>Rescue process ended<\/h3>\n<p>When the Auto Rescue process ends we send you a webhook event with:<\/p>\n<ul>\n<li><code>eventCode<\/code>:\u00a0<strong>AUTORESCUE<\/strong>.<\/li>\n<li><code>eventDate<\/code>: The date that the rescue process started.<\/li>\n<li><code>success<\/code>: Indicates whether the rescue process was successful:\n<ul>\n<li><strong>true<\/strong>: The rescue process was successful.<\/li>\n<li><strong>false<\/strong>: The rescue process was unsuccessful.<\/li>\n<\/ul><\/li>\n<li><code>merchantOrderReference<\/code>: Unique order reference you provided in the payment request.<\/li>\n<li><code>reason<\/code>: If the rescue process was unsuccessful, this indicates why the payment could not be rescued:\n<ul>\n<li><code>retryWindowHasElapsed<\/code>: The rescue window expired.<\/li>\n<li><code>maxRetryAttemptsReached<\/code>: The maximum number of retry attempts was made.<\/li>\n<li><code>fraudDecline<\/code>: The retry was rejected due to fraud.<\/li>\n<li><code>internalError<\/code>: An internal error occurred while retrying the payment.<\/li>\n<\/ul><\/li>\n<\/ul>\n<p>The example below is a webhook event indicating that a payment could not be rescued. This is because the maximum number of retries has been reached (<code>reason<\/code> is <strong>maxRetryAttemptsReached<\/strong>).<\/p>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'AUTORESCUE webhook an unsuccessful retry attempt'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n   \\\"live\\\":\\\"false\\\",\\n   \\\"notificationItems\\\":[\\n      {\\n         \\\"NotificationRequestItem\\\":{\\n            \\\"additionalData\\\":{\\n               \\\"retry.rescueReference\\\":\\\"88HH88HH88HH88HH\\\",\\n               \\\"merchantOrderReference\\\":\\\"Cust12345_Nov19\\\"\\n            },\\n            \\\"amount\\\":{\\n               \\\"currency\\\":\\\"USD\\\",\\n               \\\"value\\\":1000\\n            },\\n            \\\"eventCode\\\":\\\"AUTORESCUE\\\",\\n            \\\"eventDate\\\":\\\"2019-11-11T12:00:01+01:00\\\",\\n            \\\"merchantAccountCode\\\":\\\"YOUR_MERCHANT_ACCOUNT\\\",\\n            \\\"success\\\":\\\"false\\\",\\n            \\\"originalReference\\\":\\\"812872049382471H\\\",\\n            \\\"pspReference\\\":\\\"V4HZ4RBFJGXXGN82\\\",\\n            \\\"reason\\\":\\\"maxRetryAttemptsReached\\\",\\n            ...\\n         }\\n      }\\n   ]\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<h2 id=\"send-a-payment-link\">Send a payment link<\/h2>\n<p>In case the Auto Rescue process ended unsuccessfully, you can optionally use <a href=\"\/pt\/unified-commerce\/pay-by-link\">Pay by Link<\/a> to send the shopper a payment link so they can still proceed with the payment, for example, using other payment method.<\/p>\n<p>To activate Pay by Link for Auto Rescue, 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>.<\/p>\n<p>After we activate the feature, you will receive additional data fields in the Auto Rescue process end webhook:<\/p>\n<ul>\n<li><a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/CheckoutService\/latest\/post\/paymentLinks\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">paymentLink.url<\/a> \u2014 The URL where the shopper can complete the payment. Valid for 5 days.<\/li>\n<li><a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/CheckoutService\/latest\/post\/paymentLinks\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">paymentLink.expiresAt<\/a> \u2014 The date when the payment link expires, in <a href=\"https:\/\/www.iso.org\/iso-8601-date-and-time-format.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">ISO 8601<\/a> format. For example, <code>2019-11-23T12:25:28Z<\/code> or <code>2020-05-27T20:25:28+08:00<\/code>.<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n    <code-sample :title=\"'AUTORESCUE webhook with payment link'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n   \\\"live\\\":\\\"false\\\",\\n   \\\"notificationItems\\\":[\\n      {\\n         \\\"NotificationRequestItem\\\":{\\n            \\\"additionalData\\\":{\\n               \\\"retry.rescueReference\\\":\\\"88HH88HH88HH88HH\\\",\\n               \\\"merchantOrderReference\\\":\\\"Cust12345_Nov19\\\",\\n               \\\"paymentLink.url\\\": \\\"https:\\\/\\\/test.adyen.link\\\/PL8F7CCDDCCB904770\\\",\\n               \\\"paymentLink.expiresAt\\\": \\\"2021-05-26T12:51:14Z\\\"\\n            },\\n            \\\"amount\\\":{\\n               \\\"currency\\\":\\\"USD\\\",\\n               \\\"value\\\":1000\\n            },\\n            \\\"eventCode\\\":\\\"AUTORESCUE\\\",\\n            \\\"eventDate\\\":\\\"2019-11-11T12:00:01+01:00\\\",\\n            \\\"merchantAccountCode\\\":\\\"YOUR_MERCHANT_ACCOUNT\\\",\\n            \\\"success\\\":\\\"false\\\",\\n            \\\"originalReference\\\":\\\"812872049382471H\\\",\\n            \\\"pspReference\\\":\\\"GH4R4RBFJGXXGN82\\\",\\n            \\\"reason\\\":\\\"maxRetryAttemptsReached\\\"\\n         }\\n      }\\n   ]\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>When the shopper has paid with Pay by Link, you receive an <a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/MockNotificationService\/latest\/post\/AUTHORISATION\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">AUTHORISATION<\/a> webhook event with:<\/p>\n<ul>\n<li><code>shopperReference<\/code>: The payment details used by the shopper.<\/li>\n<li><code>storedPaymentMethodId<\/code>: The token you can use for the next subscription renewal. For more information, refer to <a href=\"\/pt\/online-payments\/tokenization\">Tokenization<\/a>.<\/li>\n<\/ul>\n<h2 id=\"cancel-auto-rescue-process\">Cancel Auto Rescue<\/h2>\n<p>While a payment is in the Auto Rescue process, your shopper may provide you with a new payment method, or cancel their subscription. In these scenarios, you should cancel the Auto Rescue process for the refused payment.<\/p>\n<p>To cancel the Auto Rescue process:<\/p>\n<ol>\n<li>\n<p>Make a\u00a0<a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/Payment\/cancel\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/cancel<\/a>\u00a0request, specifying:\u00a0<\/p>\n<ul>\n<li><code>originalReference<\/code>: The <code>rescueReference<\/code> that you received in the <a href=\"#payment-response\">payment response<\/a>.<\/li>\n<li><code>cancellationType<\/code>: <strong>autoRescue<\/strong><\/li>\n<\/ul>\n<p>The following example shows how to cancel the Auto Rescue process for a payment with a <code>rescueReference<\/code> of <strong>865497581465325B<\/strong>.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Cancel Auto Rescue'\" :id=\"''\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/pal-test.adyen.com\\\/pal\\\/servlet\\\/Payment\\\/v68\\\/cancel \\\\\\n-H 'x-api-key: YOUR_COMPANY_ACCOUNT_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n\\t\\t\\&quot;merchantAccount\\&quot;:\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n\\t\\t\\&quot;originalReference\\&quot;:\\&quot;865497581465325B\\&quot;,\\n\\t\\t\\&quot;additionalData\\&quot;:{\\n\\t\\t\\t\\&quot;cancellationType\\&quot;:\\&quot;autoRescue\\&quot;\\n\\t\\t}\\n\\t}'&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>You receive a\u00a0<a href=\"https:\/\/docs.adyen.com\/api-explorer\/#\/Payment\/cancel\" class=\"codeLabel external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/cancel<\/a>\u00a0response containing:<\/p>\n<ul>\n<li><code>response<\/code>: <strong>[cancel-received]<\/strong><\/li>\n<li><code>pspReference<\/code>: The PSP reference associated with this <code>\/cancel<\/code> request. This is different from the PSP reference associated with the original payment request.<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Response'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"\\t{\\n\\t    \\\"response\\\":\\\"[cancel-received]\\\",\\n\\t\\t\\\"pspReference\\\":\\\"XB7XNCQ8HXSKGK82\\\"\\n\\t}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<p>After we have processed your cancel request, you receive a webhook event with:<\/p>\n<ul>\n<li><code>eventCode<\/code>: <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Webhooks\/latest\/post\/CANCEL_AUTORESCUE\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CANCEL_AUTORESCUE<\/a><\/li>\n<li><code>success<\/code>: Indicates whether your request to cancel the rescue process was successful.<\/li>\n<li><code>merchantOrderReference<\/code>: Unique order reference that you provided in the payment request.<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'CANCEL_AUTORESCUE webhook'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"\\t{\\n\\t   \\\"live\\\":\\\"false\\\",\\n\\t   \\\"notificationItems\\\":[\\n\\t      {\\n\\t         \\\"NotificationRequestItem\\\":{\\n               \\\"additionalData\\\":{\\n                  \\\"merchantOrderReference\\\":\\\"Cust12345_Nov19\\\"\\n               },\\n\\t            \\\"amount\\\":{\\n\\t               \\\"currency\\\":\\\"USD\\\",\\n\\t               \\\"value\\\":1000\\n\\t            },\\n\\t            \\\"eventCode\\\":\\\"CANCEL_AUTORESCUE\\\",\\n\\t            \\\"eventDate\\\": \\\"2019-04-05T09:08:05+01:00\\\",\\n\\t            \\\"merchantAccountCode\\\":\\\"YOUR_MERCHANT_ACCOUNT\\\",\\n\\t            \\\"success\\\":\\\"true\\\",\\n\\t            \\\"originalReference\\\":\\\"88HH88HH88HH88HH\\\",\\n\\t            \\\"pspReference\\\":\\\"BB7XNCQ8HXSKGK82\\\",\\n\\t            ...\\n\\t         }\\n\\t      }\\n\\t   ]\\n\\t}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2 id=\"test-auto-rescue\">Test Auto Rescue and go live<\/h2>\n<p>Before flagging live payments for Auto Rescue, we recommend that you test how your integration handles scenarios involving <a href=\"#step-2-receive-auto-rescue-updates\">Auto Rescue updates<\/a>.<\/p>\n<p>To simulate scenarios involving Auto Rescue updates:<\/p>\n<ol>\n<li>\n<p>Make a test  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> request that is <a href=\"#step-1-enable-auto-rescue\">flagged for Auto Rescue<\/a>. In the request, additionally provide:<\/p>\n <ul>\n<li><code>autoRescueScenario<\/code>: Set this to the scenario you want to test:\n<ul>\n<li><strong>AutoRescueSuccessfulFirst<\/strong>: The payment is refused; the first retry attempt is successful.<\/li>\n<li><strong>AutoRescueSuccessfulSecond<\/strong>: The payment and first retry attempt are refused; the second retry attempt is successful.<\/li>\n<li><strong>AutoRescueFailed<\/strong>: The payment and all retry attempts are refused.<\/li>\n<li><strong>AutoRescueFraud<\/strong>: The payment is refused because of fraud; there will be no retry attempts.<\/li>\n<\/ul><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>The example below shows how to test a scenario, with the  <a href=\"https:\/\/docs.adyen.com\/api-explorer\/Checkout\/latest\/post\/payments\" class=\"codeLabel  external-link no-image\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\/payments<\/a> endpoint, where the second retry attempt is successful:<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Test successful second retry attempt'\" :id=\"'1'\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl https:\\\/\\\/checkout-test.adyen.com\\\/v68\\\/payments \\\\\\n-H 'x-api-key: YOUR_COMPANY_ACCOUNT_API_KEY' \\\\\\n-H 'content-type: application\\\/json' \\\\\\n-d '{\\n      \\&quot;paymentMethod\\&quot;:{\\n          \\&quot;type\\&quot;:\\&quot;scheme\\&quot;,\\n          \\&quot;storedPaymentMethodId\\&quot;:\\&quot;7218395820498476\\&quot;\\n      },\\n      \\&quot;amount\\&quot;:{\\n          \\&quot;currency\\&quot;:\\&quot;USD\\&quot;,\\n          \\&quot;value\\&quot;:1000\\n      },\\n      \\&quot;returnUrl\\&quot;:\\&quot;https:\\\/\\\/your-company.example.com\\\/...\\&quot;,\\n      \\&quot;merchantAccount\\&quot;:\\&quot;YOUR_MERCHANT_ACCOUNT\\&quot;,\\n      \\&quot;recurringProcessingModel\\&quot;:\\&quot;Subscription\\&quot;,\\n      \\&quot;shopperInteraction\\&quot;:\\&quot;ContAuth\\&quot;,\\n      \\&quot;reference\\&quot;:\\&quot;Trans987654321\\&quot;,\\n      \\&quot;shopperReference\\&quot;:\\&quot;YOUR_UNIQUE_SHOPPER_ID\\&quot;,\\n      \\&quot;merchantOrderReference\\&quot;:\\&quot;SecondRetryTest\\&quot;,\\n      \\&quot;additionalData\\&quot;:{\\n          \\&quot;autoRescue\\&quot;:\\&quot;true\\&quot;,\\n          \\&quot;maxDaysToRescue\\&quot;:\\&quot;40\\&quot;,\\n          \\&quot;autoRescueScenario\\&quot;:\\&quot;AutoRescueSuccessfulSecond\\&quot;\\n    }\\n  }'&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<!-- list separator -->\n<\/li>\n<li>\n<p>You receive <a href=\"#step-2-receive-auto-rescue-updates\">Auto Rescue updates<\/a> corresponding to the scenario you are testing. If this scenario involves multiple retry attempts, these Auto Rescue updates will occur several minutes apart.<\/p>\n<\/li>\n<\/ol>\n<h2 id=\"auto-rescue-reports\">Auto Rescue reports<\/h2>\n<p>Each Auto Rescue retry attempt is a separate transaction, and thus generates a unique <code>pspReference<\/code>. If you want to see all payments initiated by Auto Rescue, we can add the <strong>Payment Requester Type<\/strong> column to your <a href=\"\/pt\/reporting\/received-payment-details-report\">Received payment details report<\/a>. 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> or your Adyen Account Manager to configure this for you.<\/p>\n<p>To connect an Auto Rescue retry attempt to a payment request, use the value in the <strong>Merchant Order Reference<\/strong> column. This corresponds to <code>merchantOrderReference<\/code> you provided in the payment request. We can add <strong>Merchant Order Reference<\/strong> to the following reports:<\/p>\n<ul>\n<li><a href=\"\/pt\/reporting\/received-payment-details-report\">Received payment details report<\/a><\/li>\n<li><a href=\"\/pt\/reporting\/settlement-detail-report\">Settlement Detail Report<\/a><\/li>\n<li><a href=\"\/pt\/reporting\/invoice-reconciliation\/payment-accounting-report\">Payments Accounting Report<\/a><\/li>\n<\/ul>\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> or your Adyen Account Manager to configure this for you.<\/p>\n<div class=\"notices yellow\">\n<p>If you did not provide <code>merchantOrderReference<\/code> in the payment request, we automatically populate the <strong>Merchant Order Reference<\/strong> column with <code>pspReference<\/code> of the payment request.<\/p>\n<\/div>\n<h3>Example<\/h3>\n<p>The following example represents two payment requests. One has the <code>merchantOrderReference<\/code> <strong>A1<\/strong>, and the other <strong>A2<\/strong>.<\/p>\n<ul>\n<li><strong>A1<\/strong>: The payment was rescued on the first retry attempt.<\/li>\n<li><strong>A2<\/strong>: The payment was rescued on the third retry attempt.<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Transaction<\/th>\n<th style=\"text-align: left;\">PSP Reference<\/th>\n<th style=\"text-align: left;\">Merchant Order Reference<\/th>\n<th style=\"text-align: left;\">Record Type<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\">November monthly subscription payment<\/td>\n<td style=\"text-align: left;\">812872049382471H<\/td>\n<td style=\"text-align: left;\">A1<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">1st retry attempt<\/td>\n<td style=\"text-align: left;\">814987049386784P<\/td>\n<td style=\"text-align: left;\">A1<\/td>\n<td style=\"text-align: left;\">Authorised<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">December monthly subscription payment<\/td>\n<td style=\"text-align: left;\">812872049382471H<\/td>\n<td style=\"text-align: left;\">A2<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">1st retry attempt<\/td>\n<td style=\"text-align: left;\">804938149876784D<\/td>\n<td style=\"text-align: left;\">A2<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">2nd retry attempt<\/td>\n<td style=\"text-align: left;\">804938149950514L<\/td>\n<td style=\"text-align: left;\">A2<\/td>\n<td style=\"text-align: left;\">Refused<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\">3rd retry attempt<\/td>\n<td style=\"text-align: left;\">814987049986784P<\/td>\n<td style=\"text-align: left;\">A2<\/td>\n<td style=\"text-align: left;\">Authorised<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"see-also\">See also<\/h2>\n<div class=\"see-also-links output-inline\" id=\"see-also\">\n<ul><li><a href=\"\/development-resources\/refusal-reasons\"\n                        target=\"_self\"\n                        >\n                    Refusal reasons\n                <\/a><\/li><li><a href=\"\/development-resources\/webhooks\"\n                        target=\"_self\"\n                        >\n                    Webhooks\n                <\/a><\/li><li><a href=\"\/online-payments\/capture\"\n                        target=\"_self\"\n                        >\n                    Capture\n                <\/a><\/li><li><a href=\"\/online-payments\/cancel\"\n                        target=\"_self\"\n                        >\n                    Cancel\n                <\/a><\/li><li><a href=\"\/reporting\/received-payment-details-report\"\n                        target=\"_self\"\n                        >\n                    Received payment details report\n                <\/a><\/li><li><a href=\"\/unified-commerce\/pay-by-link\"\n                        target=\"_self\"\n                        >\n                    Pay by Link\n                <\/a><\/li><\/ul><\/div>\n","url":"https:\/\/docs.adyen.com\/pt\/online-payments\/auto-rescue\/cards","articleFields":{"description":"Automatically retry shopper-not-present card transactions when they are refused.","id":"47482757","type":"page","cache_enable":false,"_expandable":{"operations":""}},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/online-payments\/auto-rescue\/cards","title":"Auto Rescue for card payments","content":"On this page, you will learn how to:\n\nEnable Auto Rescue for card payments.\nReceive updates on the Auto Rescue process.\n\nWe also explain how you can:\n\nSend a payment link when the Auto Rescue process ends unsuccessfully.\nCancel the Auto Rescue process for a payment.\nTest how your integration handles Auto Rescue updates.\nReconcile retry attempts in Adyen-generated reports.\n\nHow it works\n\nStep 1: Enable Auto Rescue\nYou can enable Auto Rescue at either:\n\nAccount level: Auto Rescue is used on all eligible payments.\nTransaction level: You choose when Auto Rescue can be used for a payment, using the autoRescue flag.\n\nEnable at account level\nTo enable Auto Rescue for all payments, contact our Support Team or your Adyen Account Manager.\nWhen enabled, Auto Rescue works for payments that have:\n\nThe shopperInteraction ContAuth.\nA value greater than 0.\n\n\nIf you enable Auto Rescue at account level, a rescue window of one calendar month is used. If you prefer to use another rescue window you need to enable Auto Rescue at the transaction level.\n\nYou receive updates to the Auto Rescue process in webhook events.\nEnable at transaction level\nTo enable Auto Rescue on a transaction level, you need to:\n\nContact our Support Team or your Adyen Account Manager to configure this for you.\nAdd the autoRescue flag to your payment request to enable Auto Rescue for that transaction.\nIn the payment request, provide a unique merchantOrderReference. This should represent a specific billing cycle or subscription, and will appear in any Auto Rescue updates or reports.\n\n\nWith merchantOrderReference you can connect any Auto Rescue retry attempts to a payment request.\n\nTo enable Auto Rescue for a transaction:\n\n\nMake a payment request, and additionally specify:\n\n shopperInteraction&#58; ContAuth\nautoRescue:\u00a0true\nmaxDaysToRescue: The rescue window, in days. You can specify between\u00a01\u00a0and\u00a048 days. We recommend using a rescue window of one calendar month (30 days).\n reference&#58; Your unique reference for this\u00a0payment request.\n merchantOrderReference&#58; Your unique order reference. For example, a concatenation of a unique shopper reference and the transaction date.\n\nThe example below shows how to enable Auto Rescue for a shopper-not-present payment submitted to the  \/payments endpoint. If this payment is Refused, Auto Rescue will automatically retry this payment for a maximum of 40 days.\n\n\n\n\n\n\n\n\nYou receive a payment response. If the payment is refused, this contains:\n\n\nresultCode:\u00a0Refused\n\n\nrefusalReason: The reason the payment was refused. For more information, see Refusal reasons.\n\n\nretry.rescueScheduled:\u00a0Indicates whether Auto Rescue will try to rescue the payment:\n\ntrue: Auto Rescue will try to rescue the payment. You receive updates on the rescue process in webhook events.\nfalse: Auto Rescue will not try to rescue the payment. This happens when a payment cannot be rescued. For example, because of account closure or fraud.\n\n\n\nretry.rescueReference: Unique Auto Rescue reference for this payment.\nYou can use this to cancel the Auto Rescue process if, for example, the shopper provides you with a new payment details, or cancels their subscription.\n\n\nThe example response below is for a payment that was Refused. In this response, retry.rescueScheduled is set to true, indicating that Auto Rescue will attempt to rescue this payment.\n\n\n\n\n\nYou receive updates to the Auto Rescue process in webhook events.\nStep 2: Receive Auto Rescue updates\nTo update you on the Auto Rescue process, we send you webhook events. We send you a webhook event when:\n\nA retry attempt was made, and it was:\n\nSuccessful.\nUnsuccessful.\n\nThe rescue process ended, either because the payment was rescued, or the Auto Rescue process was unsuccessful.\n\n\nBefore using Auto Rescue for live payments, we recommend that you test how your integration handles these webhook events.\n\nRetry attempt successful\nIf a retry attempt is successful, you receive a webhook event with:\n\neventCode: AUTHORISATION\neventDate: The date of the retry attempt.\nsuccess: true\npspReference: Adyen's unique reference for the successful retry attempt.\nmerchantOrderReference: Unique order reference that you provided in the payment request.\n\nThe example below is for a retry attempt that was successful.\n\n    \n\nYou can view how much revenue has been recovered with Auto Rescue in your Customer Area, under Reports. Search for the RevenueAccelerate report.\n\nIf you use manual capture, you need to capture each rescued payment to transfer it to your account.\n\nRetry attempt unsuccessful\nIf a retry attempt is unsuccessful, you receive a webhook event with:\n\neventCode:\u00a0AUTHORISATION\neventDate: The date of the retry attempt.\nsuccess: false\nmerchantOrderReference:\u00a0Unique order reference that you provided in the payment request.\nretry.rescueScheduled: Indicates whether Auto Rescue will attempt the payment again:\n\ntrue:\u00a0Another retry attempt has been scheduled.\u00a0\nfalse: We are unable to schedule another retry attempt.\nThis usually happens when you have reached the maximum number of retries.\n\n\nThe example below is for a retry attempt that was unsuccessful (success is false). Another retry attempt has been scheduled (retry.rescueScheduled is true).\n\n    \n\nRescue process ended\nWhen the Auto Rescue process ends we send you a webhook event with:\n\neventCode:\u00a0AUTORESCUE.\neventDate: The date that the rescue process started.\nsuccess: Indicates whether the rescue process was successful:\n\ntrue: The rescue process was successful.\nfalse: The rescue process was unsuccessful.\n\nmerchantOrderReference: Unique order reference you provided in the payment request.\nreason: If the rescue process was unsuccessful, this indicates why the payment could not be rescued:\n\nretryWindowHasElapsed: The rescue window expired.\nmaxRetryAttemptsReached: The maximum number of retry attempts was made.\nfraudDecline: The retry was rejected due to fraud.\ninternalError: An internal error occurred while retrying the payment.\n\n\nThe example below is a webhook event indicating that a payment could not be rescued. This is because the maximum number of retries has been reached (reason is maxRetryAttemptsReached).\n\n    \n\nSend a payment link\nIn case the Auto Rescue process ended unsuccessfully, you can optionally use Pay by Link to send the shopper a payment link so they can still proceed with the payment, for example, using other payment method.\nTo activate Pay by Link for Auto Rescue, contact our Support Team.\nAfter we activate the feature, you will receive additional data fields in the Auto Rescue process end webhook:\n\npaymentLink.url \u2014 The URL where the shopper can complete the payment. Valid for 5 days.\npaymentLink.expiresAt \u2014 The date when the payment link expires, in ISO 8601 format. For example, 2019-11-23T12:25:28Z or 2020-05-27T20:25:28+08:00.\n\n\n    \n\nWhen the shopper has paid with Pay by Link, you receive an AUTHORISATION webhook event with:\n\nshopperReference: The payment details used by the shopper.\nstoredPaymentMethodId: The token you can use for the next subscription renewal. For more information, refer to Tokenization.\n\nCancel Auto Rescue\nWhile a payment is in the Auto Rescue process, your shopper may provide you with a new payment method, or cancel their subscription. In these scenarios, you should cancel the Auto Rescue process for the refused payment.\nTo cancel the Auto Rescue process:\n\n\nMake a\u00a0\/cancel\u00a0request, specifying:\u00a0\n\noriginalReference: The rescueReference that you received in the payment response.\ncancellationType: autoRescue\n\nThe following example shows how to cancel the Auto Rescue process for a payment with a rescueReference of 865497581465325B.\n\n\n\n\n\nYou receive a\u00a0\/cancel\u00a0response containing:\n\nresponse: [cancel-received]\npspReference: The PSP reference associated with this \/cancel request. This is different from the PSP reference associated with the original payment request.\n\n\n\n\nAfter we have processed your cancel request, you receive a webhook event with:\n\neventCode: CANCEL_AUTORESCUE\nsuccess: Indicates whether your request to cancel the rescue process was successful.\nmerchantOrderReference: Unique order reference that you provided in the payment request.\n\n\n\n\n\n\nTest Auto Rescue and go live\nBefore flagging live payments for Auto Rescue, we recommend that you test how your integration handles scenarios involving Auto Rescue updates.\nTo simulate scenarios involving Auto Rescue updates:\n\n\nMake a test  \/payments request that is flagged for Auto Rescue. In the request, additionally provide:\n \nautoRescueScenario: Set this to the scenario you want to test:\n\nAutoRescueSuccessfulFirst: The payment is refused; the first retry attempt is successful.\nAutoRescueSuccessfulSecond: The payment and first retry attempt are refused; the second retry attempt is successful.\nAutoRescueFailed: The payment and all retry attempts are refused.\nAutoRescueFraud: The payment is refused because of fraud; there will be no retry attempts.\n\n\n\n\nThe example below shows how to test a scenario, with the  \/payments endpoint, where the second retry attempt is successful:\n\n\n\n\n\n\nYou receive Auto Rescue updates corresponding to the scenario you are testing. If this scenario involves multiple retry attempts, these Auto Rescue updates will occur several minutes apart.\n\n\nAuto Rescue reports\nEach Auto Rescue retry attempt is a separate transaction, and thus generates a unique pspReference. If you want to see all payments initiated by Auto Rescue, we can add the Payment Requester Type column to your Received payment details report. Contact our Support Team or your Adyen Account Manager to configure this for you.\nTo connect an Auto Rescue retry attempt to a payment request, use the value in the Merchant Order Reference column. This corresponds to merchantOrderReference you provided in the payment request. We can add Merchant Order Reference to the following reports:\n\nReceived payment details report\nSettlement Detail Report\nPayments Accounting Report\n\nContact our Support Team or your Adyen Account Manager to configure this for you.\n\nIf you did not provide merchantOrderReference in the payment request, we automatically populate the Merchant Order Reference column with pspReference of the payment request.\n\nExample\nThe following example represents two payment requests. One has the merchantOrderReference A1, and the other A2.\n\nA1: The payment was rescued on the first retry attempt.\nA2: The payment was rescued on the third retry attempt.\n\n\n\n\nTransaction\nPSP Reference\nMerchant Order Reference\nRecord Type\n\n\n\n\nNovember monthly subscription payment\n812872049382471H\nA1\nRefused\n\n\n1st retry attempt\n814987049386784P\nA1\nAuthorised\n\n\nDecember monthly subscription payment\n812872049382471H\nA2\nRefused\n\n\n1st retry attempt\n804938149876784D\nA2\nRefused\n\n\n2nd retry attempt\n804938149950514L\nA2\nRefused\n\n\n3rd retry attempt\n814987049986784P\nA2\nAuthorised\n\n\n\nSee also\n\n\n                    Refusal reasons\n                \n                    Webhooks\n                \n                    Capture\n                \n                    Cancel\n                \n                    Received payment details report\n                \n                    Pay by Link\n                \n","type":"page","locale":"pt","boost":17,"hierarchy":{"lvl0":"Home","lvl1":"Online payments","lvl2":"Auto Rescue","lvl3":"Auto Rescue for card payments"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/online-payments","lvl2":"https:\/\/docs.adyen.com\/pt\/online-payments\/auto-rescue","lvl3":"\/pt\/online-payments\/auto-rescue\/cards"},"levels":4,"category":"Online Payments","category_color":"green","tags":["Rescue","payments"]},"articleFiles":{"autorescue-cards.svg":"<img alt=\"\" src=\"https:\/\/docs.adyen.com\/user\/pages\/docs\/02.online-payments\/23.auto-rescue\/01.cards\/autorescue-cards.svg?decoding=auto&amp;fetchpriority=auto\" \/>","enable-auto-rescue-in-a-payments-request-8007607543.js":"<p alt=\"\">enable-auto-rescue-in-a-payments-request-8007607543.js<\/p>"}}
