Menu

Alipay

Note: To learn about the features of Alipay, there's an overviewhere

How to integrate Alipay payments:

Direct payment request

  • For Alipay payments the <shopperEmailAddress> is mandatory
  • We also recommend that you include the <statementNarrative>, explainedbelow

Note: If you use the mobile optimised version of the existing Alipay integration, change the payment method code from ALIPAY-SSL to ALIPAYMOBILE-SSL.

Copied!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE paymentService PUBLIC "-//Worldpay//DTD Worldpay PaymentService v1//EN"
 "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService merchantCode="YOUR_MERCHANT_CODE" version="1.4">
  <submit>
    <order orderCode="YOUR_ORDER_CODE"><!--Use a unique order code each time-->
      <description>Description here</description>
      <amount currencyCode="CNY" value="1000" exponent="2" />
      <orderContent>
        <![CDATA[ ]]>
      </orderContent>
      <paymentDetails>
        <ALIPAY-SSL shopperCountryCode="CN">
          <successURL>http://www.worldpay.com/?successURL</successURL>
          <cancelURL>http://www.worldpay.com/?cancelURL</cancelURL>
          <pendingURL>http://www.worldpay.com/?pendingURL</pendingURL>
        </ALIPAY-SSL>
      </paymentDetails>
      <shopper>
        <shopperEmailAddress>shopper@worldpay.com</shopperEmailAddress><!--Mandatory-->
      </shopper>
      <statementNarrative>MERCHANT STATEMENT NARRATIVE</statementNarrative><!--We recommend populating this-->
    </order>
  </submit>
</paymentService>

Hosted payment request

For Alipay payments we recommend that you include the <statementNarrative>, explainedbelow.

To re-direct the shopper directly to the Alipay payment pages, append the below string to the end of the re-direct URL provided in the XML response from Worldpay:

&country=CN&preferredPaymentMethod=ALIPAY-SSL &country=CN&preferredPaymentMethod=ALIPAYMOBILE-SSL

Copied!
<!DOCTYPE paymentService PUBLIC "-//Worldpay//DTD Worldpay PaymentService v1//EN"
 "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService version="1.4" merchantCode="YOUR_MERCHANT_CODE">
  <submit>
<order orderCode="YOUR_ORDER_CODE" installationId="1234567"><!--Use a unique order code each time-->
      <description>Test order</description>
      <amount value="100" currencyCode="CNY" exponent="2" />
      <orderContent>
        <![CDATA[ ]]>
      </orderContent>
      <paymentMethodMask>
        <include code="ALL" />
      </paymentMethodMask>
      <shopper>
        <shopperEmailAddress>shopper@worldpay.com</shopperEmailAddress>
      </shopper>
      <statementNarrative>MERCHANT STATEMENT NARRATIVE</statementNarrative><!--We recommend populating this-->
    </order>
  </submit>
</paymentService>

Statement Narrative

The statement narrative is a string that is:

  • Shown to the shopper as a dynamic descriptor on the Alipay payment pages (after opening Order Details).
  • Shown to the shopper on their Alipay statement (after opening Order Details). See the Statement Narrative screenshot below.

Best Practice: We recommend that you populate the statement narrative for Alipay because it:

  • Increases shopper confidence as Alipay provides continuity throughout the shopper journey. Shoppers see the merchant's narrative on both the merchant site and on the Alipay payment pages.
  • Provides additional information to the shopper on their Alipay statement. This reduces the possibility of the shopper not recognising the transaction, making it less likely that they will query the payment at a later stage.

Narrative validation

statementNarrative can be up to 50 characters long. These are valid characters for Alipay:

  • Uppercase and lowercase letters a to z and A to Z
  • Chinese characters
  • Numbers 0 to 9
  • Space
  • Full-stop/ period
  • Underscore
  • Hyphen

Example Statement Narrative

Here's how it might display to a shopper within their Alipay account:

Use of Alipay statement narrative

Payment outcomes

Successful payment

Authorisation from Alipay
Event 1:Shopper completes payment for CNY 1.00 on Alipay payment pages and Worldpay receive authorisation from Alipay in 5 seconds.
Behaviour:Success URL is returned
URL:successURL
URL Example:http://www.worldpay.com/?success&orderKey=ADMINCODE^MERCHANTCODE^Example_Alipay_Order_Code&paymentStatus=AUTHORISED&paymentAmount=100&paymentCurrency=CNY&mac=eb20d74979804ebd8921c3b22a363309
Payment Status:Payment status changes to AUTHORISED
Copied!
<?xml version="1.0" ?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService merchantCode="MERCHANTCODE" version="1.4"><!--Will contain the merchant code used in the request-->
  <notify>
    <orderStatusEvent orderCode="ORDER_CODE"><!--Will contain the order code used in the request-->
      <payment>
        <paymentMethod>
          ALIPAY-SSL
        </paymentMethod>
        <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        <lastEvent>
          AUTHORISED
        </lastEvent>
        <balance accountType="IN_PROCESS_AUTHORISED">
          <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        </balance>
        <riskScore value="41"/>
      </payment>
      <journal journalType="AUTHORISED">
        <bookingDate>
          <date dayOfMonth="30" month="04" year="2013"/>
        </bookingDate>
        <accountTx accountType="IN_PROCESS_AUTHORISED" batchId="5">
          <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        </accountTx>
      </journal>
    </orderStatusEvent>
  </notify>
