Apple Pay 与 Google Pay
Quick Reference
WhatApple Pay 与 Google Pay
Why生物识别一键结账——更高转化、更低欺诈、令牌化卡数据
Reading Time15 分钟
Difficulty中级
Prerequisites身份验证 → 信用卡
为何使用 Apple Pay 与 Google Pay
| 优势 | 说明 |
|---|---|
| 一键结账 | 生物识别替代手动输入 |
| 更高转化 | 相对手动卡表单可达约 2 倍(典型基准) |
| 更低欺诈 | 令牌化 DPAN(设备主账号)+ cryptogram(加密验证值) |
| 责任转移 | 钱包认证与发卡行保护对齐 |
| 不存卡 | 您永不持久化真实 PAN |
令牌集成流程
将钱包加密令牌发送至 A55,由 A55 负责解密并提取卡数据。在请求中指定 applepay 或 googlepay,并提供 eci、cavv 与 type(credit_card / debit_card)。以下示例中的 card_number、有效期与 card_cvv 展示解密后的字段格式。
必填字段
eci 与 cavv 为必填。缺失或错误会导致拒绝。
数据安全
切勿将原始钱包令牌、cavv 或完整 PAN 记录到分析或工单中。
创建钱包收费
- cURL
- Python
- JavaScript
curl -X POST https://core-manager.a55.tech/api/v1/bank/wallet/charge/ \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"wallet_uuid": "00000000-0000-0000-0000-000000000000",
"merchant_id": "11111111-1111-1111-1111-111111111111",
"payer_name": "张伟",
"payer_email": "zhangwei@example.com",
"payer_tax_id": "12345678901",
"payer_cell_phone": "+5511999999999",
"currency": "BRL",
"installment_value": 100.0,
"installment_count": 1,
"due_date": "2026-12-31",
"description": "订单 #12345",
"items": [{"name":"耳机","quantity":1,"total_amount":100,"unit_amount":100,"sku":"SKU-001","code":"PROD-123"}],
"payer_address": {"street":"Sample St","address_number":"123","complement":"","neighborhood":"Centro","city":"São Paulo","state":"SP","postal_code":"01000-000","country":"BR"},
"type_charge": "applepay",
"card_number": "5200828282828210",
"card_expiry_month": "12",
"card_expiry_year": "2028",
"card_cvv": "123",
"applepay": {"eci":"05","cavv":"AAABBBCCC123456789==","type":"credit_card"},
"device_info": {"ip_address":"177.10.10.10","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36"},
"webhook_url": "https://yoursite.com/webhook",
"redirect_url": "https://yoursite.com/return"
}'
import requests
charge = requests.post(
"https://core-manager.a55.tech/api/v1/bank/wallet/charge/",
headers={"Authorization": f"Bearer {access_token}", "Content-Type": "application/json"},
json={
"wallet_uuid": "00000000-0000-0000-0000-000000000000",
"merchant_id": "11111111-1111-1111-1111-111111111111",
"payer_name": "李明",
"payer_email": "liming@example.com",
"payer_tax_id": "12345678901",
"payer_cell_phone": "+5511999999999",
"currency": "BRL",
"installment_value": 50.0,
"installment_count": 1,
"due_date": "2026-12-31",
"description": "订阅——第 1 个月",
"items": [{"name": "套餐", "quantity": 1, "total_amount": 50, "unit_amount": 50, "sku": "PLN-1", "code": "P1"}],
"payer_address": {"street": "Sample St", "address_number": "123", "complement": "", "neighborhood": "Centro", "city": "São Paulo", "state": "SP", "postal_code": "01000-000", "country": "BR"},
"type_charge": "googlepay",
"card_number": "4111111111111111",
"card_expiry_month": "07",
"card_expiry_year": "2029",
"card_cvv": "999",
"googlepay": {"eci": "05", "cavv": "ZYX987654321ABCDEF==", "type": "credit_card"},
"device_info": {"ip_address": "200.200.200.200", "user_agent": "Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36"},
"webhook_url": "https://yoursite.com/webhook",
},
)
charge.raise_for_status()
print(charge.json())
const response = await fetch(
"https://core-manager.a55.tech/api/v1/bank/wallet/charge/",
{
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
wallet_uuid: "00000000-0000-0000-0000-000000000000",
merchant_id: "11111111-1111-1111-1111-111111111111",
payer_name: "张伟",
payer_email: "zhangwei@example.com",
payer_tax_id: "12345678901",
payer_cell_phone: "+5511999999999",
currency: "BRL",
installment_value: 100.0,
installment_count: 1,
due_date: "2026-12-31",
description: "订单 #12345",
items: [{ name: "耳机", quantity: 1, total_amount: 100, unit_amount: 100, sku: "SKU-001", code: "PROD-123" }],
payer_address: { street: "Sample St", address_number: "123", complement: "", neighborhood: "Centro", city: "São Paulo", state: "SP", postal_code: "01000-000", country: "BR" },
type_charge: "applepay",
card_number: "5200828282828210",
card_expiry_month: "12",
card_expiry_year: "2028",
card_cvv: "123",
applepay: { eci: "05", cavv: "AAABBBCCC123456789==", type: "credit_card" },
device_info: { ip_address: "177.10.10.10", user_agent: "Mozilla/5.0" },
webhook_url: "https://yoursite.com/webhook",
}),
}
);
if (!response.ok) throw new Error(`请求失败(HTTP ${response.status}):${await response.text()}`);
console.log(await response.json());
Apple Pay 域名验证
在每个展示 Apple Pay 按钮的域名上托管 /.well-known/apple-developer-merchantid-domain-association.txt(参见 Apple Pay Web)。
集成提示
Apple Pay: 立即解密令牌;eci 常为 05–07。Google Pay: PAN 或 DPAN;eci 常为 05。将 webhook_url 作为最终状态的真实来源。
响应示例
{
"charge_uuid": "22222222-2222-2222-2222-222222222222",
"local_currency": 100.0,
"currency": "BRL",
"type": "applepay",
"status": "captured",
"installment_count": 1,
"installments": [{ "installment_number": 1, "status": "captured", "local_currency": 100.0, "currency": "BRL" }]
}
状态生命周期
| 状态 | 说明 |
|---|---|
captured | 授权并扣款成功 |
paid | 已确认待结算 |
failed | 拒绝或处理失败 |
cancelled | 已作废 |