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。 | |
| company_name | string | false | 贵公司名称,在客户通过虚拟账户付款时显示为虚拟账户名称。仅部分银行支持;其他银行显示默认名称。允许字符:字母 A-Z、空格和 .,其他字符(包括数字)会被移除。超过 30 个字符的值会被截断,剩余字母少于 3 个时该值将被忽略(例如 A+B 变为 AB,因此被忽略)。 |
{
"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",
"company_name": "PT Maju Jaya"
}
响应
| 名称 | 描述 |
|---|---|
| transaction_id | 系统生成的唯一交易标识符。 |
| client_id | 请求方的客户端标识符 |
| amount | 交易金额的数值表示。 |
| currency | 交易使用的货币代码(仅支持印尼盾 IDR)。 |
| description | 交易描述文本。 |
| customer_details | JSON 编码的字符串,包含 customer_name、product_name 以及 company_name(如有发送)。请解析该字符串,或直接使用 customer_obj。 |
| customer_details.customer_name | 该交易的客户姓名。需先解析 customer_details 后才可读取。 |
| customer_details.product_name | 该交易的产品名称。需先解析 customer_details 后才可读取。 |
| customer_obj | 以对象形式返回的相同数据。仅在发送了 company_name 时包含该字段。详情为空或无效时为 null。 |
| checkout_url | 用户可通过浏览器完成支付的网页 URL |
| success_redirect_url | 付款成功后重定向客户的 URL。也支持移动端深度链接 (Deep Link) URL。 |
请以 HTTP 状态码判断是否失败:任何非 2xx 响应均表示失败。失败响应体为以下三种结构之一,见下方标签页。鉴权错误和 IP 白名单错误的结构请参阅错误响应。
{
"transaction_id": "08a30e1b-2ef2-435b-b1fb-9885eb70545e",
"client_id": "da2ca5d8-dbc2-4cf3-b101-e804af8ea644",
"amount": "100000",
"currency": "IDR",
"description": "Order Product",
"customer_details": "{\"customer_name\":\"John Doe\",\"product_name\":\"Product Test\",\"company_name\":\"PT Maju Jaya\"}",
"customer_obj": {
"customer_name": "John Doe",
"product_name": "Product Test",
"company_name": "PT Maju Jaya"
},
"checkout_url": "{host}/checkout/08a30e1b-2ef2-435b-b1fb-9885eb70545e",
"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