Alipay Domestic

Introduction

Alipay Domestic logo

Alipay is China’s leading third-party online payment solution, providing an easy, safe, and secure way for millions of individuals and businesses to make and receive payments on the Internet. Alipay provides an escrow payment service that reduces transaction risk for online consumers. Shoppers have the ability to verify whether they are happy with goods they have purchased before releasing funds to the seller.

General Information

Payment Mode, Countries and Currencies

This table illustrates which payment mode Alipay Domestic belongs to. It also provides detailed information about the countries and currencies which are relevant for Alipay Domestic.

Payment Mode

Wallet

Countries

China

Currencies

CNY

Communication Formats

This table illustrates how Alipay Domestic notifications are encoded and which languages and methods can be used for requests and responses.

Requests/Responses

Format

XML, JSON, NVP

Methods

POST

IPN Encodements

Please follow the instructions given at Instant Payment Notification to set up IPN.

Transaction Types

For transaction type details which are not given here look at Appendix B: Transaction Types.

Transaction Type Link to the Sample

debit

See samples

refund-debit

Test Credentials

URL(s) Endpoints

For the transaction type debit.

https://api-test.wirecard.com/engine/rest/paymentmethods/

For the transaction types refund-debit and refund-request.

https://api-test.wirecard.com/engine/rest/payments/

Merchant Account ID (MAID)

3ed75e0a-d70a-421f-a047-c70ba54b9317

Username

16390-testing

Password

3!3013=D3fD8X7

Secret Key

Please contact merchant support for complete test credentials.

Workflow

Alipay Domestic _debit_ Workflow
Figure 16. debit Workflow
  1. Consumer adds items to shopping basket.

  2. Consumer selects Payment Method Alipay Domestic.

  3. Merchant initiates a debit transaction.

  4. Alipay Domestic responds with a redirection URL to the merchant.

  5. Merchant redirects consumer to Alipay Domestic.

  6. Consumer enters his account data and confirms the payment.

  7. Alipay Domestic processes the transaction.

  8. WPG receives transaction status.

  9. WPG sends transaction status to merchant and redirects the consumer to the merchant.

  10. Merchant receives the transaction’s status and displays the completion of the payment process to the consumer.

Fields

The fields required for Alipay are the same fields as the REST API Fields.

Samples

debit
XML
XML debit Request (Successful)
<?xml version="1.0" encoding="utf-8"?>
<payment xmlns="http://www.elastic-payments.com/schema/payment">
<payment-methods>
  <payment-method name="alipay" />
</payment-methods>
<merchant-account-id>3ed75e0a-d70a-421f-a047-c70ba54b9317</merchant-account-id>
<request-id>0e0e26c6-e414-4e17-8e52-e78cb07f0875</request-id>
<transaction-type>debit</transaction-type>
<requested-amount currency="CNY">0.1</requested-amount>
<order-number>181106090126081</order-number>
<order-detail>Test product 001</order-detail>
<ip-address>127.0.0.1</ip-address>
<locale>en</locale>
<account-holder>
  <first-name>John</first-name>
  <last-name>Doe</last-name>
  <email>john.doe@wirecard.com</email>
</account-holder>
<cancel-redirect-url>https://demoshop-test.wirecard.com/demoshop/#/cancel</cancel-redirect-url>
<success-redirect-url>https://demoshop-test.wirecard.com/demoshop/#/success</success-redirect-url>
<fail-redirect-url>https://demoshop-test.wirecard.com/demoshop/#/error</fail-redirect-url>
    <notifications>
        <notification url="add.your.url.here"/>
    </notifications>
