我在Django View中设置了shipping_address_collection,如下所示:
# "views.py"
def test(request):
customer = stripe.Customer.search(query="email:'mytest@gmail.com'", limit=1)
checkout_session = stripe.checkout.Session.create(
customer=customer["data"][0]["id"] if customer.has_more else None,
line_items=[
{
"price_data": {
"currency": "USD",
"unit_amount_decimal": 1000,
"product_data": {
"name": "T-shirt",
"description": "Good T-shirt",
},
},
"quantity": 2,
}
],
payment_method_options={
"card": {
"setup_future_usage": "on_session",
},
}, # ↓ ↓ ↓ Here ↓ ↓ ↓
shipping_address_collection={
"allowed_countries": ['US']
},
mode='payment',
success_url='http://localhost:8000',
cancel_url='http://localhost:8000'
)
return redirect(checkout_session.url, code=303)
然后,我可以填写发货信息的发货地址,如下图所示,但我每次去Stripe Checkout都需要手工填写,因为它不保存,而付款详情是用setup_future_usage保存的,如下图所示:
那么现在,如何保存收货地址,以便每次去Stripe Checkout时自动填写?
是否有类似setup_future_usage
的收货地址自动填写?
1条答案
按热度按时间uemypmqf1#
使用Stripe Checkout时,无法预先填写客户的送货地址。您可以预先填写客户电子邮件地址,如果您为
customer
传递ID,则可以预先填写以前保存的付款方式及其关联的账单地址。