#ayushh_webhooks

1 messages ¡ Page 1 of 1 (latest)

cunning frostBOT
#

👋 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/1326113239930634250

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

vivid fossil
#

hi! what does the complete code of your webhook endpoint look like?

#

also the error message should link to the stripe-node repository which has some working examples + more info

tranquil grove
#

I already have the webhook secret in my env

vivid fossil
tranquil grove
#

the code is pretty much similar

#

I have just created a controller and mapped to a route

#

router.post("/api/webhook", stripeWebhookController)

vivid fossil
tranquil grove
#

in app.ts
I have used
app.use(express.json());

#

that should've worked right?

vivid fossil
#

no.

#

please check the code shared. You want to not use express.json for the webhook route, that is what the code is doing

tranquil grove
#

oh

#

ok

#

thanks

#

lemme try it

#

{
"error": "Webhook Error: No webhook payload was provided."
}

vivid fossil
#

I'd need to see your complete code again to say anything

tranquil grove
#

app.ts

#

postRoutes.ts

vivid fossil
tranquil grove
#

I am adding

tranquil grove
#

This one

vivid fossil
#

then the issue is probably missing the middleware as I described

tranquil grove
#

checking

vivid fossil
#

I'd also suggest just using the exact sample we provide, confirming that works for receiving the webhook, and then slowly integrate it with the rest of your code

tranquil grove
#

oh

#

oka

#

I will definitely use the same code snippet

#

hey

#

it worked

#

thanks

#

I have another question if we can do in this thread

#

as I said, I will have a rideshare app where users can select the drivers. so the driver is also doing business and the company is also doing business. We want to automate payment process. The driver will need to connect their stripe account on the site.

#

The driver needs to pay 15%, but the payment is going to company's account now from the checkout, so is it possible that the rest 85% goes to the driver's stripe account automatically

vivid fossil
tranquil grove
#

suppose if the ride costs 100$ and the 15% which is 15$ needs to be in the

payment_intent_data: {
    application_fee_amount: 1500,
    transfer_data: {
      destination: '{{CONNECTED_ACCOUNT_ID}}',
    },
  },

Over here? in the application_fee_amount?

vivid fossil
#

you'd write code to determine what amount the platform should keep, and you pass that amount as application_fee_amount yes