This is a base example server that lets you implement SPL token cashback through webhooks after each successful payment. For more details, head over to Docs.
- Fork the repo and make sure to change these 4 params,
tokenAddress
: Mint Address of SPL token which will be used as cashbacktokenDecimal
: Decimals of that tokencashback
: Amount of tokens to cashback for each $1 spentconnection
: Use custom RPC for reliable and fast experience
- Deploy the repo on a server platform like Railway
- Copy URL of the deployed server and head over to CandyPay dashboard. In the bottom of settings page, create a new webhook service entering name, description and URL of the server.
- On creation a
webhook secret
key will be generated, copy the secret key and add as env in the server
WEBHOOK_SECRET= 'webhook secret key'
SOLANA_PRIVATE_KEY= 'private key of solana wallet that will fund cashback tokens and gas fees'
- Add envs and redploy the server, and the cashback system is ready to go into action!