Learn how to utilize dynamic payments in your application.
payment.succeeded
webhook event is triggered. You can then receive the Discord username as discord_username
or fields[0].input
in the request body of the webhook and grant the user their role.
This has many practical applications, for example, a site selling dynamic courses or other customizable products or services.
Grab the secrets
ey.xxxx
. Copy and securely store the API token.Next in your shop, create a new webhook. The webhook secret will look like this: whsk_xxx
. Copy and securely store the webhook secret.We are storing these two secrets as.env
file.Prepare backend
src
folder and add an index.ts
file:Build webhook receiver
Generate payment session
Send checkout link
Monitor payment.success event
payment.succeeded
event. Make sure to implement the necessary logic in the webhook handler.Grant app access
You've finished!