</paymentService>
Payment captured
Event 2:The payment is captured in WPG.
Behaviour:The automatic capture job runs in WPG to automatically capture the payment
URL:No URL is returned to the shopper because the shopper journey is already complete
URL Example:N/A
Payment Status:Payment status changes to CAPTURED
Copied!
<?xml version="1.0" ?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService merchantCode="MERCHANTCODE" version="1.4"><!--Will contain the merchant code used in the request-->
  <notify>
    <orderStatusEvent orderCode="ORDER_CODE"><!--Will contain the order code used in the request-->
      <payment>
        <paymentMethod>
          ALIPAY-SSL
        </paymentMethod>
        <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        <lastEvent>
          SETTLED
        </lastEvent>
        <balance accountType="SETTLED_BIBIT_NET">
          <amount currencyCode="GBP" debitCreditIndicator="credit" exponent="2" value="10"/>
        </balance>
        <riskScore value="41"/>
      </payment>
      <journal description="1 CNY = 0.10173 GBP" journalType="SETTLED">
        <bookingDate>
          <date dayOfMonth="08" month="05" year="2013"/>
        </bookingDate>
        <accountTx accountType="IN_PROCESS_CAPTURED" batchId="19">
          <amount currencyCode="CNY" debitCreditIndicator="debit" exponent="2" value="100"/>
        </accountTx>
        <accountTx accountType="SETTLED_BIBIT_NET" batchId="13">
          <amount currencyCode="GBP" debitCreditIndicator="credit" exponent="2" value="10"/>
        </accountTx>
      </journal>
    </orderStatusEvent>
  </notify>
</paymentService>
Payment settled
Event 3:The payment is settled internally in WPG.
Behaviour:The automatic capture job runs in WPG to automatically capture the payment. The payment is successfully settled internally in WPG. The Merchants settlement currency for the example Merchant Code below is GBP.
URL:No URL is returned to the shopper because the shopper journey is already complete.
URL Example:N/A
Payment Status:Payment status changes to SETTLED
Copied!
<?xml version="1.0" ?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService merchantCode="MERCHANTCODE" version="1.4"><!--Will contain the merchant code used in the request-->
  <notify>
    <orderStatusEvent orderCode="ORDER_CODE"><!--Will contain the order code used in the request-->
      <payment>
        <paymentMethod>
          ALIPAY-SSL
        </paymentMethod>
        <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        <lastEvent>
          SETTLED
        </lastEvent>
        <balance accountType="SETTLED_BIBIT_NET">
          <amount currencyCode="GBP" debitCreditIndicator="credit" exponent="2" value="10"/>
        </balance>
        <riskScore value="41"/>
      </payment>
      <journal description="1 CNY = 0.10173 GBP" journalType="SETTLED">
        <bookingDate>
          <date dayOfMonth="08" month="05" year="2013"/>
        </bookingDate>
        <accountTx accountType="IN_PROCESS_CAPTURED" batchId="19">
          <amount currencyCode="CNY" debitCreditIndicator="debit" exponent="2" value="100"/>
        </accountTx>
        <accountTx accountType="SETTLED_BIBIT_NET" batchId="13">
          <amount currencyCode="GBP" debitCreditIndicator="credit" exponent="2" value="10"/>
        </accountTx>
      </journal>
    </orderStatusEvent>
  </notify>
</paymentService>

Cancellations

Note: There is no way to cancel the payment on the AliPay payment pages.

Invalid data entry

Invalid data
Event:The shopper provides an incorrect card number or login credentials on the Alipay website.
Behaviour:The credentials are validated on the Alipay website. The shopper remains on the Alipay website until the shopper either types valid data, or closes down their web browser session.
URL:No URL is returned as the shopper does not leave the Alipay website.
URL Example:N/A
Payment Status:Payment status remains at SHOPPER_REDIRECTED
Notification Example:No notification is generated.

Payment time out

