#Javimey-subscription-payment-element

1 messages · Page 1 of 1 (latest)

gritty lynx
#

Hey there

worldly berry
#

Hi !

#

I am sorry if I haven't explained my issue very good.

We implemented Card Elements without country. Now some payments have issues because we don't ask for Country + Zipcode.

CardElements doesn't seem to have country + zipcode and that logic seems to be in PayElements.

But PayElements "forces" us to use PaymentIntents. Our current implementation has been:
We create a PaymentIntent in our server with an amount, just to retrieve the paymentMethod.

And then with that paymentMethod we create the subscription

#

but we have that unnecessary step of the PaymentIntent, that will ended up being Incomplete and then Cancelled after 1 day.

gritty lynx
#

Hmm, you shouldn't need to create a Payment Intent. The Subscription object will have a PI if payment is required

worldly berry
#

yes, but our challenge here is getting the paymentMethod from our frontend using Payment Elements

#

With CardElements we were creating the payment method like this:

      type: 'card',
      card: cardElement,
      billing_details: {
        name: user?.name,
        email: user?.email
      }
    });
#

on the form handlesubmit

#

to be honest, we are simply trying to avoid replicating Stripe's logic on country + zipcode

gritty lynx
#

But we cannot create subscriptions without paymentMethod
How so?

worldly berry
#

Cool! But we wanted to improve our UI to increase conversion. So for that reason we had to implemnet StripeElements and we ended up with the country + zip issue.
We will create our own component for country + zipcode and send it to the billing details. Hopefully that will be enough

#

thank you @gritty lynx for your help today!

#

have an awesome day

gritty lynx
#

Indeed the Card Element will only request a ZIP code for certain locales

worldly berry
#

yes, Canada, UK and US

gritty lynx
#

So you'd need to have your own fields for that

worldly berry
#

ok

#

and for the country itself, where can I find a list of the values to pass on ?

#
string
2-letter country code if created through the PaymentMethods API. If it was originally created as a card or source, its format is not enforced.```
gritty lynx
#

There's no Stripe API for that. You'd need to source that from elsewhere

worldly berry
#

cool

#

awesome! Thank I will not take more of your time! Thank you again !

gritty lynx
#

Sure, np!