#lord-checkout-invoice

1 messages ยท Page 1 of 1 (latest)

misty apexBOT
opaque ridge
#

@hybrid silo Yes our Invoices API works without Subscription. What's the problem you have?

hybrid silo
#

Thanks for fast response, i'm using Stripe Lib in PHP for my case, and when i'm using the checkout to pay, it works well but invoice.paid and invoice.finalized webhook are not called, it does only when using a subscription mode

#

doing it to redirect to the checkout for unit amount price

opaque ridge
#

Do you have an example I can look at in Test mode that I can double check?

#

(we're both developers, please share real code as text not a picture)

#

lord-checkout-invoice

hybrid silo
#

Yes, sorry, here is my code which redirects to the Stripe checkout system

public function checkout(array $options): string
    {
        try {
            $session = Session::create(
                array_merge(
                    [
                        'customer' => $this->createOrGetStripeCustomer(),
                        'success_url' => config('app.client_url'),
                        'cancel_url' => config('app.client_url'),
                    ],
                    $options
                )
            );

            if (is_null($session->url)) {
                abort(404, 'unable to redirect to stripe');
            }

            return $session->url;
        } catch (ApiErrorException $e) {
            abort(400, $e->getMessage());
        }
    }

$url = $user->checkout([
            'mode' => 'payment',
            'line_items' => [
                [
                    'quantity' => 1,
                    'price_data' => [
                        'currency' => 'EUR',
                        'product_data' => [
                            'name' => 'Achat unitaire'
                        ],
                        'unit_amount' => $request->validated('amount')
                    ]
                ]
            ]
        ]);
#

and of course, invoice.finalized and invoice.paid webhooks are both enabled in my Stripe dashboard

opaque ridge
#

So that code never did anything about Invoices right?

hybrid silo
#

This code works for the redirection to the checkout, it calls the checkout.session.completed webhook afterwards but does not call invoice.paid or invoice.finalized webhook, maybe this is normal?

opaque ridge
hybrid silo
#

my god, I will try this

opaque ridge
#

yeah sory took me a lot longer than needed to find this too

#

had to look up in our codebase to get there ๐Ÿ˜… but it seems to be exactly what you want

hybrid silo
#

Thanks a lot, it seems to work, I searched everywhere for hours

opaque ridge
#

yeah I just yelled internally to get this doc somewhere discoverable

#

there are so many docs and features, it's hard to make sure everything is easy to find ๐Ÿ˜ฆ

hybrid silo
#

Yes I understand well, starting Stripe, I admit to getting a little lost in the documentation

opaque ridge
#

yeah it's tough to find the right balance ๐Ÿ˜ฆ

hybrid silo
#

In any case, thank you a lot, I won't bother you any longer