Skip to content

线下面对面支付 ​

扫码支付 ​

Scan QRcode

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

请求示例

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"

请求报文 ​

参数说明
currency
不为空
订单币种,3位货币代码. 扫码支付支持的币种有:USD 美元 和 JPY 日元。
amount
不为空
订单金额,金额为对应货币中的最小单位。详见接口规则
vendor
不为空
付款方式,客户付款时选择的支付方式,目前支持支付宝 alipay,微信支付wechatpay和银联unionpay。
reference
不为空
商户订单号,1-30位的字母,数字和'-'组合,必须在商户系统中唯一。详见接口规则
items
允许为空
订单商品列表,详见接口规则。
buyer_identity_code
不为空
客户付款二维码或者条形码的信息
client_ip
不为空
终端IP,调用API的终端设备的IP
description
允许为空
订单描述,可以订单商品信息摘要等,会显示在支付页面和客户付款收据中。
note
允许为空
供商家使用的备注字段,NihaoPay不做处理,在返回时,原数据将返回给商户。

返回示例

json
{
  "amount": 12,
  "id": "20170519093105011337",
  "time": "2017-05-19T09:31:05Z",
  "status": "success",
  "note": "123456789",
  "sys_reserve": "{'vendor_id':'2018031421001004970502155891'}",
  "reference": "alipay201705030004",
  "currency": "USD"
}

返回报文 ​

字段说明
id
string
NihaoPay生成的唯一交易流水号.
status
string
交易状态. 包括:支付成功 success, 支付失败failure, 支付中pending, 交易关闭closed.
sys_reserve
string
系统备用字段。返回Json格式的字符串,如果支付成功,返回渠道的交易流水号。
amount
int
订单金额.
currency
string
订单币种.
time
string
交易在NihaoPay系统中的完成时间. 例如: 2015-01-01T01:01:00Z(NihaoPay使用的是UTC时区).
reference
string
商户订单号.
note
string
商户备注,与请求一致,如果请求是为空,则该字段为 null.

展示交易二维码 ​

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

商户请求该接口获得一个包含二维码URL的json对象,将URL使用二维码生成软件生成一个图片格式的二维码展示在商户的收款终端上,客户打开微信或者支付宝,使用”扫一扫"扫描二维码,并完成支付。一旦客户付款成功,NihaoPay将发送异步通知到商户的IPN URL。商户也可以请求查询接口,获取订单的支付结果。

Show QRcode

请求示例

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"

请求报文 ​

字段说明
amount
不为空
订单金额,金额为对应货币中的最小单位。详见接口规则
currency
不为空
订单币种,3位货币代码. 该产品支持的币种有:USD 美元和 JPY 日元。
vendor
不为空
付款方式,客户付款是选择的支付方式,目前支持支付宝 alipay,微信支付wechatpay和银联unionpay。
reference
不为空
商户订单号,1-30位的字母,数字和’-‘组合,必须在商户系统中唯一。
items
允许为空
订单商品列表,详见接口规则。
ipn_url
不为空
支付通知接收的URL。详见异步通知
timeout
允许为空
默认:120
订单超时时间,在NihaoPay接受到订单请求后,如果在timeout(分钟)指定的时间内,客户未付款的,订单将会被关闭。接受的范围为1 - 1440(1天)。
description
允许为空
订单描述,可以订单商品信息摘要等,会显示在支付页面和客户付款收据中。
note
允许为空
供商家使用的备注字段,NihaoPay不做处理,在返回时,原数据将返回给商户。

返回示例

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"
}

返回报文 ​

字段说明
code_url
string
二维码URL
id
string
NihaoPay生成的唯一交易ID
amount
int
订单金额。
currency
string
订单币种
timeout
int
二维码的有效时间(分钟),超过该时间,二维码将失效。
reference
string
商户订单号
time
string
交易在NihaoPay系统中的时间. 例如: 2015-01-01T01:01:00Z(NihaoPay使用的是UTC时区).

多合一固定收款码 ​

