#vienklett-reuse-pm
1 messages · Page 1 of 1 (latest)
What do you mean by refill?
like re-fill the current credit card number that user used to pay for 1st subscription
and user just needs to enter the cvv to make a payment
Kinda. You can't auto fill out the credit card form, but you can use the existing payment method id + the cardcvc element to recollect cvc and process the payment with an existing card: https://stripe.com/docs/js/elements_object/create_element?type=cardCvc
thanks. my other question is: If user uses the same credit card to pay for 3 subscriptions. If they edit/update the payment info in one of those subscriptions, does it auto update payment info for other subs?
vienklett-reuse-pm
update the credit card number
How
By creating a new payment method?
Any changes to a subscription object doesn't change another subscription object
Also, you can't update a payment method's credit card number. You'd have to create a new payment method object entirely
Stripe::BillingPortal::Session.create({
customer: stripe_customer_id,
return_url: return_url,
flow_data: "payment_method_update",
})
i create the payment method through this code. so user can update their credit card
and will the new updated card be used to pay for all customer's subscriptions on the stripe?
Ah that depends
So that flow sets the default payment method on the customer
If all subscriptions rely on that for default payment method, then that newly created payment method will be used for all subs
However, you can also set default payment method at the subscription level, which would override the one set at the customer level
So if some of the subs have default pm set at the subscription level, a new payment method created in the customer portal would not be used as the default
how do i set the default payment method at the subscription level through api?
or i need to do it in the dashboard
Is that what you want to do?
There's nothing wrong with relying on the one set on the customer
Do you not want all subscriptions to use the same payment method?
yeah. that's what we are looking to do in our web
from the API doc customer string ID of an existing Customer, if one exists. In payment mode, the customer’s most recently saved card payment method will be used to prefill the email, name, card details, and billing address on the Checkout page. In subscription mode, the customer’s default payment method will be used if it’s a card, otherwise the most recently saved card will be used. A valid billing address, billing name and billing email are required on the payment method for Checkout to prefill the customer’s card details.
look like if I pass the customer's email when create checkout session, if customer exists, it will prefill card details for me.
If you're using checkout then it should be setting default on the subscription level already
Recommend you just test this all out in test mode
You'll know default payment method is being set at the subscription level if this param is populated on the subscription object: https://stripe.com/docs/api/subscriptions/object#subscription_object-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.