Alipay

Alipay is one of the leading 3rd 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.

This page specifies the messages of the P3 protocol supported by the PayServer when creating an Alipay transaction. Make sure to also make yourself familiar with the general protocol usage and message flow and message specification .






Execute Transaction

  • EXECUTE_TRANSACTION_REQUEST
  • EXECUTE_TRANSACTION_UPDATE
  • EXECUTE_TRANSACTION_RESPONSE

In order to accept Alipay as alternative payment method, use these 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 here

Update Data

Since executing transactions is a long running operation, the server provides the client with update messages which 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 receipt functionality.

Can we help you?

If you cannot find your answer, contact us and we'll get in touch with you soon.

© Copyright 2020 Payworks GmbH. Legal.