How to automatically fill all info in the 2nd payment but not 3rd or 4th payments in Stripe?
With the Django's code below, I'm testing payment_method_options.card.setup_future_usage in Stripe Checkout in test
mode:
# "views.py"
def test(request): # Here
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={ # Here
"card": {
"setup_future_usage": "on_session",
},
},
mode='payment',
success_url='http://localhost:8000',
cancel_url='http://localhost:8000'
)
return redirect(checkout_session.url, code=303)
For the 1st payment with mytest@gmail.com
, I need to manually fill all info as shown below:
But, even for the 2st and 3rd payments with mytest@gmail.com
, I still need to manually fill all info without automatically filled shown below:
Finally, for the 4th payment with mytest@gmail.com
, all info is automatically filled as shown below:
So, how to automatically fill all info in the 2nd payment but not 3rd or 4th payments in test
and live
modes?
In the first payment, Securely save my information for 1-click checkout
is checked. This means that the payment method will be saved in Link (payment method storage provided by Stripe) for future payment.
In the second payment, there's this Log in
option beside the email. If you log in with it, you should see the same saved payment method shown as the fourth payment. It's likely that you were not logged in in second and third payment, so the saved payment method isn't shown.