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": "s2ptest_k11",
    "Amount": 11,
    "Currency": "CNY",      
    "MethodID": 24,
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",      
    "TokenLifetime": 10,
    "Customer": {    
      "Email": "youremail@email.com"   
    },
    "BillingAddress": {
      "Country": "CN"
      },
    "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": 4710714,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20190715075533",
        "MerchantTransactionID": "s2ptest_k11",
        "OriginatorTransactionID": null,
        "Amount": "11",
        "Currency": "CNY",
        "CapturedAmount": null,
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": "",
        "MethodID": 24,
        "MethodOptionID": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30201,
        "NotificationDateTime": null,
        "Customer": {
            "MerchantCustomerID": null,
            "Email": "youremail@email.com",
            "FirstName": null,
            "LastName": null,
            "Gender": null,
            "SocialSecurityNumber": null,
            "Phone": null,
            "Company": null,
            "DateOfBirth": null
        },
        "BillingAddress": {
            "ID": 291,
            "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,
            "BIC": null,
            "PrepaidCard": null,
            "PrepaidCardPIN": null,
            "SerialNumbers": null,
            "Wallet": null,
            "ReferenceNumber": null,
            "PayerCountry": null,
            "PayerEmail": null,
            "PayerPhone": null,
            "BankCode": null,
            "BankName": null,
            "BankSortCode": null,
            "SocialSecurityNumber": null,
            "BillingCycleStart": null,
            "BillingCycleEnd": null,
            "UnsubscribeInstructions": null,
            "CustomerLoginID": null,
            "PaidAmount": null,
            "PaidCurrency": null,
            "ProviderExchangeRate": 0,
            "PayerBankAccountID": null
        },
        "ReferenceDetails": {
            "BankCode": null,
            "BankName": null,
            "EntityID": null,
            "EntityNumber": null,
            "ReferenceID": null,
            "ReferenceNumber": null,
            "SwiftBIC": null,
            "AccountCurrency": null,
            "AccountNumber": null,
            "AccountHolder": null,
            "IBAN": null,
            "AmountToPay": null,
            "QRCodeURL": "https://qr.alipay.com/bax04298omdb9ssnjhk560db",
            "Instructions": null,
            "BoletoURL": null
        },
        "CustomParameters": null,
        "PreapprovalID": null,
        "Status": {
            "ID": 1,
            "Info": "Open",
            "Reasons": null
        },
        "Fraud": null,
        "MethodTransactionID": null,
        "TokenLifetime": 10,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=22291D163D2F51BAAFA72C9B9A852D03.4710714"
    }
}

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": "s2ptest_k12",
    "Amount": 11,
    "Currency": "CNY",      
    "MethodID": 24,
    "ReturnURL": "http://demo.smart2pay.com/redirect.php",      
    "TokenLifetime": 10,
    "Customer": {    
      "Email": "youremail@email.com"   
    },
    "BillingAddress": {
      "Country": "China"
      },
    "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": 4710715,
        "SkinID": null,
        "ClientIP": null,
        "Created": "20190715080151",
        "MerchantTransactionID": "s2ptest_k12",
        "OriginatorTransactionID": null,
        "Amount": "11",
        "Currency": "CNY",
        "CapturedAmount": null,
        "ReturnURL": "http://demo.smart2pay.com/redirect.php",
        "Description": null,
        "MethodID": 24,
        "MethodOptionID": null,
        "IncludeMethodIDs": null,
        "ExcludeMethodIDs": null,
        "PrioritizeMethodIDs": null,
        "SiteID": 30201,
        "NotificationDateTime": "20190715080151",
        "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,
        "TokenLifetime": null,
        "Capture": null,
        "PreapprovalDetails": null,
        "RedirectURL": null
    }
}