Alipay POS Payment Request

Definition: POST https://paytest.smart2pay.com/v1/payments

Below you will find a full example of a payment request for Alipay POS method (with Success and Bad response). The parameters of the payment are sent in the message body as a JSON object.

For Alipay POS payments the following Details parameters are mandatory to be sent in the request:

  • IsOffline – Offline payment method;
  • StoreName – Store name. Can be null only when the store information is verified;
  • StoreId – Store ID;
  • TerminalID – POS Terminal ID.

A 201 HTTP response (Created) is returned if the payment was correctly initialized.

For more information about status codes, please go to Basic HTTP Status Codes.

Request:

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
    "Payment": {
        "MerchantTransactionID": "AlipayPlus-{{$timestamp}}",
        "Amount": 100,
        "Currency": "CNY",
        "MethodID": 24,
        "ReturnURL": "https://demo2.smart2pay.com/redirect.php",
        "TokenLifetime": 10,
        "BillingAddress": {
            "Country": "CN"
        },
        "Customer": {
            "Email": "test_s2p@test.com",
            "FirstName": "Test",
            "LastName": "Test",
            "Phone": "00000000"
        },
        "Details": {    
      "IsOffline": true,
      "StoreName": "Zara Palace Mall",
      "StoreId": "ZA2345",
      "TerminalID": "T8999"
    }
    }
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": 6883549,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20240321085116",
        "MerchantTransactionID": "AlipayPlus-1711011077",
        "OriginatorTransactionID": null,
        "Amount": "100",
        "Currency": "CNY",
        "CapturedAmount": null,
        "ReturnURL": "https://demo2.smart2pay.com/redirect.php",
        "ReturnURLSuccess": null,
        "ReturnURLFailure": null,
        "ReturnURLCancel": null,
        "ReturnURLProcessing": null,
        "Description": "",
        "MethodID": 24,
        "MethodOptionID": null,
        "MethodOptionIdString": null,
        "BankName": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30563,
        "NotificationDateTime": null,
        "Customer": {
            "MerchantCustomerID": null,
            "Email": "test_s2p@test.com",
            "FirstName": "Test",
            "LastName": "Test",
            "Gender": null,
            "SocialSecurityNumber": null,
            "Phone": "00000000",
            "Company": null,
            "DateOfBirth": null
        },
        "BillingAddress": {
            "City": null,
            "ZipCode": null,
            "State": null,
            "Street": null,
            "StreetNumber": null,
            "HouseNumber": null,
            "HouseExtension": null,
            "Country": "CN"
        },
        "ShippingAddress": null,
        "Articles": null,
        "Details": {
            "AccountNumber": null,
            "AccountHolder": null,
            "IBAN": null,
            "Address": null,
            "BIC": null,
            "PrepaidCard": null,
            "PrepaidCardPIN": null,
            "ConfirmationCode": null,
            "Store": null,
            "SerialNumbers": null,
            "Wallet": null,
            "ReferenceNumber": null,
            "PayerCountry": null,
            "PayerEmail": null,
            "PayerPhone": null,
            "BankCode": null,
            "Pin": null,
            "BankName": null,
            "BankSortCode": null,
            "BankAccountNumber": null,
            "SocialSecurityNumber": null,
            "BillingCycleStart": null,
            "BillingCycleEnd": null,
            "UnsubscribeInstructions": null,
            "CustomerLoginID": null,
            "PaidAmount": null,
            "PaidCurrency": null,
            "ProviderExchangeRate": 0.0,
            "ProviderBlockChain": null,
            "PayerBankAccountID": null,
            "PayerID": null,
            "CryptoAmount": null,
            "CryptoCurrency": null,
            "CryptoAddress": null,
            "AvailableBalance": null,
            "CurrentBalance": null,
            "Installments": null
        },
        "ReferenceDetails": {
            "BankCode": null,
            "BankName": null,
            "EntityID": null,
            "EntityNumber": null,
            "ReferenceID": null,
            "ReferenceNumber": null,
            "SwiftBIC": null,
            "AccountCurrency": null,
            "AccountNumber": null,
            "AccountHolder": null,
            "IBAN": null,
            "Address": null,
            "AmountToPay": null,
            "QRCodeURL": "https://qr.alipayplus.com/showQrImage?code=281666040092tDqC8ZCNM7QoFo49S3Ev4Z0I&picSize=M",
            "Instructions": null,
            "BoletoURL": null,
            "SortCode": null
        },
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 1,
            "Info": "Open",
            "Reasons": null
        },
        "Fraud": null,
        "MethodTransactionID": "20240321190741010003H0005811115",
        "OriginalMerchantTID": null,
        "Unknown": false,
        "TokenLifetime": 10,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": "https://webapp-apm-globalpay-api-qa.nuvei.com/Home?PaymentToken=E3E8959BED00BC85C70EFE666EF40D29.6883549",
        "Splits": null
    }
}

