#sqooby_api

1 messages · Page 1 of 1 (latest)

valid zodiacBOT
#

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

agile pawn
#

hi! what exact API fields are you looking at and what do you see exactly versus what you're expecting to see?

pine obsidian
#

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?

agile pawn
#

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.

pine obsidian
#

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?

agile pawn
pine obsidian
#

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?

valid zodiacBOT
agile pawn
#

no, you can't link an existing PI to an existing Invoice. The Invoice creates its own PI, that's it.

#

maybe you can avoid this whole thing by changing your flow to actually pay the Invoice itself and use its PaymentIntent? Might not be possible, I know

pine obsidian
#

As if it depended on me i would change it all XD

#

and make payment with the easiest way via link from dashboard

#

but clieeeeents