#Macrew
1 messages · Page 1 of 1 (latest)
Your Subscription creation will generate either a Payment or Setup Intent depending on whether there's a payment due. See: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#collect-payment:~:text=On the backend%2C create the subscription with status incomplete using payment_behavior%3Ddefault_incomplete. Then return the client_secret from the subscription’s first payment intent to the frontend to complete payment.
Okay, but it saying to return client_secret to fronend so how can they will make payment succesful.
I don't understand the question.
I'd recommend following the guide I linked. It explains all of this.
Alright, but it seems too much API's and I don't know it is needful to me or not.
i'm simply creating subscription like this
$subscription = Subscription::create($data_array);
but some card require action and can not see any redirect_url there. Please let me know if that much stuf is requred for impliment 3DS If you can help me
You need to return the Payment Intent client_secret from your backend to your frontend code and initialise an Element to collect payment details.
You can then call confirmPayment (or similar) which will handle 3DS flows automatically. This is all outlined on the guide.
Alternatively, you can use Checkout if you'd prefer a lower-level integration.
Dear, I'm working on backend PHP and I can not get help from frontend side (flutter), frontend developer is very dumb. I need to do all things by myself.
Well you need a frontend application/UI to handle 3DS/auth flows. Your customers need to be able to complete the flow when prompted, that can't be done in backend alone.
I'd recommend looking at Checkout if this is a limitation for you. There's no frontend component to that.
currently I'm creating subsection by user enter their payment details. In client side they will select plan and send with card token to backend. This process is working fine with some of the card. But few card payment status is getting incomplete. While I have a good understanding of API coding, I find it challenging to comprehend the extensive theoretical information provided in the documentation.
How are you tokenising the card details?
LIkely not in a SCA compliant manner, and hence why you're encountering issues.
The default way is to first create the Subscription and then collect payment details and confirm the payment with Stripe.js.
So how can I confirm the payment with stripe. When I create subscription without payment method. when it will charge the customer?
it is very confusing. It was awesome flow normally which I do, provided in many tutorials
Hi there 👋 jumping in as my teammate needed to step away. So you're in a state where you have an incomplete Subscription and a finalized Invoice for it that hasn't been paid? In that case you will retrieve the client_secret from the Payment Intent associated with that Invoice, and use that to initialize the frontend components.
To get there:
latest_invoice from the Subscription object:
https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice
then payment_intent from the Invoice object:
https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent
If the tutorial you're following is recommending that you use Tokens then it is likely outdated.
Okay, Could you tell me the new process step-wise-step.
If I need to user subscribe in single action,
It means I need to user choose plan and enter card details in client side when they will enter pay button they will get success response.
So to achieve this which step do i need to implement?
Allowing the user to select what they'd like to Subscribe to and provide their payment method details on a single page will be complex.
Thinking through the best approach
it is already done in my system and working fine. I'm facing problem on some of the cards.
How are you collecting payment method details currently?
we are showing 3 plans in client side user will select one of them and will enter cards details, It is possible there can be existing payment method attached to the stripe customer id. when user will enter the pay/subscribe button we are creating a card token using stripe.js, Also they can choose payment method instead entering card details.
After that in backend creating subscription for that customer_id with the following payment method, if there are token so first will create pm_ and attached to customer then will create subscription.
Hope this will make sence.
Gotcha, yeah, that is an older flow. I'm not sure how you're collecting those card details, but if it's in your own UI field then that approach also puts more PCI compliance burden on your than if you used one of our frontends.
Are you planning to only ever accept cards, or do you have plans to expand to other payment method options later?
Yeah kind of.
How can I add PCI compliance
I don't know too much about what the specifics of the PCI compliance burden are when you're handling card details directly. This helps discuss the different amounts of burden based on how you leverage our products:
https://stripe.com/docs/security/guide
In general though, there are two ways to handle your flow.
- Create the Subscription first, use the
client_secretfrom the Payment Intent on its first Invoice (a bit different if the first Invoice has an amount of zero) to initialize a Stripe frontend component to collect payment method details. - Use a Setup Intent to first collect payment method details from the user and generate a Payment Method from those. Then create the Subscription using that Payment Method and check for first payment failures.
Either approach runs the possibility of needing to complete 3DS/SCA challenges for future payments, whether those challenges need to be completed is ultimately up to customer's bank and Stripe doesn't have direct control over that. So you should have a flow ready for existing Customers to come on session and complete 3DS/SCA challoenges anyway.
yes, I'm working for 3DS too, but it not providing me redirect_link in subscriptiion API
It won't, that's on the associated Payment Intent.
So I need to move on new flow, please guide me how can I start?
Which of the flows that I described above are you interested in pursuing?
but make sure I can not change client side flow.
there are subscription listing, after select plan they will move to payment page where they can add card or select payment method
maybe 2nd
Gotcha, so if you want to first collect payment method details, you'll want to use an approach similar to what is shown here (I'm not exactly sure what the third party flutter-stripe package supports if that is what you're leveraging):
https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
The result of confirming the Setup Intent will be a Payment Method, you can then use that Payment Method when creating the Subscription.