Skip to content

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.

Scan QRcode

shell
POST
https://api.nihaopay.com/v1.2/transactions/scanqrcode

Request

shell
$ 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 ​

PropertyDescription
currency
Required
The 3-letter currency code. Currently, acceptable currencies are USD and JPY.
amount
Required
Amount as a positive integer of the minor unit of the currency. See Parameters Description.
vendor
Required
Transaction vendor. Currently, acceptable vendors are alipay , unionpayand wechatpay.
reference
Required
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.
items
Conditional
Order product item list, see Parameters Description.
buyer_identity_code
Required
Identification of Customer's QRcode or barcode.
client_ip
Required
Terminal IP, The IP of Merchant terminal device
description
Optional
Arbitrary string that you can set to be displayed on the card charge.
note
Optional
Arbitrary string as note to self regarding the transaction.

Response

json
{
  "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.

PropertyDescription
id
string
Transaction ID.
status
string
Transaction status. Either success, failure, or pending.
sys_reserve
string
NihaoPay reserved. json format. If status is success, return verdor's transaction id.
amount
int
Amount of the transaction in the minor unit of the currency. For example, cents in USD.
currency
string
The 3-letter currency code.
time
string
Timestamp of the transaction in UTC. Ex: 2015-01-01T01:01:00Z is Jan 1, 2015 1:01:00 UTC
reference
string
A reference number to track each transactions. If you did not provide this, a reference will be generated and returned to you.
note
string
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.

Show QRcode

The asynchronous message return to IPN URL is same with SecurePay.

shell
POST
https://api.nihaopay.com/v1.2/transactions/showqrcode

Request

shell
$ 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 ​

PropertyDescription
amount
Required
Amount as an integer of the minor unit of the currency. See Parameters Description.
currency
Required
The 3-letter currency code. Currently, acceptable currencies are USD and JPY.
reference
Required
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.
items
Conditional
Order product item list, see Parameters Description.
vendor
Required
Transaction vendor. Currently, acceptable vendors are alipay , unionpayand wechatpay.
ipn_url
Required
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.
timeout
Optional
Default: 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.
description
Optional
Arbitrary string that you can set to be displayed on the card charge.
note
Optional
Arbitrary string as note to self regarding the transaction.

Response

json
{
  "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.

PropertyDescription
code_url
string
The string of QR code url.
id
string
Transaction ID.
amount
int
Amount of the transaction in the minor unit of the currency. For example, cents in USD.
currency
string
The 3-letter currency code.
timeout
int
Within the specified minutes, code url will time out. If you did not provide this, default value will be returned to you.
reference
string
AlphaNumeric string set in request to correspond transaction ID with your original transaction request.
time
string
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 ​

shell
POST
https://api.nihaopay.com/v1.2/merchantqrcode

The 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

shell
$ 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 ​

PropertyDescription
trade_currency
Required
The 3-letter currency code. Currently, acceptable currencies are USD and JPY.
ipn_url
Optional
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_name
Required
Seller name, Displayed on payment page.
store_name
Required
Store name
store_no
Required
Store number

Response

json
{
  "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 ​

PropertyDescription
seller_name
string
Seller name
store_name
string
Store name
store_no
string
Store number
qrcode_img_url
string
QRcode image url.
qrcode
string
QRcode url.

​

Static QRcode Payment ​

shell
POST
https://api.nihaopay.com/v1.2/transactions/staticqrcode

NihaoPay 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

shell
$ 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 ​

PropertyDescription
amount
Required
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.
vendor
Required
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.
qrcode
Required
QRcode url,It's returned by Create a Static Omni-Channel QrCode.
reference
Optional
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.
items
Conditional
Order product item list, see Parameters Description.
callbacl_url
Optional
URL the browser will be redirected to upon completing the transaction.
description
Optional
Arbitrary string that you can set to be displayed on the card charge.

Response

json
{
  "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.

PropertyDescription
redirect_url
string
redirect url.

Static AliPay QRcode ​

shell
POST
https://api.nihaopay.com/v1.2/merchantqrcode

The 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

shell
$ 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 ​

PropertyDescription
trade_currency
Required
The 3-letter currency code. Currently, acceptable currencies are USD and JPY.
vendor
Required
Only: alipay.
ipn_url
Optional
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_name
Required
Seller name, Displayed on payment page.
store_name
Required
Store name
store_no
Required
Store number

Response

json
{
  "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 ​

PropertyDescription
seller_name
string
Seller name
store_name
string
Store name
store_no
string
Store number
qrcode_img_url
string
QRcode image with AliPay logo
qrcode
string
QRcode url.

Last Updated - 01/16/2025