创建收款
Quick Reference
What为任意支付方式创建收款
Why通过单一端点,在 11 种支付方式、7 个国家和 29 个收单机构之间处理支付
Reading Time10 分钟
Difficulty初级
Prerequisites身份验证 → 环境配置
POST
/api/v1/bank/wallet/charge/Bearer Token创建新收款何时使用此端点
| 场景 | 创建收款如何帮助您 |
|---|---|
| 接受信用卡支付 | 设置 type_charge: "credit_card" 并提供卡片字段,或让 SDK/结账页面处理 |
| 提供 PIX 即时支付 | 设置 type_charge: "pix"——响应包含二维码和复制粘贴码 |
| 生成 Boleto 银行缴费单 | 设置 type_charge: "boleto"——响应包含条形码和到期日 |
| 接受 Apple Pay / Google Pay | 设置 type_charge: "applepay" 或 "googlepay" 并传入令牌数据 |
| 设置定期扣款 | 添加 subscription 对象,一次调用同时创建收款和订阅 |
| 仅授权流程 | 设置 capture: false,适用于酒店、租车和预授权场景 |
选择支付方式
选择下方的支付方式。页面将仅显示与该方式相关的字段、代码和响应。
请求参数(所有方式)
以下字段对所有支付方式都是必填的:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
wallet_uuid | string (UUID(通用唯一标识符)) | 是 | 接收资金的钱包 |
merchant_id | string | 是 | 商户标识符 |
payer_name | string | 是 | 付款人全名 |
payer_email | string | 是 | 付款人邮箱地址 |
payer_tax_id | string | 是 | 税务 ID(巴西 CPF、墨西哥 RFC、智利 RUT、阿根廷 CUIT) |
payer_cell_phone | string | 是 | 付款人手机号(含国际区号) |
installment_value | number | 是 | 每期收费金额。对于零小数货币(CLP、COP),使用整数——参见下方货币规则 |
installment_count | integer | 是 | 分期数(一次性支付使用 1) |
currency | string | 是 | ISO 4217 货币代码:BRL、MXN、CLP、COP、PEN、ARS |
due_date | string | 是 | 到期日,格式为 YYYY-MM-DD |
description | string | 是 | 向付款人显示的收款描述 |
type_charge | string | 是 | 支付方式——参见上方选择器 |
payer_address | object | 是 | 账单地址(详见下方) |
付款人地址对象
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
street | string | 是 | 街道名称 |
address_number | string | 是 | 门牌号 |
complement | string | 是 | 公寓、套房、楼层 |
neighborhood | string | 是 | 社区或区域 |
city | string | 是 | 城市 |
state | string | 是 | 州/省代码(如 SP、CDMX) |
postal_code | string | 是 | 邮政编码 |
country | string | 否 | ISO 3166-1 alpha-2(如 BR)。默认为钱包所在国家 |
各货币金额规则
| 货币 | 小数位 | 格式 | 示例 | 后端行为 |
|---|---|---|---|---|
| BRL | 2 | 150.00 | "installment_value": 150.00 | 存储为 Numeric(11,2) |
| MXN | 2 | 2500.00 | "installment_value": 2500.00 | 存储为 Numeric(11,2) |
| USD | 2 | 100.00 | "installment_value": 100.00 | 存储为 Numeric(11,2) |
| PEN | 2 | 350.00 | "installment_value": 350.00 | 存储为 Numeric(11,2) |
| ARS | 2 | 85000.00 | "installment_value": 85000.00 | 存储为 Numeric(11,2) |
| CLP | 0 | 50000 | "installment_value": 50000 | 发送至收单方前截断为整数 |
| COP | 0 | 200000 | "installment_value": 200000 | 发送至收单方前截断为整数 |
零小数货币
CLP(智利比索)和COP(哥伦比亚比索)没有小数单位。后端在发送至收单方前将金额转换为整数。发送 CLP 50000.50 将得到 50000。这些货币请始终发送整数。
可选字段(所有方式)
| 字段 | 类型 | 默认值 | 说明 |
|---|---|---|---|
webhook_url | string | —— | 覆盖此收款的默认 Webhook URL |
redirect_url | string | —— | 结账页面或 3DS 验证后的返回 URL |
reference_external_id | string | —— | 用于对账的内部订单 ID |
is_async | boolean | false | 在支持的情况下进行异步处理 |
shipping_address | object | —— | 收货地址(与 payer_address 结构相同) |
卡片特定字段
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
card_number | string | 仅 H2H | 卡号 PAN(SDK 和结账页面会自动处理) |
card_name | string | 仅 H2H | 卡面印刷姓名 |
card_expiry_month | string | 仅 H2H | 到期月份 MM |
card_expiry_year | string | 仅 H2H | 到期年份 YYYY |
card_cvv | string | 仅 H2H | 卡片验证码 |
capture | boolean | 否 | true(默认)= 自动捕获;false = 仅授权 |
threeds_authentication | boolean | 否 | true 强制 3DS 验证 |
device_info | object | 3DS | 3DS 所需的浏览器/设备指纹(详见下方) |
antifraud_info | object | 否 | 用于反欺诈评分的行为数据 |
subscription | object | 否 | 随此收款创建定期订阅 |
何时需要卡片字段?
- H2H 集成:您直接发送
card_number、card_name、card_expiry_month、card_expiry_year、card_cvv。 - SDK 集成:SDK 在浏览器中收集卡片数据。您只需发送通用字段。
- 结账页面:A55 的托管页面收集所有信息。您只需发送通用字段 +
redirect_url。
设备信息对象(3DS)
在 H2H 流程中当 threeds_authentication: true 时必填:
| 字段 | 类型 | 说明 |
|---|---|---|
ip_address | string | 付款人的 IP 地址 |
user_agent | string | 浏览器 User-Agent 字符串 |
device_id | string | SDK 生成的设备指纹 |
session_id | string | 发卡行的 DDC 会话 ID |
http_accept_content | string | 浏览器 Accept 头 |
http_browser_language | string | 浏览器语言(如 en-US) |
http_browser_java_enabled | boolean | 浏览器是否启用 Java |
http_browser_javascript_enabled | boolean | 是否启用 JavaScript |
http_browser_color_depth | string | 颜色深度(如 24) |
http_browser_screen_height | string | 屏幕高度(像素) |
http_browser_screen_width | string | 屏幕宽度(像素) |
http_browser_time_difference | string | UTC 偏移量(如 -3) |
反欺诈信息对象
提升欺诈评分和通过率:
| 字段 | 类型 | 说明 |
|---|---|---|
sales_channel | string | web、app、pos、marketplace、link、subscription、api |
cardholder_logged_in | boolean | 付款人是否已登录 |
cardholder_since_days | integer | 账户创建以来的天数 |
purchase_history | integer | 历史购买总数 |
days_since_last_purchase_merchant | integer | 距上次在您处购买的天数 |
订阅对象
随此收款创建定期订阅:
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
cycle | string | 是 | weekly、biweekly、monthly、quarterly、semiannually、yearly |
end_date | string | 否 | 订阅结束日期 YYYY-MM-DD(省略表示无限期) |
代码示例
信用卡收款
- cURL
- Python
- JavaScript
curl -s -X POST https://core-manager.a55.tech/api/v1/bank/wallet/charge/ \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"wallet_uuid": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"merchant_id": "11111111-1111-1111-1111-111111111111",
"payer_name": "张伟",
"payer_email": "zhangwei@example.com",
"payer_tax_id": "123.456.789-09",
"payer_cell_phone": "+5511999999999",
"installment_value": 150.00,
"installment_count": 3,
"currency": "BRL",
"due_date": "2026-12-31",
"description": "订单 #42——3 期分期",
"type_charge": "credit_card",
"card_number": "4024007153763191",
"card_name": "张伟",
"card_expiry_month": "12",
"card_expiry_year": "2030",
"card_cvv": "123",
"capture": true,
"webhook_url": "https://your-app.com/webhooks/a55",
"payer_address": {
"street": "Av. Paulista",
"address_number": "1000",
"complement": "Sala 101",
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"postal_code": "01310-100",
"country": "BR"
}
}'
import requests
charge = requests.post(
"https://core-manager.a55.tech/api/v1/bank/wallet/charge/",
json={
"wallet_uuid": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"merchant_id": "11111111-1111-1111-1111-111111111111",
"payer_name": "张伟",
"payer_email": "zhangwei@example.com",
"payer_tax_id": "123.456.789-09",
"payer_cell_phone": "+5511999999999",
"installment_value": 150.00,
"installment_count": 3,
"currency": "BRL",
"due_date": "2026-12-31",
"description": "订单 #42——3 期分期",
"type_charge": "credit_card",
"card_number": "4024007153763191",
"card_name": "张伟",
"card_expiry_month": "12",
"card_expiry_year": "2030",
"card_cvv": "123",
"capture": True,
"webhook_url": "https://your-app.com/webhooks/a55",
"payer_address": {
"street": "Av. Paulista",
"address_number": "1000",
"complement": "Sala 101",
"neighborhood": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"postal_code": "01310-100",
"country": "BR",
},
},
headers={
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
},
).json()
print(f"收款:{charge['charge_uuid']}——状态:{charge['status']}")
print(f"合计:{charge['installment_count']} 期 × R$ {charge['installments'][0]['local_currency']}")
const charge = await fetch(
"https://core-manager.a55.tech/api/v1/bank/wallet/charge/",
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
wallet_uuid: "f47ac10b-58cc-4372-a567-0e02b2c3d479",
merchant_id: "11111111-1111-1111-1111-111111111111",
payer_name: "张伟",
payer_email: "zhangwei@example.com",
payer_tax_id: "123.456.789-09",
payer_cell_phone: "+5511999999999",
installment_value: 150.0,
installment_count: 3,
currency: "BRL",
due_date: "2026-12-31",
description: "订单 #42——3 期分期",
type_charge: "credit_card",
card_number: "4024007153763191",
card_name: "张伟",
card_expiry_month: "12",
card_expiry_year: "2030",
card_cvv: "123",
capture: true,
webhook_url: "https://your-app.com/webhooks/a55",
payer_address: {
street: "Av. Paulista",
address_number: "1000",
complement: "Sala 101",
neighborhood: "Bela Vista",
city: "São Paulo",
state: "SP",
postal_code: "01310-100",
country: "BR",
},
}),
}
).then(r => r.json());
console.log(`收款:${charge.charge_uuid}——状态:${charge.status}`);
console.log(`合计:${charge.installment_count} 期 × R$ ${charge.installments[0].local_currency}`);
响应
收款生命周期
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
charge_uuid | string | 收款唯一标识符 |
status | string | issued、pending、confirmed、paid、error、canceled、refunded |
local_currency | number | 钱包结算币种的金额 |
currency | string | ISO 4217 货币代码 |
usd_currency | number | 等值美元金额 |
eur_currency | number | 等值欧元金额 |
type | string | 使用的支付方式 |
date | string | 收款创建日期 |
description | string | 收款描述 |
due_date | string | 付款到期日 |
installment_count | integer | 分期数 |
installments | array | 每期分期明细 |
charge_payment_url | string | 结账/SDK 支付 URL(适用时) |
url_3ds | string | 3DS 验证重定向 URL(仅 H2H) |
message | array/null | status: "error" 时的错误详情 |
subscription | object | 订阅详情(当包含 subscription 时) |
卡片响应示例
{
"charge_uuid": "51dcca6e-7310-4b73-a94c-90835408f2ff",
"local_currency": 150.00,
"currency": "BRL",
"usd_currency": 26.90,
"eur_currency": 23.58,
"type": "credit_card",
"date": "2026-03-20",
"description": "订单 #42——3 期分期",
"due_date": "2026-12-31",
"status": "confirmed",
"message": null,
"installment_count": 3,
"installments": [
{
"local_currency": 50.00,
"currency": "BRL",
"usd_currency": 8.97,
"eur_currency": 7.86,
"due_date": "2026-12-31",
"status": "confirmed",
"installment_number": 1
},
{
"local_currency": 50.00,
"currency": "BRL",
"usd_currency": 8.97,
"eur_currency": 7.86,
"due_date": "2027-01-31",
"status": "confirmed",
"installment_number": 2
},
{
"local_currency": 50.00,
"currency": "BRL",
"usd_currency": 8.97,
"eur_currency": 7.86,
"due_date": "2027-02-28",
"status": "confirmed",
"installment_number": 3
}
]
}
错误响应
{
"charge_uuid": "51dcca6e-7310-4b73-a94c-90835408f2ff",
"status": "error",
"message": [
{
"code": "error_threeds_authentication",
"source": "authentication",
"description": "Issuing bank declined the authentication"
}
]
}
错误代码
| 代码 | 含义 | 处理方式 |
|---|---|---|
INVALID_TYPE_CHARGE | 不支持的 type_charge 值 | 检查上方选择器中的允许值 |
errors.wallet.not_found | 钱包 UUID 不存在 | 验证 wallet_uuid |
errors.unexpected | 内部服务器错误 | 使用指数退避重试;若持续出现请联系支持 |
error_threeds_authentication | 3DS 验证失败 | 要求付款人重试或使用其他卡片 |
务必使用 Webhook
切勿仅依赖同步响应来判断最终支付状态。收款可能会异步经过多个状态。设置 webhook_url 并将 Webhook 视为真实数据来源。