在线付款

SecurePay

POST https://api.2pay.co/online/v1/secure-pay

This API provides a fast and secure way for order payments

Request Body

Name
Type
Description

merchantNo*

String

商户ID

verifySign *

String

参数签名

currency*

String

交易货币 支持"USD"

amount *

Number

交易金额

vendor*

String

支付渠道 可能的数值:"alipay", "wechatpay", "paypal", "venmo", "unionpay", "creditcard", "truemoney", "alipay_hk", "tng", "gcash", "dana", "kakaopay", "bkash", "easypaisa"

reference*

String

商家系统中交易的发票编号

terminal*

String

交易终端类型,可能的值: "ONLINE", "WAP", "ANDROID", "IOS"

ipnUrl*

String

异步回调地址,IPN网址必须是安全可靠的

callbackUrl*

String

同步回调HTTP地址,用于接收事件的通知消息。 回调网址需遵循宏替换规则,例如 xxxcallback_url?trans_no={amount}&amount={amount},然后2Pay将自动替换有关参数列表{}里的值

description

String

显示在发票上面的交易说明

timeout

String

超时(以分钟为单位)。 默认值为120。

goodsInfo

String

客户从商家购买的商品数组的JSON编码字符串。 不支持特殊字符。 例如: [{"goods_name":"name1", "quantity":"quantity1"}, {"goods_name":"name2", "quantity":"quantity2"}]

{
    "ret_code": "000100",
    "ret_msg": "prepay success",
    "result": {
        "amount": "1",
        "currency": "USD",
        "transactionNo": "558901a15-1c3f-427a-b838-83049b4efc47",
        "reference": "b6984c78-w8201-kqcak81jk",
        "cashierUrl": "https://api.2pay.co/app/url",
        "settleCurrency": "USD"
    }
}

响应

参数

类型

描述

ret_msg

String

响应返回消息

ret_code

String

响应返回码

result

Object

结果对象

Parameter

类型

描述

amount

String

交易金额。 当您使用"USD"作为付款货币时,它将返回

currency

String

交易货币:"USD"

transactionNo

String

2Pay系统中的交易ID

reference

String

商家系统中交易的发票编号

cashierUrl

String

收银员页面的URL

settleCurrency

String

标识结算货币的三位字符货币代码。

可能的值为:"USD"

curl --location --request POST 'https://api.2pay.co/online/v1/secure-pay' \
--header 'Content-Type: application/json' \
--data-raw '{
    "merchantNo": "M165937487",
    "vendor": "alipay",
    "reference": "b6984c78-8201-kqcak81jk",
    "amount": "1",
    "currency": "USD",
    "description": "your description",
    "terminal": "IOS",
    "callbackUrl": "https://{paidUrl}",
    "ipnUrl": "https://alipay.com/notify",
    "goodsInfo": "[{'\''goods_name'\'':'\''Plan'\'','\''quantity'\'':'\''1'\''}]",
    "timeout": "120",
    "verifySign": "{{verifySign}}"
}'

Last updated