In case of an API error, an HTTP 4xx (you did something wrong) or HTTP 5xx (we did something wrong) response is returned.

For more information about the reasons of a wrong request response see our section GlobalPay Return Codes.

Request:

POST https://paytest.smart2pay.com/v1/payments
Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

{
    "Payment": {
        "MerchantTransactionID": "AlipayPlus-{{$timestamp}}",
        "Amount": 100,
        "Currency": "CNY",
        "MethodID": 24,
        "ReturnURL": "https://demo2.smart2pay.com/redirect.php",
        "TokenLifetime": 10,
        "BillingAddress": {
            "Country": "China"
        },
        "Customer": {
            "Email": "test_s2p@test.com",
            "FirstName": "Test",
            "LastName": "Test",
            "Phone": "00000000"
        },
        "Details": {    
      "IsOffline": true,
      "StoreName": "Zara Palace Mall",
      "StoreId": "ZA2345",
      "TerminalID": "T8999"
    }
    }
}

Response:

HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8

{
    "Payment": {
        "ID": 6883560,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20240321090237",
        "MerchantTransactionID": "AlipayPlus-1711011757",
        "OriginatorTransactionID": null,
        "Amount": "100",
        "Currency": "CNY",
        "CapturedAmount": null,
        "ReturnURL": "https://demo2.smart2pay.com/redirect.php",
        "ReturnURLSuccess": null,
        "ReturnURLFailure": null,
        "ReturnURLCancel": null,
        "ReturnURLProcessing": null,
        "Description": null,
        "MethodID": 24,
        "MethodOptionID": null,
        "MethodOptionIdString": null,
        "BankName": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30563,
        "NotificationDateTime": "20240321090237",
        "Customer": null,
        "BillingAddress": null,
        "ShippingAddress": null,
        "Articles": null,
        "Details": null,
        "ReferenceDetails": null,
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 4,
            "Info": "Failed",
            "Reasons": [
                {
                    "Code": "147",
                    "Info": "Address details are invalid (BillingAddress)Country - RegEx: ^[a-zA-Z]{2}$;"
                }
            ]
        },
        "Fraud": null,
        "MethodTransactionID": null,
        "OriginalMerchantTID": null,
        "Unknown": false,
        "TokenLifetime": null,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": null,
        "Splits": null
    }
}

Alipay POS Test Data

For Alipay payment method there aren’t any test data available, but you can see how it works with the payment flow given below.

Alipay POS Payment Flow

    1. The Customer selects his preferred currency from the list and continues the payment.1 Select currency

You can skip this step by sending in the initial POST the following parameters: SkipHPP=1 and CustomerEmail.

  1. The Customer is redirected to Alipay payment page. The Customer opens Alipay application and scans the QR code.1 Payment version
  2. The payment details are displayed on the client’s Alipay app on their smartphone; the customer confirms the payment by pressing Pay now.
  3. Upon completion of the payment flow, the customer is redirected back to your ReturnURL by pressing the Return to Merchant button1 Return page when the redirection status is Processing