#Sourav
1 messages · Page 1 of 1 (latest)
I can't create a separate payment intent for subscription and use its client secret as the payment should come after the trial period ends.
Hi
When creating a Subscription with trial you can collect payment methods using SetupIntent, collect the PaymentMethod and then create/update the Subscription with that payment method:
https://stripe.com/docs/payments/save-and-reuse?platform=web#charge-saved-payment-method
I've got the saved payment method with which im charging. Do I need to add this once I add the card?
$stripe->setupIntents->create(
[
'customer' => '{{CUSTOMER_ID}}',
'payment_method_types' => ['bancontact', 'card', 'ideal'],
]
);
Once you have the PaymentMethod, attached to the Subscription:
https://stripe.com/docs/api/subscriptions/create#create_subscription-default_payment_method
I also have the added payment method as default only when i add it at first. So while subscribing it attaches to my added default payment method only.
Not sure I understand the issue in your last reply, could you please rephrase/give more details/Example ?
While attaching a card I set it as default. So for any further payments (may it be subscriptions) it attaches that payment method only.
My problem is for the $0 invoice which I get after the trial subscription create, I don't get any payment_intent so no client secret as well so that I can confirm it for 3d auth cards. I need the payment for the subscription to be taken off session when the trail ends.
OK, so when creating a trial Subscription, you are using SetupIntent in order to collect the PaymentMethod and set it as default payment method for the customer. Now, once the trial period ends, in case that PaymentMethod requires additional action (e.g. 3DS auth), what you need to do, right ? well you'll have a new Invoice/webhook that'll notifies you you need to handle additional actions on the PaymentMethod:
https://stripe.com/docs/billing/subscriptions/webhooks#additional-action
You get the client_secret of the new PaymentIntent of the new Invoice (that has amount >0$ ) and use it for confirming the 3ds
Im not using the setupintent, rather just setting the card to be default in invoice settings.
$this->stripe->customers->update(
$customerID,
['invoice_settings' => ['default_payment_method' => $defaultPaymentMethod]]
);
You should be using SetupIntent, in order to authenticate the card and decrease the 3DS requests rates if you want
But you can still follow the second part of my reply an monitor the webhook event invoice.payment_action_required whenever a payment method need to be 3ds authenticated.
You'll have a PaymentIntent in the new invoice, use its client_secret.
Yes but with this I can't take it off session right. The user will have to log in the next time to authenticate once the trial has ended and confirm the subscripton.
You can't do 3ds authentication off_session in all cases, 3ds requires the customer to be on_session. But when using SetupIntent in order to collect Payments you have less chance to have a payment that request a 3DS.
Do we need to do the setupintent every time we try to take payment? Or do we just do it once after the customer is created?
You need to use SetupIntent every time a new PaymentMethod need to be collected.
Ok thanks.