Payment Providers
Connect Stripe, PayPal, Razorpay, Polar or NOWPayments, and set up their webhooks.
Set up only the providers you want to use. Each one needs its API keys in configuration/store.json5 and a webhook, so AthenaBot hears about payments.
Webhook Address
Webhooks go to AthenaBot's web_api plugin, which listens on port 3111 by default. Providers need a public HTTPS address, so put a reverse proxy in front of it. Pick yours:
Caddy gets and renews HTTPS certificates on its own. Add this to your Caddyfile and reload Caddy.
shop.example.com {
reverse_proxy 127.0.0.1:3111
}sudo systemctl reload caddyThen set base_ip in configuration/web_api.json5 to shop.example.com. Each provider's webhook URL is:
https://shop.example.com/api/store/webhook/<provider>Every webhook is checked against its provider's secret before anything is given out. A provider with no secret set rejects all webhooks with a 500, so fill in the secret for every provider you use.
If a provider sends the same payment twice, Store notices the transaction ID it already saved and skips it, so rewards are never given twice.
Stripe
- In the Stripe Dashboard, go to Developers > API keys and copy the Secret key.
- Go to Developers > Webhooks, add an endpoint at
https://<your-domain>/api/store/webhook/stripeand select thecheckout.session.completedevent. - Copy the endpoint's Signing secret.
stripe: {
secret_key: "sk_live_...",
webhook_secret: "whsec_...",
},Use sk_test_... keys and a test webhook to try it without real payments.
The checkout page offers whatever payment methods you turn on under Settings > Payment methods in the Stripe Dashboard, such as cards, Apple Pay or Link.
PayPal
- In the PayPal Developer Dashboard, create an app under Apps & Credentials and copy its Client ID and Secret.
- In the app, add a webhook at
https://<your-domain>/api/store/webhook/paypalwith thePAYMENT.CAPTURE.COMPLETEDevent. - Copy the Webhook ID.
paypal: {
client_id: "",
client_secret: "",
webhook_id: "",
mode: "live",
},Set mode to sandbox with sandbox credentials to test.
Razorpay
- In the Razorpay Dashboard, go to Account & Settings > API Keys and generate a key.
- Go to Webhooks, add
https://<your-domain>/api/store/webhook/razorpaywith thepayment_link.paidevent. - Set a Secret on the webhook and copy it.
razorpay: {
key_id: "rzp_live_...",
key_secret: "",
webhook_secret: "",
},Polar
- In Polar, create a product for each item you sell and copy each one's Price ID.
- Under Settings > Developers, create an Access Token.
- Under Settings > Webhooks, add
https://<your-domain>/api/store/webhook/polarwith theorder.createdevent and copy its secret.
polar: {
access_token: "",
webhook_secret: "",
server: "production",
},Add polar_price_id to every product sold through Polar. Set server to sandbox to test.
Crypto (NOWPayments)
- Create an account at NOWPayments and generate an API key.
- Under Settings > Payments > Instant payment notifications, set the IPN callback to
https://<your-domain>/api/store/webhook/cryptoand copy the IPN secret.
crypto: {
api_key: "",
ipn_secret: "",
},A crypto purchase completes when NOWPayments marks it finished, which can take a while depending on the coin.
Testing
- Use each provider's test or sandbox mode.
- Post a panel and buy something.
- Check the console for the webhook request and the
store-logschannel for the purchase.
If the purchase never completes, see Troubleshooting.