POST /api/checkout
请求
| 名称 | 类型 | 必填 | 输入校验 | 描述 |
|---|---|---|---|---|
| merchant_transaction_id | string | true | 商户提供的唯一交易标识符。 | |
| amount | string | true | 数字型, 1-12 位数字 | 交易金额的数值表示。 |
| currency | string | true | 允许的取值"IDR" | 交易使用的货币(仅支持印尼盾)。 |
| customer_name | string | true | 允许 5–25 个字符: a-z A-Z 0-9 - (space) | 与该交易关联的客户姓名。 |
| product_name | string | true | 允许 5–25 个字符: a-z A-Z 0-9 - (space) | 与该交易关联的产品名称。 |
| description | string | false | 可选的交易详细信息。 | |
| success_redirect_url | string | false | 付款成功后重定向客户的 URL。也支持移动端深度链接 (Deep Link) URL。 |
{
"merchant_transaction_id": "ICZ10000001",
"amount": "100000",
"currency": "IDR",
"description": "Lorem Ipsum",
"customer_name": "John Doe",
"product_name": "Product Test",
"success_redirect_url": "https://example.com/success"
}
响应
| 名称 | 描述 |
|---|---|
| transaction_id | 系统生成的唯一交易标识符。 |
| client_id | 请求方的客户端标识符 |
| amount | 交易金额的数值表示。 |
| currency | 交易使用的货币代码(仅支持印尼盾 IDR)。 |
| description | 交易描述文本。 |
| customer_details | 与该交易相关的客户信息,以 JSON 字符串形式返回 — 请先解析后再读取下方字段。 |
| customer_details.customer_name | 该交易的客户姓名。需先解析 customer_details 后才可读取。 |
| customer_details.product_name | 该交易的产品名称。需先解析 customer_details 后才可读取。 |
| customer_obj | 与 customer_details 相同的客户信息,以 JSON 对象形式返回,无需解析。若 customer_details 为空或不是有效的 JSON,则为 null。 |
| checkout_url | 用户可通过浏览器完成支付的网页 URL |
| success_redirect_url | 付款成功后重定向客户的 URL。也支持移动端深度链接 (Deep Link) URL。 |
请以 HTTP 状态码判断是否失败:任何非 2xx 响应均表示失败。失败响应体为以下三种结构之一,见下方标签页。鉴权错误和 IP 白名单错误的结构请参阅错误响应。
{
"transaction_id": "9e536777-2bfa-4161-9931-35f5c4b23faf",
"client_id": "9dbf86be-f9e9-4000-8b39-fdd5a841fce1",
"amount": "100000",
"currency": "IDR",
"description": "Order Product",
"customer_details": "{\"customer_name\":\"John Doe\",\"product_name\":\"Product Test\"}",
"customer_obj": {
"customer_name": "John Doe",
"product_name": "Product Test"
},
"checkout_url": "{host}/checkout/9e536777-2bfa-4161-9931-35f5c4b23faf",
"success_redirect_url": "https://example.com/success"
}
请求体校验失败。errors 按字段列出错误信息。
{
"success": false,
"message": "Validation errors occurred.",
"errors": {
"amount": ["The amount field is required."]
}
}
请求在处理过程中被拒绝。HTTP 状态码与错误对应。error.code 通常为 0,请以 HTTP 状态码为准。
{
"error": {
"code": 0,
"message": "Error description"
}
}
发生意外错误,请稍后重试。
{
"status": false,
"data": null,
"message": "Error description"
}
支付过期时间(TTL)
Webhook