Time out
Event:The shopper's order times out before the payment submission.
Behaviour:The shopper is redirected to the cancelURL.
URL:cancelURL
URL Example:http://www.worldpay.com/?cancel&orderKey=ADMINCODE^MERCHANTCODE^Example_Alipay_Order_Code
Payment Status:Payment status changes to SHOPPER_CANCELLED
Notification Example:No notification is generated.

Exception conditions

Authorisation +5 seconds
Event 1:Worldpay receives the asynchronous authorisation from Alipay more than 5 seconds after the shopper completes their journey.
Behaviour:pendingURL with status=OPEN is returned.
URL:pendingURL
URL Example:http://www.worldpay.com/?pending&orderKey=ADMINCODE^MERCHANTCODE^Example_Alipay_Order_Code&status=OPEN
Payment Status:Payment status changes to AUTHORISED
Copied!
<?xml version="1.0" ?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService merchantCode="MERCHANTCODE" version="1.4"><!--Will contain the merchant code used in the request-->
  <notify>
    <orderStatusEvent orderCode="ORDER_CODE"><!--Will contain the order code used in the request-->
      <payment>
        <paymentMethod>
          ALIPAY-SSL
        </paymentMethod>
        <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        <lastEvent>
          AUTHORISED
        </lastEvent>
        <balance accountType="IN_PROCESS_AUTHORISED">
          <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        </balance>
        <riskScore value="41"/>
      </payment>
      <journal journalType="AUTHORISED">
        <bookingDate>
          <date dayOfMonth="30" month="04" year="2013"/>
        </bookingDate>
        <accountTx accountType="IN_PROCESS_AUTHORISED" batchId="5">
          <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        </accountTx>
      </journal>
    </orderStatusEvent>
  </notify>
</paymentService>
Error
Event:The payment cannot be processed due to technical issues at Alipay
Behaviour:pendingURL with status=ERROR is returned
URL:pendingURL
URL Example:http://www.worldpay.com/?pending&orderKey=ADMINCODE^MERCHANTCODE^Example_Alipay_Order_Code&status=ERROR
Payment Status:Payment status remains at SHOPPER_REDIRECTED
Notification Example:No notification is generated.

Refunds

Refund request
Event 1:The merchant requests a refund of 1.00 CNY from the Merchant Interface.
Behaviour:The merchant requests a refund of the settled payment on the MI. The Merchants settlement currency in the example below is GBP.
URL:N/A
URL Example:N/A
Payment Status:Payment status changes to SENT_FOR_REFUND.
Copied!
<?xml version="1.0" ?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService merchantCode="MERCHANTCODE" version="1.4"><!--Will contain the merchant code used in the request-->
  <notify>
    <orderStatusEvent orderCode="ORDER_CODE"><!--Will contain the order code used in the request-->
      <payment>
        <paymentMethod>
          ALIPAY-SSL
        </paymentMethod>
        <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        <lastEvent>
          SENT_FOR_REFUND
        </lastEvent>
        <balance accountType="SETTLED_BIBIT_NET">
          <amount currencyCode="GBP" debitCreditIndicator="credit" exponent="2" value="10"/>
        </balance>
        <balance accountType="IN_PROCESS_CAPTURED">
          <amount currencyCode="CNY" debitCreditIndicator="debit" exponent="2" value="100"/>
        </balance>
        <riskScore value="41"/>
      </payment>
      <journal journalType="SENT_FOR_REFUND">
        <bookingDate>
          <date dayOfMonth="08" month="05" year="2013"/>
        </bookingDate>
        <accountTx accountType="IN_PROCESS_CAPTURED" batchId="22">
          <amount currencyCode="CNY" debitCreditIndicator="debit" exponent="2" value="100"/>
        </accountTx>
      </journal>
    </orderStatusEvent>
  </notify>
</paymentService>
Refund request sent to Alipay
Event 2:The refund request is successfully sent to Alipay.
Behaviour:The Worldpay Payment Service successfully submits the refund request to Alipay. The Merchants settlement currency in the below example is GBP. The Worldpay settlement currency in the below example is USD.
URL:N/A
URL Example:N/A
Payment Status:Payment status changes to REFUNDED.
Copied!
<?xml version="1.0" ?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService merchantCode="MERCHANTCODE" version="1.4"><!--Will contain the merchant code used in the request-->
  <notify>
    <orderStatusEvent orderCode="ORDER_CODE"><!--Will contain the order code used in the request-->
      <payment>
        <paymentMethod>
          ALIPAY-SSL
        </paymentMethod>
        <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        <lastEvent>
          REFUNDED
        </lastEvent>
        <riskScore value="41"/>
     </payment>
      <journal description="1 USD = 0.63446 GBP" journalType="REFUNDED">
        <bookingDate>
          <date dayOfMonth="10" month="05" year="2013"/>
        </bookingDate>
        <accountTx accountType="IN_PROCESS_CAPTURED" batchId="22">
          <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        </accountTx>
        <accountTx accountType="SETTLED_BIBIT_NET" batchId="14">
          <amount currencyCode="GBP" debitCreditIndicator="debit" exponent="2" value="10"/>
       </accountTx>
      </journal>
    </orderStatusEvent>
  </notify>
