Alipay
Alipay is one of the leading third-party service payment provider in China. With more than
450M active users, your merchants can accept Alipay wallets by scanning the
customer's code with your external barcode scanner.
The following PayProtocol (P3) messages are supported by the PayServer when creating an
Alipay transaction. Also see protocol usage and message flow and message
specification .
Execute Transaction
- EXECUTE_TRANSACTION_REQUEST
- EXECUTE_TRANSACTION_UPDATE
- EXECUTE_TRANSACTION_RESPONSE
To accept Alipay as alternative payment method, use the following
messages to execute transactions:
Request Data
{ "type": "EXECUTE_TRANSACTION_REQUEST", "resource": "", "tag": "alipay", "executeTransactionRequest": { "mode": "ONLINE", "transactionParameters": { "type": "CHARGE", "workflow": "ALTERNATIVE_PAYMENT_METHOD", "amount": 5.0, "currency": "EUR", "autoCapture": true }, "accountParameters": { "shopperAccountIdentifier": "shopperId", "source": "QR_CODE", "scheme": "ALIPAY" } } }
You need to provide the
accountParameters
along with the
transactionParameters
. Make sure to provide
shopperAccountIdentifier
(code scanned from
the customer's mobile app), source
and
scheme
. For refunds you can use the
AMEND_TRANSACTION messages which can be found in Message Specification.Update Data
Since executing transactions is a long-running operation, the server
provides the client with update messages that inform about the
current state of the transaction process.
{ "type": "EXECUTE_TRANSACTION_UPDATE", "resource": "", "tag": "alipay", "status": "OK", "executeTransactionUpdate": { "state": "PROCESSING", "stateDetails": "PROCESSING", "information": ["Processing payment...", ""], "abortable": false, "transaction": { "amount": 5.0, "currency": "EUR", "type": "CHARGE", "captured": false, "details": {}, "paymentDetails": { "scheme": "UNKNOWN", "source": "UNKNOWN", "customerVerification": "UNKNOWN" }, "refundDetails": {}, "status": "INITIALIZED", "identifier": "ef914db9632a448a82a918bc7f359c21", "createdTimestamp": 0, "cardDetails": { "expiryMonth": 0, "expiryYear": 0 }, "shopperDetails": {}, "mode": "ONLINE", "dccDetails": { "status": "NOT_AVAILABLE", "statusDetails": "NOT_AVAILABLE", "convertedCurrency": "UNKNOWN" } } } }
Response Data
Receiving an execute transaction response means that the long -running
operation is over and there will be no more related updates.
{ "type": "EXECUTE_TRANSACTION_RESPONSE", "resource": "", "tag": "alipay", "status": "OK", "executeTransactionResponse": { "state": "APPROVED", "stateDetails": "APPROVED", "information": ["Payment approved", ""], "transaction": { "amount": 5.0, "currency": "EUR", "type": "CHARGE", "captured": true, "details": {}, "paymentDetails": { "scheme": "ALIPAY", "source": "QR_CODE", "customerVerification": "NONE", "maskedAccountNumber": "shopperId" }, "refundDetails": {}, "status": "APPROVED", "identifier": "ef914db9632a448a82a918bc7f359c21", "createdTimestamp": 0, "cardDetails": { "expiryMonth": 0, "expiryYear": 0 }, "shopperDetails": {}, "mode": "ONLINE", "dccDetails": { "status": "NOT_AVAILABLE", "statusDetails": "NOT_AVAILABLE", "convertedCurrency": "UNKNOWN" } } } }
The
transaction
object has the
same structure in all transaction-related updates and
responses (Get Transaction, Query Transactions, Execute
Transaction, Amend Transaction).In order to generate
custom receipts, please make sure you are familiar with our custom receipt functionality.