#andonz
1 messages ยท Page 1 of 1 (latest)
That doesn't look right for a correct billing integration. How are you creating your Subscriptions?
Im using Stripe PHP Sdk, to ummarize shortly , first I create the payment intent from which I pass the intent_id param and data-secret
'amount' => $data->amount == 0 ? 50 : floatval(number_format($data->amount, 2) * 100),
'currency' => strtolower($data->currency),
'payment_method_types' => ['card'],
'confirm' => false,
'setup_future_usage' => 'off_session',
]);```
and after capturing the payment, (based on the response from the api) if success I then create the subscription
You shouldn't be creating a Payment Intent and a Subscription
The Subscription will automatically create a Payment Intent if required, as you're experiencing above
okay, then how to handle 3ds scenarios? without creating a payment intent its not possible
I'd recommend looking at this guide: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
Sure it is: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#collect-payment
As I stated, the Subscription will create an initial invoice which will include a Payment Intent if there's a payment required. You pass that from your backend to your front-end and call confirmPayment which handles 3DS/auth
Thank you, I will have a look ๐
๐ how may I help?
Hi Tarzan, your colleague said that I dont need to create a payment intent and a subscription, how can I get the clientSecret without creating a payment intent?
from what I checked the client secret is retrieved $intent->client_secret after creating the intent
have you read the whole guide that my colleague sent you https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#create-subscription
do i need to create the customer/ price/ subscription before capturing the payment?
so that I get the client secret > subscription.latest_invoice.payment_intent.client_secret
?
Yes, exactly
This customer has no attached payment source or default payment method. Please consider adding a default payment method. For more information, visit https://stripe.com/docs/billing/subscriptions/payment-methods-setting#payment-method-priority.
how to add default payment method, if payment is not captured yet at this point?
Pass payment_behavior: 'default_incomplete' when you create your Subscription, as per the guide we linked