In-Store Payment
Scan QRcode
Face-to-face merchant may scan the QRcode or Barcode on customer's phone to get paid for an order instead of having the customer to pay by cash or card. Merchant can use scanning guns, mobile devices with app or mPOS terminals with camera for scanning.
The figure illustrates the work flow of the Scan QRcode payment solution.

POST
https://api.nihaopay.com/v1.2/transactions/scanqrcodeRequest
$ curl https://api.nihaopay.com/v1.2/transactions/scanqrcode \
-H "Authorization: Bearer <TOKEN>" \
-d amount=100 \
-d currency="USD" \
-d vendor="alipay" \
-d reference="alipay201705030002" \
-d buyer_identity_code="288463639882104202" \
-d client_ip="184.167.25.158" \
-d note="alipay" \
-d description="Scan AliPay QrCode"Request
| Property | Description |
|---|---|
currencyRequired | The 3-letter currency code. Currently, acceptable currencies are USD and JPY. |
amountRequired | Amount as a positive integer of the minor unit of the currency. See Parameters Description. |
vendorRequired | Transaction vendor. Currently, acceptable vendors are alipay , unionpayand wechatpay. |
referenceRequired | An alphanumeric string up to 30 characters that must be unique to each of your transactions. This allows you to keep track of transactions when data comes back through IPN and Callback URLs. See Parameters Description. |
itemsConditional | Order product item list, see Parameters Description. |
buyer_identity_codeRequired | Identification of Customer's QRcode or barcode. |
client_ipRequired | Terminal IP, The IP of Merchant terminal device |
descriptionOptional | Arbitrary string that you can set to be displayed on the card charge. |
noteOptional | Arbitrary string as note to self regarding the transaction. |
Response
{
"amount": 12,
"id": "20170519093105011337",
"time": "2017-05-19T09:31:05Z",
"status": "success",
"sys_reserve": "{'vendor_id':'2018031421001004970502155891'}",
"note": "123456789",
"reference": "alipay201705030004",
"currency": "USD"
}Response
Returns a transaction object.
| Property | Description |
|---|---|
idstring | Transaction ID. |
statusstring | Transaction status. Either success, failure, or pending. |
sys_reservestring | NihaoPay reserved. json format. If status is success, return verdor's transaction id. |
amountint | Amount of the transaction in the minor unit of the currency. For example, cents in USD. |
currencystring | The 3-letter currency code. |
timestring | Timestamp of the transaction in UTC. Ex: 2015-01-01T01:01:00Z is Jan 1, 2015 1:01:00 UTC |
referencestring | A reference number to track each transactions. If you did not provide this, a reference will be generated and returned to you. |
notestring | If set in request, your transaction note to self. Else if not set, this will be null. |
Show QRcode
Merchant's backend system request show QRcode API in order to generate an advance transaction and gets code_url. Merchant's backend creates a QR Code based on code_url and show on wetsite or other devices. The customer scans the QR Code, enters their payment password and completes the transaction.
Upon completing the transaction, the API will return asynchronous message to the IPN url. Merchant can request Look up a transaction if no message is received.
The figure illustrates the work flow of the Show QRcode payment solution.

