#mboras_api
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/1229332433602613289
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
this is what they say
For req_MK1QJFLsFdFTGt, if you check the error message of the API response, you'll see that the payment failed due to insufficient funds
I don't hink the number of attached payment methods have a direct relationship to the payment failure.
it seems to me that checkout is overriding their default cards inside of my app
I have stripe subscription payment in-app and one-time payments in checkout
This is how I create my checkout for one-time payments
const session = await stripe.checkout.sessions.create({
mode: 'payment',
line_items,
success_url: successUrl,
cancel_url: cancelUrl,
invoice_creation: {
enabled: true,
},
locale: 'en',
metadata,
customer_email: email,
});
also one more question
why is new customer created everytime even I use same email?
No, a checkout session doesn't override a customer's invoice_settings.default_payment_method
That's beceause you didn't specify a customer when creating a checkout session
ok, tnx for that
I still need to figure out what is happening with this subscriptions
Do you have the subscription IDs?
yeah
sec
sub_1OXJ4hC4aQ7SQOwJ0D6GdeAf
also one more question, I found one error
I've updated stripe on backend from version 8 to version 12
export const getCustomerById = onCall(async request => {
if (!request.auth?.uid) throw new Error('Unauthorized.');
const customerId = request.data.customerId;
return await stripe.customers.retrieve(customerId);
});
const sources = useMemo(() => customer?.sources?.data || [], [customer]);
I don't see any sources for payment method with update of stripe
https://dashboard.stripe.com/payments/pi_3P4JPNC4aQ7SQOwJ19z2WDAE the payment failed because of insufficient funds
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I don't quite understand your laetst question.
ok the issue is absolutely with their insufficient funds which is not error from stripe or our code
but this is an issue in app
I've updated stripe on backend from version 8 to version 12
This code was previously returning in customer object sources (payment methods)
export const getCustomerById = onCall(async request => {
if (!request.auth?.uid) throw new Error('Unauthorized.');
const customerId = request.data.customerId;
return await stripe.customers.retrieve(customerId);
});
const sources = useMemo(() => customer?.sources?.data || [], [customer]);
Now I can't see any sources
What veresion? Stripe SDK version?
"stripe": "12.2.0",
now
You mean the Stripe Node.js SDK version? https://github.com/stripe/stripe-node/blob/master/CHANGELOG.md
OK do you see any errors?
I don't see any errors on that requeest
BUt I don't see sources property at all
{
"id": "cus_PtR8W5hdBo25vm",
"object": "customer",
"address": null,
"balance": 0,
"created": 1712667546,
"currency": "aud",
"default_source": "src_1P3eGOC4aQ7SQOwJYdmOWL0c",
"delinquent": false,
"description": null,
"discount": null,
"email": "marko.boras+110@prototyp.digital",
"invoice_prefix": "1AA0389B",
"invoice_settings": {
"custom_fields": null,
"default_payment_method": null,
"footer": null,
"rendering_options": null
},
"livemode": false,
"metadata": {},
"name": null,
"next_invoice_sequence": 2,
"phone": null,
"preferred_locales": [],
"shipping": null,
"tax_exempt": "none",
"test_clock": null
}
Yes, customer obejct no long have sources property
How can I retrieve sources then
Because right now in my app users can't see their payment methods
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok one more qeustion
if I pass in checkout customerID and user pays in it with some new card
it won't update default payment method on customer object?
No it won't
ok
I'll now try to revert first to 8.69.0 to have everything as before
one more q
const session = await stripe.checkout.sessions.create({
mode: 'payment',
line_items,
success_url: successUrl,
cancel_url: cancelUrl,
invoice_creation: {
enabled: true,
},
locale: 'en',
metadata,
customer_email: email,
});
It doesn't allow in version 8.69.0 property invoice_creation. Will that mean that my users will not get after successful payment invoice on email?
And I need to pass required property payment_method_types. If I want users to pay only with credit card I just do payment_method_types: ['card'],
?
Correction. the customer object still have sources property, it's not included by default, and you need to expand it. Ref: https://docs.stripe.com/upgrades#:~:text=The sources property on Customers is no longer included by default. You can expand the list but for performance reasons we recommended against doing so unless needed.
https://github.com/stripe/stripe-node/blob/master/CHANGELOG.md#1120---2022-12-06 invoice_creation is added in version 11.2. You need to update to this version or above to use this param
And yes you only include card in payment_method_types if you only want to accept card payment.
in versions smaller than 11.2 users are not getting invoices on email after success payment in checkout?
depends what you mean by that. Receipts are always sent. Sending Invoices after the payment in Checkout is specifically an opt-in and paid feature.