</payment>
XML debit Response (Successful)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<payment xmlns="http://www.elastic-payments.com/schema/payment" xmlns:ns2="http://www.elastic-payments.com/schema/epa/transaction">
 <merchant-account-id>3ed75e0a-d70a-421f-a047-c70ba54b9317</merchant-account-id>
 <transaction-id>12ba0604-106e-454f-a4ca-d4f801dc56fa</transaction-id>
 <request-id>0e0e26c6-e414-4e17-8e52-e78cb07f0875</request-id>
 <transaction-type>debit</transaction-type>
 <transaction-state>success</transaction-state>
 <completion-time-stamp>2018-11-06T08:01:26.000Z</completion-time-stamp>
 <statuses>
  <status code="201.0000" description="The resource was successfully created." severity="information" />
 </statuses>
 <requested-amount currency="CNY">0.1</requested-amount>
 <account-holder>
  <first-name>John</first-name>
  <last-name>Doe</last-name>
  <email>john.doe@wirecard.com</email>
 </account-holder>
 <ip-address>127.0.0.1</ip-address>
 <order-number>181106090126081</order-number>
 <order-detail>Test product 001</order-detail>
 <notifications>
  <notification url="add.your.url.here"/>
 </notifications>
 <payment-methods>
  <payment-method url="https://mapi.alipay.com:443/gateway.do?sign_type=MD5&amp;partner=2088801766902304&amp;supplier=Testing-Alipay-Domestic-EE&amp;_input_charset=utf-8&amp;service=create_direct_pay_by_user&amp;notify_url=https%3A%2F%2Fapi-test.wirecard.com%2Fengine%2Fnotification%2Falipay%2F&amp;return_url=https%3A%2F%2Fapi-test.wirecard.com%2Fengine%2Fnotification%2Falipay%2Fredirect%2F12ba0604-106e-454f-a4ca-d4f801dc56fa%2F&amp;out_trade_no=12ba0604-106e-454f-a4ca-d4f801dc56fa&amp;payment_type=1&amp;subject=181106090126081&amp;total_fee=0.1&amp;buyer_email=john.doe%40wirecard.com&amp;seller_email=shuzhi_zsz%40126.com&amp;sign=56c20cd07e86b26df628548d9c8768ee" name="alipay" />
 </payment-methods>
 <cancel-redirect-url>https://demoshop-test.wirecard.com/demoshop/#/cancel</cancel-redirect-url>
 <fail-redirect-url>https://demoshop-test.wirecard.com/demoshop/#/error</fail-redirect-url>
 <success-redirect-url>https://demoshop-test.wirecard.com/demoshop/#/success</success-redirect-url>
 <locale>en</locale>
