#Khalil-orders-api

1 messages · Page 1 of 1 (latest)

fervent lance
heavy mica
#

Also, I am executing payments with orders (not payment intents), so no payment_intent.succeeded and charge.succeeded would be triggered, without an order being paid

#

My stripe listen --forward-to localhost:3000/stripe-webhooks returns

not sure if that's the correct API version, but I didn't add orders_beta=v4 (and don't know where to add it in case I need to)

fervent lance
#

can you copy/paste one of the event IDs (looks like this --> evt_abc123) to this thread for me to look at?

heavy mica
#

Which event id do you want me to copy? order related ones (the ones I am not getting), or payment intent ones (the ones I am getting)

fervent lance
#

The one you're not getting

heavy mica
#

evt_1LTXvkLEkeoA9qs7adVZnGJz

fervent lance
#

Hmmm, I thought it was compatible with the [2020-08-27] version, but I could be wrong. Are you able to upgrade to [2022-08-01] and try again?

heavy mica
#

I am upgrading my stripe cli version first, maybe it's that

#

the [2020-08-27] works with everything else orders related, so I doubt it just fails to work with the webhook endpoints

fervent lance
#

That's fair. I'm just not sure what would be causing the webhook not to be sent

#

Let me reach out internally and see if anyone has any ideas

#

You said you weren't getting any Orders events through, correct?

#

Ah, okay, so it looks like unfortunately stripe listen via Stripe CLI doesn't fully support beta webhook events. I figured (because it has been around for long enough) that it would just work, but I got confirmation from the product team that Orders just hasn't been integrated

heavy mica
#

ah got it! Thanks for asking!

#

This is really helpful

#

What is the best way to test my integration then?

#

Is there a way I can send test events not from the CLI

fervent lance
#

You would have to configure a webhook endpoint in test-mode, then create test-mode orders

#

That will send the same test-mode events that CLI would, it just requires more work

heavy mica
#
  • How do I configure a webhook endpoint in test-mode?
  • And what do you mean by creating test-mode orders? I am currently running my stripe app in test mode anyway (I am not in live mode)
fervent lance
#

You would need a real endpoint URL (e.g. a server that can send and receive HTTP requests), which you would configure here: https://dashboard.stripe.com/test/webhooks

Once configured, you would create Orders the same as you might do in live-mode, just using your test-mode API keys.

#

Not sure if that fully answers your questions though. Does the above orient you in the right direction?

heavy mica
#

Thanks for sending this over - currently giving it a look

#

Oh I think I already have most of it!
It's just a matter of configuring the webhook and I have the rest

#

The orders doc says in 2- Register a new webhook endpoint in the Stripe Dashboard with a beta header orders_beta=v4. (see doc here https://stripe.com/docs/orders/create-and-process?html-or-react=react#order-events), is there a specific way of adding a beta header? The main doc about registering a webhook doesn't mention how to add headers (https://stripe.com/docs/webhooks/go-live)

Complete your tested webhooks integration by enabling it on production.

Create orders, submit orders, and collect payment

#

I think I got an answer to my question

#

In practice, it seems like it will be hard for me to test this, since I am running the code on my local machine. So I think I'll just try to use payment intent events for now and infer which orders they belong to

#

Do you have a sense when the stripe cli integration will be available?

fervent lance
#

Ah, I'm not entirely sure. I can't say unfortunately

heavy mica
#

Sounds good - thank you for the help!

#

Appreciate the time you spent helping me, and you saved me a bunch of time

fervent lance
#

I don't love the answer I gave, but I'm happy I could save you some toil nonetheless!

heavy mica
#

No worries, I know you're not the one responsible for prioritizing the feature 🙂

#

Here's the workaround I am using for future reference.
1- I am adding a checkout id as a metadata in my order when I create it (checkout_id is internal to my app, but you could imagine adding the order_id)
2- I am capturing the payment intent events in the webhooks.
3- It appears that the orders propagate the metadata to the payment intents. Here is a display of my payment intent captured from the webhook:

metadata: {
      checkout_id: 'c24b5af8-16e2-4bb6-9a11-208e1abc3501',
      email: 'khalilhajji91@gmail.com'
    },

4- I get the checkout_id, which allows me to get the order corresponding to that checkout id