</paymentService>
Refund fails
Event 3:The refund fails.
Behaviour:The Worldpay Payment Service receives confirmation that the payment has not been successfully sent to the shopper’s Alipay account. In the below example, the authorised amount is 1.00 CNY and the refund amount that has failed is 0.25 CNY. The Merchants settlement currency is GBP.
URL:N/A
URL Example:N/A
Payment Status:Payment status changes to REFUND_FAILED.
Copied!
<?xml version="1.0" ?>
<!DOCTYPE paymentService PUBLIC "-//WorldPay//DTD WorldPay PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd">
<paymentService merchantCode="MERCHANTCODE" version="1.4"><!--Will contain the merchant code used in the request-->
  <notify>
    <orderStatusEvent orderCode="ORDER_CODE"><!--Will contain the order code used in the request-->
      <payment>
        <paymentMethod>
          ALIPAY-SSL
       </paymentMethod>
        <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="100"/>
        <lastEvent>
          REFUND_FAILED
        </lastEvent>
        <balance accountType="SETTLED_BIBIT_NET">
          <amount currencyCode="GBP" debitCreditIndicator="credit" exponent="2" value="11"/>
        </balance>
        <balance accountType="IN_PROCESS_CAPTURED">
          <amount currencyCode="CNY" debitCreditIndicator="debit" exponent="2" value="75"/>
        </balance>
        <riskScore value="1"/>
      </payment>
      <journal journalType="REFUND_FAILED">
        <bookingDate>
          <date dayOfMonth="31" month="05" year="2013"/>
        </bookingDate>
        <accountTx accountType="IN_PROCESS_CAPTURED" batchId="31">
          <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="25"/>
        </accountTx>
      </journal>
    </orderStatusEvent>
  </notify>
</paymentService>

Transfer reports

Settled

Below is an example of a settled transaction in an XML transfer report for CNY 10341.00 where the merchant's account settles in USD:

Copied!
<orderStatusEvent orderCode="ORDER_CODE"><!--Will contain the order code used in the request-->
  <payment>
    <paymentMethod>
      ALIPAY-SSL
    </paymentMethod>
    <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="1034100"/>
    <lastEvent>
      SETTLED
    </lastEvent>
    <balance accountType="SETTLED_BIBIT_NET">
      <amount currencyCode="USD" debitCreditIndicator="credit" exponent="2" value="162298"/>
    </balance>
  </payment>
  <journal description="1 CNY = 0.15695 USD" journalType="SETTLED">
    <bookingDate>
      <date dayOfMonth="17" hour="8" minute="39" month="4" second="22" year="2013"/>
    </bookingDate>
    <accountTx accountType="SETTLED_BIBIT_NET" batchId="66">
      <amount currencyCode="USD" debitCreditIndicator="credit" exponent="2" value="162298"/>
    </accountTx>
    <accountTx accountType="IN_PROCESS_CAPTURED" batchId="84">
      <amount currencyCode="CNY" debitCreditIndicator="debit" exponent="2" value="1034100"/>
    </accountTx>
  </journal>
</orderStatusEvent>

Refunded

Below is an example of a refunded transaction in an XML transfer report for CNY 12400.00 where the Merchants account settles in USD:

Copied!
<orderStatusEvent orderCode="ORDER_CODE"><!--Will contain the order code used in the request-->
  <payment>
    <paymentMethod>
      ALIPAY-SSL
    </paymentMethod>
      <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="1240000"/>
    <lastEvent>
      REFUNDED
    </lastEvent>
    <balance accountType="SETTLED_BIBIT_NET">
      <amount currencyCode="USD" debitCreditIndicator="debit" exponent="2" value="5319"/>
    </balance>
  </payment>
  <journal description="" journalType="REFUNDED">
    <bookingDate>
      <date dayOfMonth="17" hour="8" minute="39" month="4" second="22" year="2013"/>
    </bookingDate>
    <accountTx accountType="SETTLED_BIBIT_NET" batchId="66">
      <amount currencyCode="USD" debitCreditIndicator="debit" exponent="2" value="199280"/>
    </accountTx>
    <accountTx accountType="IN_PROCESS_CAPTURED" batchId="87">
      <amount currencyCode="CNY" debitCreditIndicator="credit" exponent="2" value="1240000"/>
    </accountTx>
  </journal>
</orderStatusEvent>