#idemoov-lo_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/1413502414497120328
๐ 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.
- idemoov-lo_api, 2 hours ago, 29 messages
[Nest] 18 - 09/05/2025, 2:28:48 PM ERROR No charge found for payment inpay_1S3ykx5EyZyp1Ds5DUREfpwH
id=inpay_1S3ykx5EyZyp1Ds5DUREfpwH object=invoice_payment amount_paid=999 amount_requested=999 created=1757075323 currency=eur invoice=in_1S3ykx5EyZyp1Ds5k0dTslpH is_default=true livemode=false payment={"payment_intent":"pi_3S3ykx5EyZyp1Ds50E2n6Wz6","type":"payment_intent"} status=paid status_transitions={"canceled_at":null,"paid_at":1757075324}
๐ happy to help
please read through https://docs.stripe.com/changelog/basil/2025-05-28/partial-payments
code for context
payments = stripe.invoicePayments.list({ invoice: invoice.id }, { stripeAccount: accountId });
for (const payment of payments) {
const charge =
typeof payment.payment.charge === 'string'
? await this.stripeService
.getInstance()
.charges.retrieve(payment.payment.charge, { stripeAccount: accountId })
: payment.payment.charge;
if (!charge) {
this.logger.error(`No charge found for payment ${payment.id}`);
this.logger.debug(JSON.stringify(payment));
}
const balanceTransaction =
typeof charge.balance_transaction === 'string'
? await this.stripeService
.getInstance()
.balanceTransactions.retrieve(charge.balance_transaction, {
stripeAccount: accountId,
})
: charge.balance_transaction;
application_fee += charge.application_fee_amount ?? 0;
stripe_fee += (balanceTransaction?.fee ?? 0) - (charge.application_fee_amount ?? 0);
net_amount += balanceTransaction?.net ?? 0;
}
}
sorry I meant to send this one https://docs.stripe.com/changelog/basil/2025-03-31/add-support-for-multiple-partial-payments-on-invoices
there was a breaking change
ah yes my code trigger when webhook event invoice.paid
please read through the changelog to understand more about the context
So charge should exist on payment no ?
I saw that charge was removed from invoice it's why I get the payments of the invoice
yes
In my case why I don't have payment.payment.charge defined ?
it's better to get the payment intent https://docs.stripe.com/changelog/basil/2025-03-31/add-support-for-multiple-partial-payments-on-invoices#use-the-new-for-payments-and-invoice-connection
I already did that here
if (typeof payment.payment.payment_intent === 'string') {
paymentIntent = await this.stripeService.getPaymentIntent(
payment.payment.payment_intent,
accountId,
);
} else {
paymentIntent = payment.payment.payment_intent;
}
instead of that you can see the type property as suggested in the doc I sent you
there's the charge object on paymentIntent ?
yes the latest_charge
I don't see the type property? What is it or is there a better way then what I am doing rn ? It's to get the balance transaction and the applied application fee
const balanceTransaction =
typeof charge.balance_transaction === 'string'
? await this.stripeService
.getInstance()
.balanceTransactions.retrieve(charge.balance_transaction, {
stripeAccount: accountId,
})
: charge.balance_transaction;
application_fee += charge.application_fee_amount ?? 0;
stripe_fee += (balanceTransaction?.fee ?? 0) - (charge.application_fee_amount ?? 0);
net_amount += balanceTransaction?.net ?? 0;
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ha my bad I saw it in the doc I am a little dumb
So i should use type charge to get the charge directly ?
it depends whether the payment has the charge or not
you either get the PaymentIntent or the Charge
you need to think that in most cases you'll get the PaymentIntent
Ah yes I never saw a payment of type charge for now
you should still handle both cases
ok so in one case there is payment.payment.charge and in the other case payement.payment.payment_intent
It help me a lot thank you very much
payment.payment.payment_intent.latest_charge
There's always this prop you mean ?
I understood that there's this prop on payment intent
I mean what you can do is get the charge ID from either case and then retrieve the balance transaction
I understand but in this case id=inpay_1S3ykx5EyZyp1Ds5DUREfpwH object=invoice_payment amount_paid=999 amount_requested=999 created=1757075323 currency=eur invoice=in_1S3ykx5EyZyp1Ds5k0dTslpH is_default=true livemode=false payment={"payment_intent":"pi_3S3ykx5EyZyp1Ds50E2n6Wz6","type":"payment_intent"} status=paid status_transitions={"canceled_at":null,"paid_at":1757075324}
I don't have it so I need to add expand ?
oh yes you do need to retrieve the paymentIntent to get the latest_charge
ok everything good for me thank you for your help