生成固定收款码 ​

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

商户请求该接口获得一个包含NihaoPay固定收款码URL的json对象,将URL使用二维码生成软件生成一个图片格式的二维码,打印后张贴在商户的店铺中。客户打开支付宝或微信,使用”扫一扫"扫描二维码,在显示的页面中输入消费金额,确认后完成支付。商户通过NihaoPay商户后台查询客户付款记录。

请求示例

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"

请求报文 ​

字段说明
trade_currency
不为空
订单币种,3位货币代码. 该产品支持的币种有:USD 美元 和 JPY 日元。
ipn_url
允许为空
支付通知接收的URL。详见异步通知
seller_name
不为空
商家名称,用于显示在扫描二维码后的收银页面上
store_name
不为空
分店名称
store_no
不为空
分店编号

返回示例

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"
}

返回报文 ​

字段说明
seller_name
string
商家名称
store_name
string
分店名称
store_no
string
分店编号
qrcode_img_url
string
二维码图片地址
qrcode
string
二维码Url

固定收款码支付 ​

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

多合一的固定收款码,NihaoPay是提供标准收银页面的。为方便服务商或商户在收银页面中展现自己的品牌标识,NihaoPay支持商家自己构建二维码对应的H5收银页面,该页面确认支付时,调用如下接口唤醒微信或支付宝的付款。

请求示例

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"

请求报文 ​

参数说明
amount
不为空
订单金额,金额为对应货币中的最小单位。详见接口规则
vendor
不为空
付款方式,根据客户扫描二维码使用的APP决定,如果用微信扫码,该参数为wechatpay,如果用支付宝钱包扫码,该参数为alipay。
qrcode
不为空
收款码url。该参数为创建收款码接口的返回字段qrcode
reference
允许为空
商户订单号,1-30位的字母,数字和'-'组合,必须在商户系统中唯一。详见接口规则
items
允许为空
订单商品列表,详见接口规则。
callbacl_url
允许为空
支付完成后浏览器返回商户网站的URL。
description
允许为空
订单描述,可以订单商品信息摘要等,会显示在支付页面和客户付款收据中。

返回示例

json
{
  "redirect_url": "https://wxcode.nihaopay.com/wechatpay/openid?txnId=20180314095142025479"
}

返回报文 ​

当请求无误时,接口返回一个页面跳转url, 商家需要页面重定向到该地址,由APP自动唤醒支付功能。

字段说明
redirect_url
string
页面跳转地址。

支付宝收款码 ​

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

商户请求该接口获得一个包含支付宝静态二维码URL的json对象,将URL使用二维码生成软件生成一个图片格式的二维码,打印后张贴在商户的店铺中。客户打开支付宝,使用”扫一扫"扫描二维码,在显示的页面中输入消费金额,确认后完成支付。一旦客户付款成功,NihaoPay将发送异步通知到商户的IPN URL。商户也可以登录商户后台查询客户付款记录。

请求示例

shell
$ curl https://api.nihaopay.com/v1.2/merchantqrcode \
-H "Authorization: Bearer <TOKEN>" \
-d vendor="alipay" \
-d ipn_url="http://website.com/ipn" \
-d trade_currency="USD" \
-d seller_name="NihaoPay" \
-d store_name="LA Branch" \
-d store_no="B001"

请求报文 ​

字段说明
trade_currency
不为空
订单币种,3位货币代码. 该产品支持的币种有:USD 美元 和 JPY 日元。
vendor
不为空
固定值:alipay。
ipn_url
允许为空
支付通知接收的URL。详见异步通知
seller_name
不为空
商家名称,用于显示在扫描二维码后的付款页面上
store_name
不为空
分店名称
store_no
不为空
分店编号

返回示例

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"
}

返回报文 ​

字段说明
seller_name
string
商家名称
store_name
string
分店名称
store_no
string
分店编号
qrcode_img_url
string
带支付宝logo的二维码图片地址
qrcode
string
二维码Url

最后更新 - 01/16/2025