#sahil_api

1 messages ยท Page 1 of 1 (latest)

granite fieldBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1229863457151520778

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

knotty cradleBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

pliant aspen
#

The reason they work differently is that they're different products with different features and use cases. The Payment Element is designed to be used and implemented by a developer who writes code to get the exact behavior they want. The Customer Portal can be implemented without code and has a closer relationship to things like Subscriptions than the Payment Element does, thus it has different features, functionality, and defaults.

latent stump
#

Can I do that while creating a customer?

knotty cradleBOT
latent stump
#

oh that needs the exact ID of the payment method, right?
I won't have that when creating the customer
In our product, the customer is created much before a subscription is created

pliant aspen
#

Yep, you need the ID of the Payment Method you want to be the default.

latent stump
#

ok, I see this option won't work for me then

#

Besides, I see that the subscription.default_payment_method is set when adding the card
So can I be certain that either one of customer.invoice_settings.default_payment_method or subscription.default_payment_method will be set ?

#

to be clear, what I see is PaymentElement sets subscription.default_payment_method
and BillingPortal sets customer.invoice_settings.default_payment_method

pliant aspen
#

When you say Payment Element does that, what do you mean exactly?

latent stump
#

the PaymentElement from @stripe/react-stripe-js

pliant aspen
#

Yeah, I mean, what does your code look like? I think your code is setting it, not the Payment Element itself?

latent stump
#

What I meant is when our users are adding their card through PaymentElement, the subscription object has subscription.default_payment_method but customer.invoice_settings.default_payment_method is nil

But when they add their card through the BillingPortal it's vice versa

shut dock
#

๐Ÿ‘‹ As Rubeus mentioned earlier, they're different products with different features and use cases

latent stump
#

Yeah so can I be certain that atleast one of the fields will always be set regardless of how the card was added?

#

I am sorry to let you know that my laptop's battery is soon gonna drain, I don't have a power source at the moment

shut dock
#

I see that the subscription.default_payment_method is set when adding the card
The payment method is added on the subscription when you confirm the PaymentIntent/SetupIntent associated with the subscription invoice.