#Javimey-subscription-payment-element
1 messages · Page 1 of 1 (latest)
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.
Hmm, you shouldn't need to create a Payment Intent. The Subscription object will have a PI if payment is required
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
But we cannot create subscriptions without paymentMethod
How so?
To be clear the recommended flow is:
- Create Subscription server-side
- Collect payment method (with Payment Element) and then confirm
https://stripe.com/docs/billing/subscriptions/build-subscription
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
Indeed the Card Element will only request a ZIP code for certain locales
yes, Canada, UK and US
So you'd need to have your own fields for that
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.```
There's no Stripe API for that. You'd need to source that from elsewhere
Sure, np!