如何在订单中指定增值税?
How do I specify VAT in an order?
我们位于欧盟。当我们向没有增值税号的个人或公司销售我们的数字产品时,我们必须向他们收取增值税(增值税)。这就是我正在尝试的:
import stripe
stripe.api_key = 'sk_test_xxx'
stripe.api_version = '2015-10-16'
product = stripe.Product.create(
id='product',
name='Product',
shippable=False
)
sku = stripe.SKU.create(
product='product',
price=100,
currency='eur',
inventory={'type': 'infinite'}
)
customer = stripe.Customer.create(
email='customer@example.org',
description="Customer"
)
order = stripe.Order.create(
customer=customer.id,
currency='eur',
items=[
{
'type': 'sku',
'quantity': 5,
'parent': sku.id,
'amount': 500
},
{
'type': 'tax',
'description': "20% VAT",
'amount': 100
}
]
)
订单创建调用给我:
stripe.error.InvalidRequestError: Request req_xxx: Items of type tax are not supported at order creation.
当我替换上次不含税的订单创建调用时:
order = stripe.Order.create(
customer=customer.id,
currency='eur',
items=[
{
'type': 'sku',
'quantity': 5,
'parent': sku.id,
'amount': 500
}
]
)
我正在取回这些 order['items']
:
[
{
"amount": 500,
"currency": "eur",
"description": "Product",
"object": "order_item",
"parent": "sku_xxx",
"quantity": 5,
"type": "sku"
},
{
"amount": 0,
"currency": "eur",
"description": "Taxes (included)",
"object": "order_item",
"parent": null,
"quantity": null,
"type": "tax"
},
{
"amount": 0,
"currency": "eur",
"description": "Free shipping",
"object": "order_item",
"parent": "ship_free-shipping",
"quantity": null,
"type": "shipping"
}
]
但是,订单不允许在创建订单后更新 items
字段。
向订单商品添加增值税的正确语义方法是什么?
我联系了 Stripe 支持,现在应该可以在私人测试版中使用。您可以要求 Stripe 加入税收测试版。
加入后,您可以在此处访问文档:https://stripe.com/docs/relay#shipping-and-taxes and here: https://stripe.com/docs/relay/dynamic-shipping-taxes#order-creation-event。
您的 Stripe 仪表板(中继设置)中将有一个选项可以指定 "dynamic" 税收网络钩子,Stripe 将订单发送到该网络钩子,然后您的服务器应响应包含税收条目的订单项目。创建订单后立即命中 webhook。
我们位于欧盟。当我们向没有增值税号的个人或公司销售我们的数字产品时,我们必须向他们收取增值税(增值税)。这就是我正在尝试的:
import stripe
stripe.api_key = 'sk_test_xxx'
stripe.api_version = '2015-10-16'
product = stripe.Product.create(
id='product',
name='Product',
shippable=False
)
sku = stripe.SKU.create(
product='product',
price=100,
currency='eur',
inventory={'type': 'infinite'}
)
customer = stripe.Customer.create(
email='customer@example.org',
description="Customer"
)
order = stripe.Order.create(
customer=customer.id,
currency='eur',
items=[
{
'type': 'sku',
'quantity': 5,
'parent': sku.id,
'amount': 500
},
{
'type': 'tax',
'description': "20% VAT",
'amount': 100
}
]
)
订单创建调用给我:
stripe.error.InvalidRequestError: Request req_xxx: Items of type tax are not supported at order creation.
当我替换上次不含税的订单创建调用时:
order = stripe.Order.create(
customer=customer.id,
currency='eur',
items=[
{
'type': 'sku',
'quantity': 5,
'parent': sku.id,
'amount': 500
}
]
)
我正在取回这些 order['items']
:
[
{
"amount": 500,
"currency": "eur",
"description": "Product",
"object": "order_item",
"parent": "sku_xxx",
"quantity": 5,
"type": "sku"
},
{
"amount": 0,
"currency": "eur",
"description": "Taxes (included)",
"object": "order_item",
"parent": null,
"quantity": null,
"type": "tax"
},
{
"amount": 0,
"currency": "eur",
"description": "Free shipping",
"object": "order_item",
"parent": "ship_free-shipping",
"quantity": null,
"type": "shipping"
}
]
但是,订单不允许在创建订单后更新 items
字段。
向订单商品添加增值税的正确语义方法是什么?
我联系了 Stripe 支持,现在应该可以在私人测试版中使用。您可以要求 Stripe 加入税收测试版。
加入后,您可以在此处访问文档:https://stripe.com/docs/relay#shipping-and-taxes and here: https://stripe.com/docs/relay/dynamic-shipping-taxes#order-creation-event。
您的 Stripe 仪表板(中继设置)中将有一个选项可以指定 "dynamic" 税收网络钩子,Stripe 将订单发送到该网络钩子,然后您的服务器应响应包含税收条目的订单项目。创建订单后立即命中 webhook。