#TheUchi007-subs
1 messages · Page 1 of 1 (latest)
Hello! Are you following any particular subscriptions docs to understand how that payment process works?
I am not following a guide, I am simply referring to the API docs
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'd recommend going through our intro docs instead of jumping straight to the API reference - this doc (https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements) goes into detail about all the steps you'd need to create a subscription + collect payment method details
Hmmm I do it pretty much like that. The one thing I do see is:
payment_settings: { save_default_payment_method: 'on_subscription' }
Is that what I need to be able to re-use the payment method in order to make other purchases?
No, there isn't anything specific you need to do to re-use the payment method - once you finish collecting the payment information and confirm the payment intent, the payment method is automatically attached to the customer and can be used for other payments
ah really? I thought I needed an extra step. I do see that to retrieve it, I use:
stripe.paymentMethods.retrieve
However, I do still need the paymentMethodId. How do I retrieve that?
FYI, I am using stripe.customers.retrieve to get customer's info
You can find it on the Subscription (at default_payment_method) or you can retrieve all of the customer Payment Methods (see https://stripe.com/docs/api/payment_methods/customer_list)
Awesome, that's exactly what I was looking for, thank you!
one last question. If I wanted the user to add a new method(like a new CC) for different things(like one for the subscription, and another for normal payments), Do I just make the user re-fill the payment form and it will create a new one?
If you wanted to collect another Payment Method you'd likely need to create a SetupIntent, use that intent with the payment form to collect the information, and that will save the payment method to the customer (see https://stripe.com/docs/payments/save-and-reuse)
Awesome, thank you so much! I do have one very last question, I promise! So, on the sample you sent, it is exactly what I want. However, what if I am using CardNumberElement instead of PaymentElement? It saysthe PaymentElement provides the list to choose the payment method, but not sure about the other. Worst case, I'll moveto using PaymentElement, but I like the ability to control the look and position of the fields(well, on the borders and such at least)
This should totally work with CardNumberElement as well - here's a card-specific guide that may be more helpful to you: https://stripe.com/docs/payments/save-and-reuse-cards-only