#wayo

1 messages · Page 1 of 1 (latest)

untold skiffBOT
timid flame
#

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.

woeful sphinx
#

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?

timid flame
#

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.

woeful sphinx
#

If I collect payment details on one page and the subscription on the next page, is this still a use case for Setup Intents?

random kettle
#

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

woeful sphinx
random kettle
#

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

woeful sphinx
#

When you say a custom page you mean I am not using the Stripes prebuilt checkout page?

random kettle
#

Yes, the confirmPayment call that you mentioned would only be on your custom page. The pre-built Checkout page will handle this for you

woeful sphinx
random kettle
#

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

woeful sphinx
#

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?

random kettle
#

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

woeful sphinx
#

To integrate ACH direct debit these are the steps I have so far:

  1. Create or retrieve customer
  2. Create a payment Intent and save client secret that is returned in response
  3. Create payment element with client secret
  4. 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
  5. Create subscription and attach the payment method to it
  6. setup webhooks for payment intents when a customer pays and is successful or fails.

Does this look good or what am I missing?

random kettle
#

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:

  1. Create or retrieve customer
  2. Create a subscription and save the subscription.latest_invoice.payment_intent.client_secret that is returned in response
  3. Create payment element with client secret
  4. Call confirmPayment() function on submit of form, this will gather payment method details, complete the first payment, and attach the PM to the customer
  5. 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

woeful sphinx
#

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'

random kettle
#

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

woeful sphinx
#

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?

random kettle
#

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

woeful sphinx
#

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?

dreamy siren
#

Hi 👋

#

I'm stepping as @random kettle needs to go. As long as you haven't charged the PI you can reuse it

woeful sphinx
#

Do I determine that with a status or how would I do that?

dreamy siren
#

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

woeful sphinx
#

The payment element has the micro deposit link in the bank UI, how can I remove that from the UI?

dreamy siren
#

Do you mean you want to accept US bank accounts as payment methods but not allow for micro deposit verification?

woeful sphinx
#

Yes. I am going to use instant verification

dreamy siren
#

Can you show me where you are seeing that link?

woeful sphinx
dreamy siren
#

Oh you mean the "enter details manually" link? I don't think you can disable that

woeful sphinx
#

any other way to prevent users from using this functionality?

dreamy siren
woeful sphinx
#

I am already doing that but that didn't prevent the link from showing up.

dreamy siren
#

Hmmm. It just did in my test integration

woeful sphinx
#

Hmm..I will take a look again then.

dreamy siren
#

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",
  },
}
woeful sphinx
#

I will try it. Thanks !