# 集成接口下单
# 请求接口ROOT地址
测试环境 : https://gateway-sandbox.luxpag.com
正式环境 : https://gateway.luxpag.com
# 接口
/trade/create
# Request Header
参数名 | 必须 | 描述 |
---|---|---|
Content-Type | 推荐 | application/json |
Authorization | yes | Basic Base64(app_id:secret_key) |
# 请求参数(JSON格式)
参数名 | 类型 | 必须 | 最大长度/默认值 | 描述 |
---|---|---|---|---|
app_id | string | yes | 32 | 商户后台创建并获得 |
timestamp | string | yes | 19 | yyyy-MM-dd HH:mm:ss |
out_trade_no | string | yes | 64 | 商户订单号 |
method | string | no | 32 | 支付方式(CreditCard) |
channel | string | no | 32 | 小渠道选择(目前只有钱包可用,可指定具体钱包) |
order_currency | string | yes | 3 | 币种:巴西(BRL) |
order_amount | decimal | yes | 0.01 ~ 99999999999999.99 | 订单金额 |
subject | string | yes | 128 | 订单标题 |
content | string | no | 255 | 订单内容,Khipu必须按实际填写 |
trade_type | string | yes | WEB | 响应方式 |
notify_url | string | yes | 255 | 回调地址,IPN通知地址 |
return_url | string | no | 255 | 页面返回地址,部分渠道只支持https(Peru-Wallet) |
buyer_id | string | yes | 128 | 商户的用户ID |
timeout_express | string | no | 90m | 订单过期时间:m(分), h(小时), d(日), c(当日UTC) |
cancellation_express | string | no | Luxpag主动cancel时间:m(分), h(小时), d(日),必须是整数,例:90m,必须大于 timeout_express,最大值为3天 | |
regions | List | no | 区域编码, app 为Global时有效,例如 [ "MEX", "BRA" ] |
# 请求样例
curl --location --request POST 'https://gateway.luxpag.com/trade/create' \
--header 'Authorization: Basic Base64(appid:secret_key)' \
--header 'Content-Type: application/json' \
--data-raw '{
"app_id": "app_id",
"content": "content",
"method": "Boleto",
"notify_url": "notify_url",
"order_amount": 10,
"order_currency": "BRL",
"out_trade_no": "{{$randomUUID}}",
"subject": "subject",
"timeout_express": "1h",
"timestamp": "{{datetime}}",
"trade_type": "WEB",
}'
# 响应(JSON格式)
参数名 | 类型 | 描述 |
---|---|---|
code | string | 返回码 |
msg | string | 返回消息 |
sub_code | string | 子码 |
sub_msg | string | 子消息 |
out_trade_no | string | 商户订单号 |
trade_no | string | Luxpag创建的订单号 |
web_url | string | 支付页面URL |
# 返回样例(成功)
{
"code": "10000",
"msg": "Success",
"out_trade_no": "{out_trade_no}",
"trade_no": "{trade_no}",
"web_url": "http://checkout.luxpag.com?trade_no={$trade_no}",
}
# 返回样例(失败)
{
"code": "40002",
"msg": "Business Failed",
"sub_code": "invalid-signature",
"sub_msg": "invalid signature"
}
# 返回状态码
创建订单时返回状态。
# !!!注意!!!
return_url现在作为下单参数传递,不过如果需要,可在重定向到web_url的同时追加在web_url的url路径参数内来重写此参数,重写参数只在WEB支付过程中生效:
http://checkout.luxpag.com?trade_no={$trade_no}
↓↓↓
http://checkout.luxpag.com?trade_no={$trade_no}&return_url=encodeURIComponent({$return_url})
如果使用Webview加载checkout页面,建议支持localStorage,可避免每次支付重填用户信息,例如:webSettings.setDomStorageEnabled(true)