</payment>
XML debit Notification (Successful)
<?xml version="1.0" encoding="UTF-8"?>
<payment xmlns="http://www.elastic-payments.com/schema/payment" xmlns:ns2="http://www.elastic-payments.com/schema/epa/transaction">
 <merchant-account-id>3ed75e0a-d70a-421f-a047-c70ba54b9317</merchant-account-id>
 <transaction-id>169f2c5d-1104-4e18-9f66-34c1392f029f</transaction-id>
 <request-id>0e0e26c6-e414-4e17-8e52-e78cb07f0875</request-id>
 <transaction-type>debit</transaction-type>
 <transaction-state>success</transaction-state>
 <completion-time-stamp>2018-11-06T08:02:52.000Z</completion-time-stamp>
 <statuses>
  <status code="201.0000" description="alipay:The resource was successfully created." severity="information"/>
 </statuses>
 <requested-amount currency="CNY">0.100000</requested-amount>
 <parent-transaction-id>12ba0604-106e-454f-a4ca-d4f801dc56fa</parent-transaction-id>
 <account-holder>
  <first-name>John</first-name>
  <last-name>Doe</last-name>
  <email>john.doe@wirecard.com</email>
 </account-holder>
 <ip-address>127.0.0.1</ip-address>
 <order-number>181106090126081</order-number>
 <order-detail>Test product 001</order-detail>
 <notifications>
  <notification url="add.your.url.here"/>
 </notifications>
 <payment-methods>
  <payment-method name="alipay"/>
 </payment-methods>
 <api-id>---</api-id>
 <cancel-redirect-url>https://demoshop-test.wirecard.com/demoshop/#/cancel</cancel-redirect-url>
 <fail-redirect-url>https://demoshop-test.wirecard.com/demoshop/#/error</fail-redirect-url>
 <success-redirect-url>https://demoshop-test.wirecard.com/demoshop/#/success</success-redirect-url>
 <locale>en</locale>
 <iso>
  <pos-transaction-time>080252</pos-transaction-time>
  <pos-transaction-date>1106</pos-transaction-date>
 </iso>
 <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
  <SignedInfo>
   <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
   <SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
   <Reference URI="">
    <Transforms>
     <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
    </Transforms>
    <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
    <DigestValue>QiPD+eeyhx0XRQMD7wMw+Umh0CmseHF4xJhap2YG/YA=</DigestValue>
   </Reference>
  </SignedInfo>
  <SignatureValue>lafeRWvqTPv3eaCqb3JfqqEjkGPJwHxiGiGckjgTlMle3qrRDrjhXU+N4rBgOO4OYxhmFwh8YBgzGkS93s/347TksxB4xilgqqn84hp6UupkLAvggtDBZcYJ01Gl8VesUykRXIzLdIZYuiN1h+zZQ4bBqr2RIOWs8ekIKdzjNC7sO9M3TX8N/4edsvrF8l/aOFUmtY+ZDHlWwfVFesKFl7CzjJFX0vrpZxN4bFRV/zjAfXbNTF5kd0GrVR6kW6uezCTD0IT9D9hX5u1q9npc80YrNZfDdSdP2y7CM+mjwYS4CXQfdcKwPhKOtBmaMoT5ac1dlkHseA4siJzHK9tRguJVj1pBlgq/5tnT2Hpjtr/Y2QUSTQf7APdUp7RVOn6Qv7AsZyPe92iiE/p0o92KMlqAiZN2t4VPZ+G137g+K8ywNwHL/vhR+oSa9FPNQOyWzfLk0PS+H4kq8nd4XrUJCdFybmY4QC5VcivMDWqgXuAT3RbC/j+SSNM26kaGgdoZrfLb5ZFs8xLZ/IdhgspfLsDcPwb63CC8Hii7ZUI8NeN4J4D1fwQlm2vztIHHqoVgch1pyO8cIY1gJLpzlLvXtDkdd2pWWkWiOtOWsXO0fSIa2jHSTEPOk5fJwadxB0qoSJOZEibruIvIJfEvGjp6taJCfGhC7isILVN7fsM7yfs=</SignatureValue>
  <KeyInfo>
   <X509Data>
    <X509SubjectName>L=Ascheim,2.5.4.4=#130642617965726e,CN=api-test.wirecard.com,OU=Operations,O=Wirecard Technologies GmbH,C=DE</X509SubjectName>
    <X509Certificate>MIIF5DCCBMygAwIBAgICLHQwDQYJKoZIhvcNAQELBQAwWzELMAkGA1UEBhMCREUxETAPBgNVBAoTCFdpcmVjYXJkMTkwNwYDVQQDFDB3aXJlY2FyZC1EUS1NVUMtaW50ZXJuYWwtd2Vic2VydmljZS1pc3N1aW5nQ0FfMDIwHhcNMTcwMTEyMTM1OTI2WhcNMTkwMTEyMTM1OTI2WjCBijELMAkGA1UEBhMCREUxIzAhBgNVBAoTGldpcmVjYXJkIFRlY2hub2xvZ2llcyBHbWJIMRMwEQYDVQQLEwpPcGVyYXRpb25zMR4wHAYDVQQDExVhcGktdGVzdC53aXJlY2FyZC5jb20xDzANBgNVBAQTBkJheWVybjEQMA4GA1UEBxMHQXNjaGVpbTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKSkExBY8FjRcZdrxOuJF+HZY8+McQaOB8B0E/hTUhoclsF4OJNaMThje7R6w6OYWBMKpssGngHFaZv35rCo5XVUpJmjZa04ytxE72GKO/uP4yIR7ZBXZx42B22MFaJJZTgPRCCFd6jrz906BZ//CmEAmk5gKelfPxfWJgGyTX6xz7I9R/G57E1xNOuEihN0ma5Q2IhD71MPVseFIGazyfGbJD6rYYbeBbOQSGk//TL8sdRCn0BLcm4DH5oqcPxDKzkaBP4ohNkCWsxpLLS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K3lT/NUclST98BmCla4Jzm+roeOHTqlPz3gPRJiPsr3wdvM+FSAJ2MRdv3l77mTE3v3hjsVVMmShR3VwwpxCICl3mpMsSaJZLyJdOHwvnpXs1m9kESwPD3DQ3RAQ/OGa0pPxAkHaauog4DhPvr/nBQnWHd2Us5b/ep7LME9hZ8u3hu/Kc6Vk24c5p3WUOiyaTiw+Ym3QDXl1wBSl9DdM94KbmAAQ5D/FUqyQnSc4TpmYvJ+Iavag</X509Certificate>
   </X509Data>
  </KeyInfo>
 </Signature>
