#Juls

1 messages · Page 1 of 1 (latest)

high tigerBOT
rough surge
#

The setupintent generate by the Subscription has no differences with your manual created SetupIntent

#

You should bring back your client-side integration and confirm it like you would do with your manually created one

#

Once it's confirmed, the Subscription will be activated and its first Invoice will be attempted

vast flint
#

Currently, we ignore the setup intent and the client secret generated automatically, and the 0.00$ invoice gets paid all the same, and the subscription get Active anyway (status is Trial). You mean this is wrong?

When I create manually the Setup Intent, should I update the subscription's pending_setup_intent field?

high tigerBOT
dark sail
#

Hey! Taking over for my colleague. Let me catch up.

#

When I create manually the Setup Intent, should I update the subscription's pending_setup_intent field?
Why you are creating a SetupIntent manually and not using the one created by the Subscription automatically ?

vast flint
#

Because the Setup Intent is supposed to be used when our customer adds the payment details. This might happen at some point during the trial period

#

At the moment of subscription creation, there are no payment details to be confirmed

#

The Setup Intent is needed to validate the CC, whether we need SCA prompt or not

#

The Setup Intent that gets created automatically might get closed after some days of inactivity, right?

When I create a new Setup Intent, I pass it the payment details token id as parameter. Like this:

{ "usage": "off_session", "payment_method_types": { "0": "card" }, "payment_method_data": { "type": "card", "card": { "token": "tok_1NH2YLDdnv1FNFqCftjsS5Al" } }, "customer": "cus_O38jTrG4rXmc5a" }

dark sail
#

The Setup Intent that gets created automatically might get closed after some days of inactivity, right?
Nope.

dark sail
vast flint
#

I thought using the Payment Method API directly was discouraged

dark sail
#

Ah sorry, I wasn't enough clear, what I meant by using the PaymentMethod, is not using Sources and Token

#

betwee, I still don't understanding why you want to create a Setup intent and not using the one provided by the SetupIntent. If you have already a PaymentMethod Id, you can use it when creating the Susbcription directly:

vast flint
#

When creating a subscription I still don't have a payment method attached to the customer

#

Because the subscription is on trial

dark sail
#

So you can use the SetupIntent created by the Susbcription to collect the PaymentMethod from the customer ?

vast flint
#

What you are suggesting is that, instead of creating a new Setup Intent, I UPDATE the existing Setup Intent autogenerated with the payment method Id, so the card can be validated by the user?

#

Also, I'm not sure if I understood about using tokens. The token Id is needed to send all the credit card info to our backend.

The other way to do it is to create a Payment Method using the API directly, then attaching the payment method Id to the customers and subscription source.

Am I getting it right?

dark sail
#

What you are suggesting is that, instead of creating a new Setup Intent, I UPDATE the existing Setup Intent autogenerated with the payment method Id, so the card can be validated by the user?
So. you have the PaymentMethod here already before creating the Subscription.
But you were saying:
When creating a subscription I still don't have a payment method attached to the customer
I'm a bit confused here...

#

How are you collecting the PaymentDetails from your customer ?

vast flint
#

First:

We create a subscription on trial with just one click on our page. We still don't collect payment details because we're on trial

After the trial has been created:

We have a form where our users can enter the billing data and the credit card details. The subscription already exists

#

If the user doesn't enter the credit card during the 30 day trial period, the sub will get cancelled

#

The autogenerated setup intent is created when we create the trial subscription. That is the part that confuses me, because no payment details are attacched just yet to the customer

dark sail
#

The autogenerated setup intent is created when we create the trial subscription. That is the part that confuses me, because no payment details are attacched just yet to the customer
So you can this SetupIntent in order to collect the PaymentMethod of the customer.

vast flint
#

That makes sense

#

Should I use the token Id or not? I've seen the deprecation warning about the Source API, but not about the token Id

#

Currently:

  • I attach the token id to the setup intent. That returns a client secret
  • I pass the client secret to the frontend, where it gets confirmed using the Stripe JS libraries
  • The stripe JS libraries return the card ID of the newly created payment method
  • I send this card ID to the subscription, to update the default default_payment_method. I also update the customer default source with it
high tigerBOT
dark sail
vast flint
#

I think I understand it better now. Thank you

#

Looks like I only need to manually create Setup Intents when I update the existing payment details, right? In this case, I would need to use token Id

south cipher
#

You create a SetupIntent in use cases where you would like to accept some payment/card details from a customer and save them in order to be able to charge them later.
Not sure what you mean by a "token ID".

#

Note also you can just use the CustomerPortal to give the customer a self-serve way to update their details and it's easier if you don't require a custom/whitelabel page yourself. https://stripe.com/docs/customer-management

vast flint
#

The token Id is what I use to send the credit card info to our backend

#

If I'm updating my existing credit card

south cipher
#

why Tokens (tok_xxx)instead of PaymentMethods pm_xxxx?

vast flint
#

I read somewhere (or I think I did) that using directly the Payment Method API was discouraged

#

Should I use the Stripe JS functions to create the payment method? Then use the returned pm_xxxx to attach it to the customer/subscription?

south cipher
#

you'd use a SetupIntent and it creates the PaymentMethod

#

create SI on backend -> client secret to frontend -> frontend calls confirmSetup using the secret and an instance of the PaymentElement in your DOM -> that creates a PaymentMethod from the card details the customer has entered in the Element -> it confirms the SetupIntent, and if that's successful the PaymentMethod has been attached to the customer.
https://stripe.com/docs/payments/save-and-reuse?platform=web

vast flint
#

frontend calls confirmSetup using the secret and an instance of the PaymentElement in your DOM

Ok, that was indeed the source of my confusion. Thanks for confirming it.