#andora_code
1 messages · Page 1 of 1 (latest)
👋 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/1418438212296249354
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- andora_api, 11 hours ago, 5 messages
In case it help, here is the customer id in test mode I have issue with : cus_SakHwP4Mg96yDL
Hi there, so basically you want to display a saved card in the checkout page, am I right?
exactly
Got it! Let me take a look at this customer
This customer has one payment method attached, but it doesn't meet the requirments for prefill https://docs.stripe.com/payments/existing-customers?platform=web&ui=stripe-hosted#prefill-payment-fields
i.e., its allow_redisplay isn't set to always, and billing_details[address] is empty
on my end everything seems to met requirements :
{
id: 'pm_1S8athBvZmAnxmFyDxbxHJEn',
object: 'payment_method',
allow_redisplay: 'always',
billing_details: {
address: {
city: null,
country: 'FR',
line1: null,
line2: null,
postal_code: '74960',
state: null
},
email: 'gwel.74@gmail.com',
name: 'Bob dylan',
phone: null,
tax_id: null
},
card: {
brand: 'visa',
checks: {
address_line1_check: null,
address_postal_code_check: 'pass',
cvc_check: null
},
country: 'US',
display_brand: 'visa',
exp_month: 4,
exp_year: 2028,
fingerprint: '1XKd2OsFA9T1SDrM',
funding: 'credit',
generated_from: null,
last4: '4242',
networks: { available: [Array], preferred: null },
regulated_status: 'unregulated',
three_d_secure_usage: { supported: true },
wallet: null
},
created: 1758175249,
customer: 'cus_SakHwP4Mg96yDL',
livemode: false,
metadata: {},
radar_options: {},
type: 'card'
}
Can you share with me the ID of the checkout session?
cs_test_b1Ecf6C8COsa4zX6on2Cy832d6CxgXrOgoPbylAEBNXNMgV3wyxdovhQGJ
I'm still working on this, and I'll let you know once I find anything
hello,taking over from my colleague!
Is there a reason why you're manually creating the PaymentMethod and then directly attaching it to the Customer, instead of using a SetupIntent?
No particular reason, because it wasnt working even with setup intent I tried to manually create the payment method
sorry, but can you try again with a new Customer, using a SetupIntent to ensure the PaymentMethod is correctly setup for future usage?
If you use a SetupIntent to save and attach the card to the Customer, and assuming you fulfil all the requirements that the PaymentMethod has a name, email, billing address, allow_redisplay: always, it should show. I suspect the problem right now, is that you aren't correctly setting it up for future usage by directly attaching it to the Customer without using a SetupIntent
Let me try
It doesnt seems to change anything. I did the whole setupintent but it still not showing up when access to the checkout session
can you share the corresponding Checkout Session id?
cs_test_b1JLrgJzsO2dY2zTO3gnmnTPOrKYVn8twx6PofJ31CwHigH8imXV5CsemS
I have the exact same problem in production even though all the payment method where setup using a setup intent
for example this checkout : cs_live_b1mIrxLyw5PtrVBqVL2VsCcbgsEMmYeDwPmby9i9mCy5Q28rGQm8gZujOz
cs_test_b1JLrgJzsO2dY2zTO3gnmnTPOrKYVn8twx6PofJ31CwHigH8imXV5CsemS is using the exact same customer that you used previously though. I would like to start afresh, so can you create a brand new customer, create a SetupIntent using the new customer, and create a PaymentMethod?
The thing is in production I already have all existing customer with payment method setup. I used to have a manual integration with the sdk but I'm migrating to using stripe checkout session instead, and even with a fresh customer if I create a checkout session with a new payment method, then cancel the subscription, buy a new subscription again the existing payment method is missing when trying to purchase a new subscription using the checkout session
I'm talking about this page
Just to make sure we are talking about the same thing
okay, onesec, let me take a step back and look at the livemode example : cs_live_b1mIrxLyw5PtrVBqVL2VsCcbgsEMmYeDwPmby9i9mCy5Q28rGQm8gZujOz
also in the docs it says : "By default, we only show payment methods set to always allow redisplay. You can display other previously saved payment methods by including other redisplay values in the Checkout Session, or by updating a payment method’s allow_redisplay setting to always"
but even with that it still doesn shows up
saved_payment_method_options: {
allow_redisplay_filters: ['always', 'limited', 'unspecified'],
},
for cs_live_b1mIrxLyw5PtrVBqVL2VsCcbgsEMmYeDwPmby9i9mCy5Q28rGQm8gZujOz - pm_1QqAF9BvZmAnxmFyzpnhHhl6 is what you set up and expected to see right? Can you add an email address to this PaymentMethod and then check if it shows on the Checkout Session
pm_1QqAF9BvZmAnxmFyzpnhHhl6 has a name, billing address, allow_redisplay: "always", but does not have an email address
Ok with the email address it shows up in production now but not in test mode
great! Can we try starting again from the beginning in testmode? That'll make it easier to figure out where things went wrong (if any)
yes
so create a new Customer, add a PaymentMethod - either via SetupIntent or Checkout Session with mode="setup" whichever one is more convenient for you, update it to ensure it has all the necessary details (if required), then create a Checkout Session with mode="subscription" with that new customer
Ok I managed to have it display in test mode, I just dont understand why the allow_redisplay is set to limited when creating a subscription using a checkout session
gimme a few minutes, let me check on that for you, I think that may be the default behaviour, but trying to see if we have any public documentation explaining why
aha! https://support.stripe.com/questions/prefilling-saved-cards-in-checkout explains why and how to handle things
we do mention here that
Subscription mode: Payment methods will be saved to the Customer when using Checkout in subscription mode in order to charge the payment method for recurring payments. These payment methods are saved with allow_redisplay: limited and will not be prefilled for return purchases. You can use saved_payment_method_options.payment_method_save to let customers save their payment method and prefill it on return purchases.
Slightly below, that doc also adds on saying :
Overriding the allow_redisplay value set through Checkout: You can use payment_method_data.allow_redisplay to override the allow_redisplay value that is set for payment methods saved through Checkout.
i think it would probably be easier if you defined the saved_payment_method_options.allow_redisplay_filters to filter for limited and always to account for PaymentMethods that have allow_redisplay set to either of these