</payment>
XML debit Request (Failure)
<?xml version="1.0" encoding="utf-8"?>
<payment xmlns="http://www.elastic-payments.com/schema/payment">
  <payment-methods>
    <payment-method name="alipay" />
  </payment-methods>
  <merchant-account-id>3ed75e0a-d70a-421f-a047-c70ba54b9317</merchant-account-id>
  <request-id>35564b1f-242b-4209-9d8d-371c7d178a76</request-id>
  <transaction-type>debit</transaction-type>
</payment>
XML debit Response (Failure)
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<payment xmlns="http://www.elastic-payments.com/schema/payment" xmlns:ns2="http://www.elastic-payments.com/schema/epa/transaction">
  <merchant-account-id>3ed75e0a-d70a-421f-a047-c70ba54b9317</merchant-account-id>
  <request-id>35564b1f-242b-4209-9d8d-371c7d178a76</request-id>
  <transaction-type>debit</transaction-type>
  <transaction-state>failed</transaction-state>
  <statuses>
    <status code="400.1011" description="The Requested Amount has not been provided. Please check your input and try again." severity="error" />
  </statuses>
  <payment-methods>
    <payment-method name="alipay" />
  </payment-methods>
</payment>
NVP
NVP debit Request (Successful)
POST https://api-test.wirecard.com/engine/rest/paymentmethods/ HTTP/1.1Accept-Encoding: gzip,deflate
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Authorization: Basic dGVhbWNpdHk6dGVhbWNpdHk=
Accept: text/plain
Content-Length: 307
Host: sandbox-engine.thesolution.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

merchant_account_id=4fd7149f-14cd-4a67-a8cb-d54044504cc8&request_id=demo-9424&transaction_type=debit&requested_amount_currency=CNY&requested_amount=1.01&first_name=John&last_name=Doe&email=john.doe@wirecard.com&order_number=15957&order_detail=TestProduct&locale=en&ip_address=127.0.0.1&payment_method=alipay
NVP debit Response (Successful)
HTTP/1.1 201 CreatedServer: nginx
Date: Wed, 17 Jun 2015 13:58:46 GMT
Content-Length: 1181
Connection: keep-alive
Content-Language: en-US

order_number=15957&payment_method_url=https%3A%2F%2Fmapi.alipay.com%2Fgateway.do%3Fsign_type%3DMD5%26partner%3D2088101568358171%26_input_charset%3Dutf-8%26service%3Dcreate_direct_pay_by_user%26notify_url%3Dhttps%253A%252F%252Fsandbox-engine.thesolution.com%252Fengine%252Fnotification%252Falipay%252F%2B%26return_url%3Dhttps%253A%252F%252Fsandbox-engine.thesolution.com%252Fengine%252Fnotification%252Falipay%252Fredirect%252Ff86aa01d-14f8-11e5-87be-00163e5411b5%252F%26out_trade_no%3Df86aa01d-14f8-11e5-87be-00163e5411b5%26payment_type%3D1%26subject%3D15957%26total_fee%3D1.01%26buyer_email%3Djohn.doe%2540wirecard.com%26sign%3Dd8668eea74f6bd87a8d9e8458a8efc16&transaction_type=debit&locale=en&completion_time_stamp=20150617135845&status_code_1=201.0000&status_severity_1=information&transaction_state=success&transaction_id=f86aa01d-14f8-11e5-87be-00163e5411b5&first_name=John&merchant_account_id=4fd7149f-14cd-4a67-a8cb-d54044504cc8&ip_address=127.0.0.1&order_detail=TestProduct&request_id=demo-2664&requested_amount=1.01&requested_amount_currency=CNY&email=john.doe%40wirecard.com&status_description_1=The+resource+was+successfully+created.&last_name=Doe&payment_method=alipay&
NVP debit Notification (Successful)
Content-Type: text/plainX-Request-Id: 302e2bc6-6017-49f0-8525-6ecf32f6664d
Host: requestb.in
Content-Length: 782
User-Agent: Jakarta Commons-HttpClient/3.1
Total-Route-Time: 0
Payment.Request-Id: c21d76ed-1d3d-5eee-e64f-aa0f6bced54d
Notification.Url: http://requestb.in/11h0jul1
Connection: close
Connect-Time: 0
Breadcrumbid: ID-staging-tomcat-n102-36990-1434638258564-0-4025
Via: 1.1 vegur
Payment.Transaction-Id: 916d9ac8-16c2-11e5-87be-00163e5411b5

