#mboras_api

1 messages · Page 1 of 1 (latest)

woven jayBOT
#

👋 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.

sharp canopy
#

this is what they say

stable pebbleBOT
storm meadow
#

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.

sharp canopy
#

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?

storm meadow
#

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

sharp canopy
#

ok, tnx for that

#

I still need to figure out what is happening with this subscriptions

storm meadow
#

Do you have the subscription IDs?

sharp canopy
#

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

storm meadow
#

I don't quite understand your laetst question.

sharp canopy
#

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

storm meadow
#

What veresion? Stripe SDK version?

sharp canopy
#

"stripe": "12.2.0",
now

storm meadow
sharp canopy
#

before "stripe": "8.69.0",

#

yeah

#

yeah

storm meadow
#

OK do you see any errors?

sharp canopy
#

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
}

storm meadow
#

Yes, customer obejct no long have sources property

sharp canopy
#

How can I retrieve sources then

#

Because right now in my app users can't see their payment methods

storm meadow
sharp canopy
#

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?

storm meadow
#

No it won't

sharp canopy
#

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'],
?

storm meadow
#

And yes you only include card in payment_method_types if you only want to accept card payment.

stable pebbleBOT
sharp canopy
#

in versions smaller than 11.2 users are not getting invoices on email after success payment in checkout?

dusty kiln
#

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.