stripe-payments - 如何使用 Stripe API 计算销售税?
问题描述
我正在按照本指南中的步骤进行结帐流程,因此我可以使用 Stripe 根据国家和邮政编码为我计算销售税。
我按照步骤 3 和 4 创建了一个客户和待定订阅。此时,我想从下面的命令中获取响应,该响应应该告诉我 automatic_tax 状态(完成、requires_location_inputs 或失败)。但是,我得到了一个错误的响应。当我转到我的 Stripe 仪表板时,我确实看到了一张标记为未结的发票。为什么反应不如预期?
命令
curl https://api.stripe.com/v1/invoices/upcoming \
-u sk_test_<STRIPE API TEST KEY>: \
-d "customer"="{{ CUSTOMER_ID }}" \
-d subscription_items[0][price]="{{ PRICE_ID }}" \
-d subscription_items[0][quantity]=1 \
-d "automatic_tax[enabled]"=true
输出
{
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such invoice: 'upcoming'",
"param": "id",
"type": "invalid_request_error"
}
}
解决方案
即将到来的发票端点只是一个GET
端点。参考
如果您添加--request GET
到curl
命令中,那应该可以。它目前正在尝试 POST 以更新 ID 为“即将到来”的现有发票,该发票无效。
推荐阅读
- eclipse-rcp - 当视图失去焦点时不再显示标记(强制,仅输出)(已解决)
- node.js - mongoose中的数组赋值是否需要确保深拷贝
- database - Laravel 没有将 oracle 设置为连接
- python - 没有名为“cryptography.hazmat.bindings._padding”的模块
- excel - Countifs 公式与数组中的标准值
- regex - 优化 sed 字符串
- laravel - 以一种形式从 laravel nova 中的关系中添加字段文本
- javascript - 为数据表的所有列构造状态对象以进行排序:React JS
- ruby - Ruby 将两个浮点数加到一个不正确的答案中
- c# - 使用需要参数没有参数的方法