Square API是Square公司提供的一组应用程序接口,允许开发者将Square的支付处理、库存管理和其他商业功能集成到自己的应用程序中。Checkout API是Square支付API的一部分,用于创建一次性支付链接或嵌入式支付表单。
{
"errors": [
{
"category": "AUTHENTICATION_ERROR",
"code": "UNAUTHORIZED",
"detail": "Unauthorized"
}
]
}
// 正确的Checkout API请求示例
const requestBody = {
idempotency_key: 'unique_key_123',
order: {
location_id: 'YOUR_LOCATION_ID',
line_items: [
{
name: 'Item Name',
quantity: '1',
base_price_money: {
amount: 1000, // $10.00
currency: 'USD'
}
}
]
},
ask_for_shipping_address: false,
redirect_url: 'https://yourwebsite.com/order-confirm'
};
idempotency_key
以防止重复收费如果问题仍然存在,建议查阅Square API官方文档获取最新的错误代码解释和解决方案。