#cnguyen

1 messages ยท Page 1 of 1 (latest)

crisp sealBOT
feral mauve
#

On the Stripe example, we have to create the customer first, then create the PI with the cus_XXX (to have the pi_secret) and init the Stripe Element with the pi_secret. Then make the payment.

#

But, on my side, I arrive to the payment form with the customer info, the price and the Stripe Element already displayed

#

And, when the user enter his card and click pay. I would like to create the customer, then create the pi and validate it. Something like that. TO avoid to make multiple call to the WS (one for customer creation and create the pi. Then display the card form to add the pi_secret infos inside. Not sure about the flow

#

And on my pi, I will set the offline setup_future_usage for later

quasi lava
#

Yes currently for using the payment element you need to create the intent first, though we're working on offering more integration patterns here

feral mauve
#

OK so with Stripe Element, there is no choice to create the PI first

#

It means I have to create the customer first too ? And if I want to create the customer only on payment success?

#

So :

  • Before to display the card form, I have to call a WS to create the customer. And create the PI with the customer info (in order to have the customer with the attached pm)
  • I receive the pi_secret. Then I can display the form.

So, if the user decide to do nothing on the payment page, I will have a "losing" PI and customer ?

#

I thought that we can use the StripeElement to have a pm_XXX. Then I can call a WS with the pm_XXX and create the customer and the pi_XXX with that. Then, the user can validate the payment?

Like that I create the customer and the PI only after that the shopper is OK to pay (enter his credit card and valid)

quasi lava
#

You can't currently create the PM like that first, no, but we're working on that ๐Ÿ™‚

#

Yes, you'd need to create the PI up front for now, then cancel it and/or delete a customer if you're using customers

feral mauve
#

mmmm ok

#

And when I create the customer (using the email id), I have to check if the customer exist before to create him ?

#

And, are you sure because I see that there is a the stripe.createPaymentMethod ?

quasi lava
quasi lava
feral mauve
#

oh sorry I would like to speak about the cad element since the beginning

#

Card elemnt is possible with html css php ?

whole dagger
#

Yes you would be able to use the card element with all of those

feral mauve
#

I will check

#

So the flow with the card element could be more interesintg to avoid to create customer for nothing non ?

whole dagger
#

You could certainly use that to avoid having to create a customer if that wouldn't work for your needs

#

That being said you can re-use customer/payment intent objects, so recycling them could potentially be less cumbersome if you don't like creating so many

feral mauve
#

OK

#

And What is the best option between the card element and the stripe element ?

#

with the card element, I have to attach the customer and the PM myself ?

whole dagger
#

We typically recommend using the payment element as it is newer and more feature-rich

#

Sometimes creating extra objects isn't great but can be worth the functionality you get in return

feral mauve
#

ok so for you, the best is to create the payment element with the pi_secret

#

and to do that, I have to create the customer and the pi before to display the payment element to the customer

#

right ?

whole dagger
#

That is the typically recommended path but you can use the older element if that makes more sense for you

feral mauve
#

ok I will take a look. With the Card Element, I have to create the pi before anyway ? Or it means that I can wait to have the pm_XXX generated by the Card Element, then create the PI with the pm_XXX generated ?

solemn crane
feral mauve
#

so it's exactly the same than the Stripe Element. No advantage to use it

solemn crane
#

Correct

feral mauve
#

OK I will use the new way so

#

And to check if the customer exists. What is the best way ?

solemn crane
feral mauve
#

oh it's a new feature to search like that !

solemn crane
#

Yep! It has been around for a little while at this point, but I believe it's less than a year old

feral mauve
#

ok great. I wasn't up to date

#

I have to update my apiVersion: '2020-08-27' so ?

solemn crane
feral mauve
#

I have to specify it in my stripe dashboard too ? or I cann let the old versin ?

#

because I'm afraid to break something

solemn crane