Click here to search the entire website

Alipay: Example XML order

Example: Direct model

Select

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE paymentService PUBLIC '-//Bibit//DTD Bibit PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd">

<paymentService merchantCode="YOUR_MERCHANT_CODE" version="1.4"><!--Use your merchant code-->

  <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>

      </shopper>

      <statementNarrative>MERCHANT STATEMENT NARRATIVE</statementNarrative>

    </order>

  </submit>

</paymentService>

Note:  If you use the mobile optimised version of the existing Alipay integration, then the above code is identical, except you must change the payment method mask from ALIPAY-SSL to ALIPAYMOBILE-SSL.

Mandatory data

The following table lists the mandatory data that you must include in your order.

Parameter name Description

shopperEmailAddress

The email address of the shopper

Recommended data

Parameter name Description

statementNarrative

The statement narrative enables the merchant to define 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.

We recommend that merchants populate the statement narrative for Alipay as 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.

statementNarrative can be up to 50 characters long.

The following are valid characters which can be included in the statement narrative.

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

Alipay supports Chinese characters as well as English.

An example of how the statement narrative appears to the shopper within their Alipay account appears in the screenshot below:

Example: Hosted model

The following example shows an XML order request for the hosted payment pages integration.

To re-direct the shopper directly to the Alipay payment pages append the following 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

Select

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE paymentService PUBLIC "-//Bibit//DTD Bibit PaymentService v1//EN" "http://dtd.worldpay.com/paymentService_v1.dtd">

<paymentService version="1.4" merchantCode="YOUR_MERCHANT_CODE"> <!--Use your merchant code-->

  <submit>

<order orderCode="YOUR_ORDER_CODE" installationId="1234567"><!--Use a unique order code each time. Contact Worldpay if you haven't got an installationID-->

      <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>

    </order>

  </submit>

</paymentService>

Mandatory data

You do not have to submit any mandatory data for an XML order request in the hosted payment pages model specific to an Alipay payment.

Recommended data

Parameter name Description

statementNarrative

See above.

Payment outcomes

Successful payment

Scenario:

Shopper completes payment for CNY 1.00 on Alipay payment pages and Worldpay receive asynchronous authorisation from Alipay in 5 seconds.

Behaviour:

Successful 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

<?xml version="1.0" ?>

<!DOCTYPE paymentService PUBLIC '-//Bibit//DTD Bibit 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>

Notification Example

Scenario 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

<?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>

Notification Example

Scenario 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

<?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>

Notification Example

Cancellations

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

Invalid data entry

Scenario:

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
  • 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

Scenario:

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 at SHOPPER _CANCELLED

Notification Example:

No notification is generated.

Exception conditions

Scenario 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

<?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>

Notification Example

Scenario 2:

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

Scenario 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.

<?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>

Notification Example:

Scenario 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.

<?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>

Notification Example

Scenario 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.

<?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>

Notification Example

Transfer reports

Settled

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

<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>

Settled transaction

Refunded

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

<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>

Refunded transaction

About Alipay