phone=1+555+555+5555&transaction_type=debit&locale=&status_severity_1=information&status_code_1=201.0000&completion_time_stamp=20150619203422&state=ON&transaction_state=success&city=Toronto&merchant_account_id=4fd7149f-14cd-4a67-a8cb-d54044504cc8&first_name=John&requested_amount_currency=CNY&status_description_1=alipay%3AThe+resource+was+successfully+created.&response_signature=dc72eb8184a9d6aa3914d6fb8753ab8b30ae633324ec08da7693e1ba71446370&street1=123+test&transaction_id=916d9ac8-16c2-11e5-87be-00163e5411b5&country=CA&ip_address=127.0.0.1&request_id=c21d76ed-1d3d-5eee-e64f-aa0f6bced54d&provider_transaction_reference_id=&requested_amount=1.010000&email=john.doe%40wirecard.com&provider_transaction_id_1=2012111319234154&postal_code=M4P1E8&last_name=Doe&authorization_code=&
NVP debit Request (Failure)
POST https://api-test.wirecard.com/engine/rest/paymentmethods/ HTTP/1.1Accept-Encoding: gzip,deflate
Content-Type: application/x-www-form-urlencoded
Authorization: Basic dGVhbWNpdHk6dGVhbWNpdHk=
Accept: text/plain
Content-Length: 312
Host: sandbox-engine.thesolution.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

merchant_account_id=7bc76f18-67f4-4080-943b-dbce27459aa5&request_id=demo-6835&transaction_type=debit&requested_amount_currency=&requested_amount=1.01&first_name=John&last_name=Doe&email=john.doe@wirecard.com&order_number=15957&order_detail=TestProduct&locale=en&ip_address=127.0.0.1&payment_method=alipay
NVP debit Response (Failure)
HTTP/1.1 201 CreatedServer: nginx
Date: Wed, 17 Jun 2015 19:35:25 GMT
Content-Length: 474
Connection: keep-alive
Content-Language: en-US

order_number=15957&transaction_type=debit&locale=en&status_code_1=400.1012&status_severity_1=error&transaction_state=failed&first_name=John&merchant_account_id=7bc76f18-67f4-4080-943b-dbce27459aa5&ip_address=127.0.0.1&order_detail=TestProduct&request_id=demo-6835&requested_amount=1.01&email=john.doe%40wirecard.com&status_description_1=The+Requested+Amount+Currency+has+not+been+provided.++Please+check+your+input+and+try+again.&last_name=Doe&payment_method=alipay&
NVP debit Notification (Failure)
Content-Type: text/plainX-Request-Id: 4c5a9b45-61cb-4d00-b00c-ec12f3314d29
Host: requestb.in
Content-Length: 807
User-Agent: Jakarta Commons-HttpClient/3.1
Total-Route-Time: 0
Payment.Request-Id: b084ff49-d7ed-dc11-70b5-285197d02677
Notification.Url: http://requestb.in/11h0jul1
Connection: close
Connect-Time: 1
Breadcrumbid: ID-staging-tomcat-n102-36990-1434638258564-0-4069
Via: 1.1 vegur
Payment.Transaction-Id: 0362410c-16c3-11e5-87be-00163e5411b5

phone=1+555+555+5555&transaction_type=debit&locale=&status_severity_1=error&status_code_1=500.1999&completion_time_stamp=20150619203733&state=ON&transaction_state=failed&city=Toronto&merchant_account_id=4fd7149f-14cd-4a67-a8cb-d54044504cc8&first_name=John&requested_amount_currency=CNY&status_description_1=alipay%3AThe+acquirer+returned+an+unknown+response.++Contact+Technical+Support.&response_signature=1ad9240967ddb2fa3cbae7cf9ea01037f59e3e795c674e9358e8af1d280016dc&street1=123+test&transaction_id=0362410c-16c3-11e5-87be-00163e5411b5&country=CA&ip_address=127.0.0.1&request_id=b084ff49-d7ed-dc11-70b5-285197d02677&provider_transaction_reference_id=&requested_amount=1.010000&email=john.doe%40wirecard.com&provider_transaction_id_1=2012111319234154&postal_code=M4P1E8&last_name=Doe&authorization_code=&
Custom URL: