Qrcode Payment

Introduction

Display a qrcode when checkout, user can use their mobile app scan this.

After the payment, the webpage will jump to result page automatically.

It's a good choice for PC website.

Flow

participant Customer
Customer->Merchant: 1. Create order
Merchant->scanforpay: 2. Create order
scanforpay->Payment\nPlatform: 3. Create order
Payment\nPlatform->scanforpay: 4. Retrun transacion\ninformations
scanforpay->Merchant: 5. Return the\npage to pay
Merchant->Customer: 6.Redirect to\nthe page, display the qrcode
Customer-->Payment\nPlatform: 7.Scan & Pay
Payment\nPlatform->scanforpay: 8.Callback
scanforpay->Merchant: 9.Callback
Merchant->Customer: 10.Return to merchant page,\nshow result
Payment\nPlatform-->scanforpay: 8.Notify the result asynchronously
scanforpay-->Merchant: 9. Notify the result asynchronously

Create Order API

Service URL

POST

https://pay.scanforpay.com/api/offline/qrcode
Name Parameter Type Required Description
Store ID storeNo String (15) Y Assigned by scanforpay
Merchant Order Number partnerOrderNo String (32) Y Generated by merchant
20180802100000001
Wallet wallet String (10) Y Wechat: Wechat Pay
Alipay: Alipay
Goods Amount goodsAmount int N The unit of the transaction amount is the smallest unit of the currency
If the currency is RMB, the unit is Fen. So if the transaction amount is 1 Yuan, 100 should be passed;if curreny is JPY, the unit is Japanese Yen
Extra Amount goodsExtraAmount int N The unit of the transaction amount is the smallest unit of the currency
If the currency is RMB, the unit is Fen. So if the transaction amount is 1 Yuan, 100 should be passed;if curreny is JPY, the unit is Japanese Yen
Currency currency String (10) Y
Transaction Amount orderAmount int Y The unit of the transaction amount is the smallest unit of the currency
If the currency is RMB, the unit is Fen. So if the transaction amount is 1 Yuan, 100 should be passed;if curreny is JPY, the unit is Japanese Yen
Transaction description orderTitle String(100) N Transaction description
Operator ID operatorId String(20) N 100001
Terminal ID terminalNo String(20) N 100002
Notify Url notifyUrl String(200) N System will call this url when payment succeed.
If this is empty, system will not notify the result
Callback Url returnUrl String(200) N This page will be called after customers pay successfully or cancel the transation
QR code expiration time it_b_pay String(10) N Specifies the time period in which the user can complete the payment from the moment when the user scans the QR code. The trade is closed automatically once the time is up. The value of this field is 3m by default. The value of this field is in the range of 1m - 15d.
Notes:
1、The following abbreviations are used to present units of time:
m: minute
h: hour
d: day
c: current day (Whenever the trade is created, it will be closed at 0:00).
2、Decimal point of the numerical value of this parameter is rejected, for example, 1.5h need to be transformed to 90m.
Example:1d
QR code expiration time qr_code_it_b_pay String(10) N Specifies the time period in which the user can complete the payment from the moment when the QR code was created. The trade is closed automatically once the time is up.The value of this field is in the range of 1m - 2h. If this parameter is specified, the it_b_pay parameter becomes invalid.
Notes:
1、The following abbreviations are used to present units of time:
m: minute
h: hour
2、Decimal point of the numerical value of this parameter is rejected, for example, 1.5h need to be transformed to 90m.
Example:1m
Sample
{
    "request": {
        "header": {
            "requestTime": "2018-07-25T18:06:05+08:00",
            "partnerNo": "10001",
            "signType": "SHA256",
            "version": "1.0",
            "reqMsgId": "fd03f269-3180-4575-8af0-8f6cf324fb0f"
        },
        "body": {
            "storeNo": "100010000000002",
            "partnerOrderNo": "p20180725180605466813",
            "wallet": "Alipay",
            "currency":"HKD",
            "orderAmount": 2100,
            "orderTitle": "Consume",
            "operatorId": "211918",
            "terminalNo": "123456",
            "notifyUrl": "http://192.168.31.72:8080/ScanForPay/notify",
            "returnUrl": "http://192.168.31.72:8080/ScanForPay/return"
        }
    },
    "signature": "2d2d5c66a67a24b5e13705cc38f34d93c395a7d9e0e4ff9425c9ce07b806a1cc"
}
Response body
Name Parameter Type Required Description
Response code code int(5) Y 1:success,Others: Fail
Response message msg varchar (100) Y Response message
Pay Url payUrl varchar(200) Y Generated by scanforpay. After created the order, user will be redirected the page to pay
Sample
Successful response sample
{
    "response": {
        "header": {
            "partnerNo": "10001",
            "respTime": "2018-07-25T18:06:12+08:00",
            "signType": "SHA256",
            "version": "1.0",
            "reqMsgId": "213ca19e-c75f-450d-9acf-46e860570bb9"
        },
        "body": {
            "code": 1,
            "msg": "success",
            "payUrl ": "https://www.scanforpay.com/api/online/pay/5a421395def7ffdsa610f2"
        }
    },
    "signature": "0710b2630b467c14b3d54295def7f89be61097c21472547823b43c58f3466b08"
}
Failed response sample
{
    "response": {
        "header": {
            "partnerNo": "10001",
            "respTime": "2018-07-25T17:37:14+08:00",
            "signType": "SHA256",
            "version": "1.0",
            "reqMsgId": "c11fe1c7-069b-4399-be00-31830a5de63d"
        },
        "body": {
            "code": 30
            "msg": "Order not exist",
        }
    },
    "signature": "5719065ecea463366cbf39b728b9b8cba940365c0c053dd96effde57f7edc1f8"
}
Callback

When a user finishes the payment, scanforpay will call the returnUrl with POST parameters as below:

Name Parameter Type Required Description
Partner Order Number partnerOrderNo String(32) Y Generated by merchant

After receiving the callback, merchant should call Pay Query to verify whether this payment is done.

Meanwhile, scanforpay will push result to the merchant's server asynchronously, more detail in Notify

results matching ""

    No results matching ""