#wayo
1 messages · Page 1 of 1 (latest)
Setup Intents and Subscriptions serve two very different purposes, they are not interchangeable.
Setup Intents are used for collecting customer payment method details without processing a payment while doing so.
Subscriptions are high-order objects that automatically generated Invoices and Payment Intents each billing period to automate the process of recurring payments.
I am moving from using the card element to using the payment element. This requires to create a payment intent to create the payment element. Will this cause an issue when creating a subscription ? Will it create duplicate PI?
No, the Payment Element can be used with Subscriptions. This guide walks through the process for creating a Subscription and using the Payment Element to collect the payment method details for the first payment:
https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
If you're planning to collect payment method details first, and then create the Subscription later, then that is a use case for Setup Intents.
If I collect payment details on one page and the subscription on the next page, is this still a use case for Setup Intents?
You could do that with a setup intent but we would typically recommend against it. Sometimes the bank will ask for authorization twice in that flow, or it could just be more difficult to handle if the payment fails even after the setup succeeds
So you can do that if you like that flow better, but we find it can cause more friction for your user
https://stripe.com/docs/payments/payment-element/migration
I am following the migration guide to payment element and on step 5 what exactly is stripe.confirmPayment doing? Will it try to take the payment? If i'm using subscriptions, should I skip this step?
Making the call to confirmPayment would attempt to charge the customer. If you are making a custom page, you will either be confirming a setup intent or payment intent here at some point
Like if you create the subscription first, you can call confirmPayment on the subscription's invoice's payment intent rather than creating a separate one
https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
When you say a custom page you mean I am not using the Stripes prebuilt checkout page?
Yes, the confirmPayment call that you mentioned would only be on your custom page. The pre-built Checkout page will handle this for you
https://stripe.com/docs/payments/ach-debit/accept-a-payment?platform=web&ui=API#web-collect-details
On this guide for ach direct debit, on step 4 collecting payment details, it says to call this function: stripe.collectBankAccountForPayment () . If i am using the payment element, I would instead use the function stripe.confirmPayment() ?
For the payment element you would still call confirmPayment That collectBankAccountForPayment call is only if you are integrating with ACH outside of the payment element
With the payment element, ACH will show up in the payment element itself and Stripe will handle the logic for it when you call confirmPayment
collectBankAccountForPayment() seems to create a payment method and automatically attaches it to the payment Intent. Does this mean I need to do that step manually or does it somewhere get taken care of automatically when creating a PI or calling confirmPayment?
That would happen automatically with confirmPayment as well
confirmPayment is the same call, it is just for any payment method that is currently on your payment element
To integrate ACH direct debit these are the steps I have so far:
- Create or retrieve customer
- Create a payment Intent and save client secret that is returned in response
- Create payment element with client secret
- Call
confirmPayment()function on submit of form and it will gather all details automatically and submits to stripe? I provide the element used to create the payment element in the function - Create subscription and attach the payment method to it
- setup webhooks for payment intents when a customer pays and is successful or fails.
Does this look good or what am I missing?
That will work but I think you can streamline it a bit. The guide I linked to shows a flow where you would essentially do this:
- Create or retrieve customer
- Create a subscription and save the
subscription.latest_invoice.payment_intent.client_secretthat is returned in response - Create payment element with client secret
- Call confirmPayment() function on submit of form, this will gather payment method details, complete the first payment, and attach the PM to the customer
- setup webhooks for payment intents when a customer pays and is successful or fails.
https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
So basically, you can create the subscription sooner which can make more happen for you automatically
Is the difference that it will attach the PM automatically?
oh I think the subscription automatically creates the PI . I thought one of the uses of PI is to manually list the payment methods under PI.create({ payment_method_types: ['us_bank_account','card',...] And also set the verification_method: 'instant'
Yeah, creating the subscription first would mean you create less objects and have to code less logic yourself
I think you can still make sure that that payment intent only allows instant verification as well, looking in to how to configure that
I also had a question on payment intents. When do I know I need to create a new one for a customer or use an existing one?
Payment Intents can't be reused, so if you have a new time that you want to charge the user, you would make a new payment intent
You can update payment intents before they succeed, so if you create one but then the user changes the item in their cart, it might make sense to just update the payment intent there
what is considered a new time? If I create a PI on page load, and user refreshes the page, I assume I would use the existing PI?
Hi 👋
I'm stepping as @random kettle needs to go. As long as you haven't charged the PI you can reuse it
Do I determine that with a status or how would I do that?
That would be up to your integrations architecture. It may be more straightforward to generate a new Payment Intent on your server with every page refresh but that is up to you
The payment element has the micro deposit link in the bank UI, how can I remove that from the UI?
Do you mean you want to accept US bank accounts as payment methods but not allow for micro deposit verification?
Yes. I am going to use instant verification
Can you show me where you are seeing that link?
https://stripe.com/docs/payments/payment-element
it shows up when you select us bank account type . It will be towards the bottom
Oh you mean the "enter details manually" link? I don't think you can disable that
any other way to prevent users from using this functionality?
You would specify the instant verification method when creating the Payment Intent. https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_options-us_bank_account-verification_method
I am already doing that but that didn't prevent the link from showing up.
Hmmm. It just did in my test integration
Hmm..I will take a look again then.
Here is the payload I used to generate the Payment Intent (I just tweaked a default function so it has card as an option as well)
{
currency: "usd",
setup_future_usage: "off_session",
statement_descriptor_suffix: "v314159",
payment_method_options: {
us_bank_account: {
verification_method: "instant",
},
},
amount: "13000",
payment_method_types: {
0: "us_bank_account",
1: "card",
},
}
I will try it. Thanks !