#jarek-webhook-connect

1 messages · Page 1 of 1 (latest)

simple compassBOT
sacred goblet
#

If you delete the webhook and recreate it, that should work

waxen flower
#

Hmm. For some reason our webhook is never getting hit. But when I test locally, it is.

#

I checked all the basic stuff, like the whsec secret, which is also added to our .env file in GL

#

I added a bunch of logs and deployed it to test and it's not even hitting the endpoint

sacred goblet
#

Do you have an example event ID that you're expecting to hit your deployed endpoint?

waxen flower
#

This is what we're trying

case 'checkout.session.completed': {
        const stripeResponse = await StripeClient.checkout.sessions.retrieve(
          event.data.object.id,
          { expand: ['line_items', 'line_items.data.price.product'] },
          { stripeAccount: event.account },
        )

        const lineItems = stripeResponse.line_items
        // Check if the order is paid (for example, from a card payment)
        //
        // A delayed notification payment will have an `unpaid` status, as
        // you're still waiting for funds to be transferred from the customer's
        // account.
        if (stripeResponse.payment_status === 'paid') {
          addOrderToFirebase(stripeResponse, lineItems)
        }

        break
      }

sacred goblet
waxen flower
#

This one, but it was triggered locally evt_1OUu0FFNCC3cxje5r44JTBro

sacred goblet
#

Did you intentionally crate your deployed endpoint as a connect webhook endpoint? Or did you. mean to create an "account" type one?

waxen flower
#

It's for handling stripe checkout sessions when someone purchases a product. It should send the payload to .../webhooks/orders, which we then save to our db.

#

It was working, but I recently updated our frontend to create a session like this using transfer_data

const session = await stripe.checkout.sessions.create({
line_items: lineItems,
metadata: {
organizationId: config.public.orgId,
},
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
allow_promotion_codes: true,
payment_intent_data: {
transfer_data: {
destination: stripeConfig.account,
},
on_behalf_of: stripeConfig.account,
},
billing_address_collection: 'required',
shipping_address_collection: {
allowed_countries: ['US', 'CA'],
},
mode: 'payment',
});

return session;
sacred goblet
#

Yes, but is there a reason you made it "connect" webhook endpoint and not an "account" one? If you're not using the Stripe-Account header the Checkout Sessions will be created on the platform account, not the connected one

waxen flower
#

Our customers will have a Connect account, connected to our platform account. Is that what you're asking?

#

For some reason the accounts are receiving the payments, but we're just not getting the webhook request

#

This is the stripeAccount that is getting the test payments acct_1O1Ci9FKaLkdf1TY

#

When the checkout.session.completed session is done, the Connect account user does get the payment. However, we're not getting anything to the webhook.

sacred goblet
#

Sorry letme back up - based on what you've shared you're creating CHeckout Session on the Platform account (not the connected one). When the payment is done, on the platform some portion of the funds are automatically transferred to the connected account.

#

Since the Checkout Session is still being actually created on the Platform, you need an Account webhook endpoint in order to get the Checkout Session events you expect

waxen flower
#

Ok I'll try that, can you give me a second?

#

Thanks for your help, going to test...

sacred goblet
#

👍

simple compassBOT
#

jarek-webhook-connect

waxen flower
#

ohhhhk I did get something. I get it, so now it's "pay us, we'll transfer it to this connected account" so its now our checkout session, not the connected account.

sacred goblet
#

Yup!

waxen flower
#

You are awesome thank you!