#hts-cm
1 messages ยท Page 1 of 1 (latest)
Hi there, so you want to cancel a subscription if its default_payment_method is card payment method and its funding is prepaid ?
In fact, I want to prevent user to subscribe with this kind of prepaid card, because they cannot be charged automatically
OK, so you might want to use setup mode checkout session to collect a payment method, and check its funding (https://stripe.com/docs/api/payment_methods/object?lang=php#payment_method_object-card-funding), if it is is not prepaid, then proceed creating a subscription and set this payment method as its default_payment_method (https://stripe.com/docs/api/subscriptions/create?lang=php#create_subscription-default_payment_method)
Actually, I'm creating a session to redirect user to stripe with information to validate the process (and configure everything through webhooks).
Does this mean that I have to collect payment informations on my page to call Stripe API?
I mean you can use checkout session to collect a payment method from you user, once the checkout session is completed and the payment method is created successfully , you can use the payment method to create a subscription programmatically from your backend.
If the user use a prepaid card, it will be charged no matter what, isn't it ?
I thought you don't want to accept prepaid card?
Indeed, that's why I'm confused with your explainations ๐
Let me recap:
Now, I'm using the session service to create a new session with the informations. After the user enters his informations, I'm creating everything with webhooks data.
If I understand what you're saying, I need to change the workflow:
Create a new checkout session to collect user payment mode and when I have the webhook of this checkout session, I'm creating the subscription via API.
However, as far as I understand, when an user complete the checkout session, the card will be charged? So I need to refund user if he uses a prepaid card
No, the card won't be charged in a setup mode checkout session. (https://stripe.com/docs/api/checkout/sessions/create?lang=php#create_checkout_session-mode)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So, I create a new checkout session, redirect user to Stripe with the checkout url, when the webhook checkout.session.completed is retrieved, and I've verified the payment is not a prepaid card, I create the subscription via API?
Yes you are right. You can follow this guide (https://stripe.com/docs/payments/save-and-reuse?platform=checkout) to learn more about setup mode checkout session