The asynchronous message return to IPN URL is same with SecurePay.
POST
https://api.nihaopay.com/v1.2/transactions/showqrcodeRequest
$ curl https://api.nihaopay.com/v1.2/transactions/showqrcode \
-H "Authorization: Bearer <TOKEN>" \
-d amount=100 \
-d currency="USD" \
-d vendor="alipay" \
-d reference="jkh25jh1348fd89sg" \
-d ipn_url="http://website.com/ipn"Request
| Property | Description |
|---|---|
amountRequired | Amount as an integer of the minor unit of the currency. See Parameters Description. |
currencyRequired | The 3-letter currency code. Currently, acceptable currencies are USD and JPY. |
referenceRequired | An alphanumeric string up to 30 characters that must be unique to each of your transactions. This allows you to keep track of transactions when data comes back through IPN and Callback URLs. |
itemsConditional | Order product item list, see Parameters Description. |
vendorRequired | Transaction vendor. Currently, acceptable vendors are alipay , unionpayand wechatpay. |
ipn_urlRequired | Instant Payment Notification URL. Called by the API to update you on transaction information. This is where the response goes to. See Instant Payment Notification. |
timeoutOptionalDefault: 120 | Specifies amount of minutes card holders have before payment page times out. Once the page times out without a successful payment, the transaction is automatically cancelled. Acceptable values are 1 - 1440. |
descriptionOptional | Arbitrary string that you can set to be displayed on the card charge. |
noteOptional | Arbitrary string as note to self regarding the transaction. |
Response
{
"code_url": "https://qr.alipay.com/bax02617gyevjsjqxgoz2038",
"id": "20170519093828105112",
"timeout": 120,
"currency": "USD",
"amount": 100,
"reference": "20170427-137-0011",
"time": "2017-05-19T09:38:28Z"
}Response
Returns a QRcode object.
| Property | Description |
|---|---|
code_urlstring | The string of QR code url. |
idstring | Transaction ID. |
amountint | Amount of the transaction in the minor unit of the currency. For example, cents in USD. |
currencystring | The 3-letter currency code. |
timeoutint | Within the specified minutes, code url will time out. If you did not provide this, default value will be returned to you. |
referencestring | AlphaNumeric string set in request to correspond transaction ID with your original transaction request. |
timestring | Timestamp of the transaction in UTC. Ex: 2015-01-01T01:01:00Z is Jan 1, 2015 1:01:00 UTC |
Static Omni-Channel QRcode
Create a Static Omni-Channel QRcode
POST
https://api.nihaopay.com/v1.2/merchantqrcodeThe payment solution is making use of a static QR code to represent the account of a merchant. In this solution, the customer needs to scan and the input the amount to complete the payment of transaction.
Merchant requests static QRcode API in order to generate a static QRcode. Merchant creates a QR Code based on qrcode, then prints and posts the QRcode image in merchant's store. The customer scans the QRcode, enters payment amount and completes the transaction on his or her phone.
Upon transaction completion, the API will return an asynchronous message to the IPN url.
The asynchronous message return to IPN URL is the same with SecurePay.
Request
$ curl https://api.nihaopay.com/v1.2/merchantqrcode \
-H "Authorization: Bearer <TOKEN>" \
-d ipn_url="http://website.com/ipn" \
-d trade_currency="USD" \
-d seller_name="NihaoPay" \
-d store_name="LA Branch" \
-d store_no="B001"Request
| Property | Description |
|---|---|
trade_currencyRequired | The 3-letter currency code. Currently, acceptable currencies are USD and JPY. |
ipn_urlOptional | Instant Payment Notification URL. Called by the API to update you on transaction information. This is where the response goes to. See Instant Payment Notification. |
seller_nameRequired | Seller name, Displayed on payment page. |
store_nameRequired | Store name |
store_noRequired | Store number |
Response
{
"seller_name": "NihaoPay",
"store_name": "LA Branch",
"store_no": "B001",
"qrcode_img_url": "https://apitest.nihaopay.com/merqrcode/9b2487be23a3434b9eb62870fcb73680",
"qrcode": "https://apitest.nihaopay.com/topayment/9b2487be23a3434b9eb62870fcb73680"
}Response
| Property | Description |
|---|---|
seller_namestring | Seller name |
store_namestring | Store name |
store_nostring | Store number |
qrcode_img_urlstring | QRcode image url. |
qrcodestring | QRcode url. |
Static QRcode Payment
POST
https://api.nihaopay.com/v1.2/transactions/staticqrcodeNihaoPay provides standard payment page for Omni-channel QRcode. In order for merhcants to display their brands on payment page, NihaoPay supports the merchant build H5 payment page corresponding to the QRcode. When customer confirms payment, the following payment interface will wake up WechatPay or AliPay wallet.
Request
$ curl https://api.nihaopay.com/v1.2/transactions/staticqrcode \
-H "Authorization: Bearer <TOKEN>" \
-d amount=100 \
-d vendor="alipay" \
-d reference="201705030002" \
-d qrcode="https://apitest.nihaopay.com/topayment/9b2487be23a3434b9eb62870fcb73680" \
-d callback_url="https://nihaopay.com" \
-d description="static QrCode"Request
| Property | Description |
|---|---|
amountRequired | Amount as a positive integer of the minor unit of the currency. If amount is not null, it means the transaction uses foreign currency. See Parameters Description. |
vendorRequired | The payment method is determined based on the APP used by the customer to scan the QR code. If WeChat APP, it's wechatpay,If AliPay wallet,it's alipay. |
qrcodeRequired | QRcode url,It's returned by Create a Static Omni-Channel QrCode. |
referenceOptional | An alphanumeric string up to 30 characters that must be unique to each of your transactions. This allows you to keep track of transactions when data comes back through IPN and Callback URLs. See Parameters Description. |
itemsConditional | Order product item list, see Parameters Description. |
callbacl_urlOptional | URL the browser will be redirected to upon completing the transaction. |
descriptionOptional | Arbitrary string that you can set to be displayed on the card charge. |
Response
{
"redirect_url": "https://wxcode.nihaopay.com/wechatpay/openid?txnId=20180314095142025479"
}Response
When request is successful, the interface will return a page redirect url, redirecting page to this address, and automatically wakes up the payment function by APP.
| Property | Description |
|---|---|
redirect_urlstring | redirect url. |
Static AliPay QRcode
POST
https://api.nihaopay.com/v1.2/merchantqrcodeThe payment solution makes use of a static QR code to represent the account of a merchant. In this solution, the customer needs to scan and then input the amount to complete the payment of transaction.
Merchant's requests static QRcode API in order to generate a static QRcode. Merchant creates a QR Code based on qrcode, then prints and posts the QRcode image in merchant's store. The customer scans the QRcode use AliPay APP, enters payment amount and completes the transaction on his or her phone.
Upon transaction completion, the API will return an asynchronous message to the IPN url.
The asynchronous message returned to IPN URL is same with SecurePay.
Request
$ curl https://api.nihaopay.com/v1.2/merchantqrcode \
-H "Authorization: Bearer <TOKEN>" \
-d ipn_url="http://website.com/ipn" \
-d trade_currency="USD" \
-d seller_name="NihaoPay" \
-d store_name="LA Branch" \
-d store_no="B001"Request
| Property | Description |
|---|---|
trade_currencyRequired | The 3-letter currency code. Currently, acceptable currencies are USD and JPY. |
vendorRequired | Only: alipay. |
ipn_urlOptional | Instant Payment Notification URL. Called by the API to update you on transaction information. This is where the response goes to. See Instant Payment Notification. |
seller_nameRequired | Seller name, Displayed on payment page. |
store_nameRequired | Store name |
store_noRequired | Store number |
Response
{
"seller_name": "NihaoPay",
"store_name": "LA Branch",
"store_no": "B001",
"qrcode_img_url": "https://mobilecodec.alipay.com/show.htm?code=ocx09459xspxxdajnvzik3d",
"qrcode": "https://qr.alipay.com/ocx09459xspxxdajnvzik3d"
}Response
| Property | Description |
|---|---|
seller_namestring | Seller name |
store_namestring | Store name |
store_nostring | Store number |
qrcode_img_urlstring | QRcode image with AliPay logo |
qrcodestring | QRcode url. |
