Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

      Refund online payments

      This document describes how to issue refunds and how the refund for Alipay Online Payment works.


      #Scope

      The information in this document applies to Alipay Online Payment products and AlipayHK online payment products, which includes the following ones:

      • Cross-border Website Payment
      • Cross-border WAP Payment
      • Cross-border In-APP Payment
      • AlipayHK - PC2Mobile
      • AlipayHK - WAP
      • AlipayHK - SDK


      #Overview

      The following table describes the key information of online payment refunds.

      Refund type

      Asynchronous refund

      Asynchronous refund

      Synchronous refund

      Refund method

      Global Merchant Portal

      API (is_sync is N or null)

      API (is_sync is Y)

      How is refund result returned

      Displayed in the Global Merchant Portal transaction list

      Returned by the API sync response or asynchronous notification. See Asynchronous refund for details.

      Returned by the API sync response

      Synchronous 

      response exists

      No

      Yes. If the request succeeds, sync response returns the request acceptance result. However, if the request fails, the refund fails, and sync response returns the failure result.

      Yes. Sync response returns the both the request acceptance result and the refund result.

      Asynchronous 

      notification exists

      No

      Yes, but only if the refund succeeds. 

      No

      Alipay retries the refund

      Yes. If merchant funds are insufficient, Alipay retries the refund every 6 hours, for 180 days. If the funds are still insufficient after 180 days, the refund fails.

      No. To retry a refund, merchant must send a new request.

      Table 1. Key information for online payment refund


      #How to issue a refund

      You can issue a refund by using the refund API for online payments (forex_refund) or by using Global Merchant Portal. Only transactions that are successfully paid can be refunded and the refund must be requested within the valid refund period. 

      • API can be used to request either a synchronous refund or an asynchronous refund. 
      • Global Merchant Portal can only issue asynchronous refund.


      #Synchronous refund

      Use the refund interface forex_refund to issue a synchronous refund. In the request, the value of is_sync must be Y For more information about the API, see forex_refund.


      After receiving the request, Alipay processes the refund and then returns the refund result to the merchant by using a synchronous response.

      • If errors exist in the request, the refund fails.
      • If the request is successfully accepted, Alipay process the refund, and
        • If the merchant funds are sufficient for the refund, the refund succeeds.
        • If the merchant funds are insufficient for the refund, the refund fails. Merchant can retry the refund by sending a new request.


      Sample request

      copy
      https://intlmapi.alipay.com/gateway.do?service=forex_refund&partner=2088021017666931&_input_charset=UTF-8&sign_type=MD5&notify_url=https%3A%2F%2Fwww.test.com&currency=USD&product_code=NEW_OVERSEAS_SELLER&out_return_no=Sync_Refund_Test001-1&out_trade_no=Sync_Refund_Test001&return_amount=0.5&gmt_return=20200212%2016%3A14%3A00&reason=%E4%B9%B0%E5%AE%B6%E4%B8%BB%E5%8A%A8%E8%A6%81%E6%B1%82%E9%80%80%E6%AC%BE&is_sync=Y&sign=89c8d32bc205f023677438e24d7da6ba


      Sample response

      The refund succeeds:

      copy
      <?xml version="1.0" encoding="GBK"?>
      <alipay>
          <is_success>T</is_success>    
      </alipay>


      The refund fails:

      copy
      <alipay>
      <is_success>F</is_success>
      <error>RETURN_AMOUNT_EXCEED</error>
      <sign>d4af978a4f8c7f9cf7003ee3ee4244ed</sign>
      <sign_type>MD5</sign_type>
      </alipay>


      #Asynchronous refund

      You can issue an asynchronous refund refund by using either the refund API or by using Global Merchant Portal.


      #API

      Use the refund interface forex_refund to issue an asynchronous refund. In the request, is_sync can be empty, or the value of is_sync must be N. For more information about the API, see forex_refund.


      After the request is sent, Alipay processes the refund and then notifies the merchant of the refund result according to following scenarios:

      • If the errors exist in the request, the refund fails. Alipay returns the result by using a synchronous response.
      • If the request is successfully accepted, Alipay first returns the request result to the merchant by using a synchronous response, and
        • If the merchant funds are sufficient for the refund, Alipay processes the refund and sends the refund result to the merchant by using an asynchronous notification.
        • If the merchant funds are insufficient for the refund, Alipay retries the refund every 6 hours, for 180 days.
          • If the funds become sufficient, Alipay processes the refund and sends the refund result to the merchant by using an asynchronous notification.
          • If the merchant funds are still insufficient after the 180 days, the refund fails. No notification is sent in this case.


      Sample request

      copy
      https://intlmapi.alipay.com/gateway.do?service=forex_refund&partner=2088021017666931&_input_charset=UTF-8&sign_type=MD5&notify_url=https%3A%2F%2Fwww.test.com&currency=USD&product_code=NEW_OVERSEAS_SELLER&out_return_no=Sync_Refund_Test001-2&out_trade_no=Sync_Refund_Test001&return_amount=0.01&gmt_return=20200212%2016%3A14%3A00&reason=%E4%B9%B0%E5%AE%B6%E4%B8%BB%E5%8A%A8%E8%A6%81%E6%B1%82%E9%80%80%E6%AC%BE&sign=96104d3492137faed791e83570b23870


      Sample response

      The refund request is accepted by Alipay and a synchronous response is returned:

      copy
      <?xml version="1.0" encoding="GBK"?>
      <alipay>
          <is_success>T</is_success>    
      </alipay>

      The refund fails, and a synchronous response is returned:

      copy
      <alipay>
      <is_success>F</is_success>
      <error>RETURN_AMOUNT_EXCEED</error>
      <sign>d4af978a4f8c7f9cf7003ee3ee4244ed</sign>
      <sign_type>MD5</sign_type>
      </alipay>


      The refund succeeds, and an asynchronous notification is sent:

      copy
      https://www.mikascoffee.com/notify
      notify_type=refund_status_sync
      return_amount=0.01
      notify_time=2019-09-04 18:07:27
      out_trade_no=out_trade_no_20190826_204553
      refund_status=REFUND_SUCCESS
      sign=$$
      out_return_no=out_return_no_20190904_142349
      currency=USD
      sign_type=MD5
      notify_id=201xxxxxxxxxxxxxxxxxxxxxxxxxxxx9467


      #Global Merchant Portal

      You can issue an asynchronous refund by using Alipay Global Merchant Portal. See the following steps for details:


      1. Log into Alipay Global Site with your merchant account.

      image.png


      1. Go to Business Center -- My Transaction.

      image.png


      1. Find the specific transaction and click Refund. You can search the transaction with the transaction ID, or filter transactions by using the transaction time.

      image.png


      1. Enter the refund information and your payment password to issue the refund.

      image.png


      1. Click 确定 (Confirm) to confirm the refund.

      捕获.PNG


      You can then wait for the refund to be processed by Alipay. To obtain the refund result, you must find the specific transaction in Global Merchant Portal, or use the reconciliation service.