#sqooby_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/1288780782768361485
📝 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.
- sqooby_api, 5 days ago, 22 messages
hi! what exact API fields are you looking at and what do you see exactly versus what you're expecting to see?
So here's mine code that create invoice
try {
const { customerId, discount } = req.body;
console.log(discount);
const priceId = discount ? 'price_1PmyjOGZoi1Nxyrld3XmSdAz' : 'price_1PmuOWGZoi1NxyrlzM7n2JOc';
// Step 1: Create the invoice
const invoice = await stripe.invoices.create({
customer: customerId, // Replace with actual customer ID
auto_advance: true,
collection_method: 'send_invoice',
days_until_due: 7,
description: 'Faktura za produkt OnkoRadar za pośrednictwem WELLYSA S.A.',
on_behalf_of: 'acct_1Q0KDnLiTpTSqkuO'
},);
const invoiceItem = await stripe.invoiceItems.create({
customer: customerId,
invoice: invoice.id,
price: priceId
});
paidInvoice = await stripe.invoices.pay(invoice.id, {
paid_out_of_band: true,
});
const sentInvoice = await stripe.invoices.sendInvoice(invoice.id);
const hostedInvoiceUrl = paidInvoice.hosted_invoice_url;
res.status(200).send({
success: true,
sentInvoice,
hostedInvoiceUrl
});
} catch (error) {
console.error('Error processing invoice:', error);
res.status(400).send({ success: false, error: error.message });
}
});```
and here's screenshot invoce i got
it says that invoice is paid
but when we come to details of this invoice
'Zapłacona kwota' means ammount that i paid and it says 0
'Pozostała kwota' means ammount that i have to pay
i want to change this to be paid already
is it possible to modify this?
yeah I think that's just how paid_out_of_band works. Those values from from the underlying PaymentIntent, which hasn't been paid.
You can't change it. A workaround would be to not show this information to the customer and show them your own view of the invoice you create from the data in the API.
Okey
Is it possible to modify the view of invoice in api/dashboard to show customer that the already paid invoice?
Or should i create my own invoice?
well you can't change our Dashboard or hosted surfaces no. You can look at the API, see that "oh https://docs.stripe.com/api/invoices/object#invoice_object-paid_out_of_band is true for this invoice, so instead of sending the customer a link to the hosted_invoice_url or the PDF, I will render my own view of the invoice and show them that"
Okey
i get it
i have one more qustion
Cuz sending invoices is additional thing
my real payment is on paymentIntent, can i somehow links that paymentIntent with Invoice and send it to user? i saw that there is paymentIntent in invoice object is it possible? should it fix a problem?