Purchase Flow
How the Store plugin handles payments from panel to reward delivery.
Purchase Flow
This page explains what happens from the moment a user interacts with a store panel to when they receive their reward.
1. User Selects a Product
A panel is deployed to a channel via /store panel. The user selects a product from the dropdown or clicks a button.
2. Eligibility Check
Before a checkout session is created, the plugin checks whether the user is eligible to purchase:
- If the product has a role reward and the user already has that role → purchase is blocked.
- If
max_purchasesis set and the user has already reached that limit → purchase is blocked.
3. Payment Method Selection (Multi-Provider)
- If the product has multiple providers defined in
providers: ["stripe", "paypal", "crypto"], an interactive private card is sent to the user to choose their payment method:[ Stripe ] [ PayPal ] [ Crypto ] - If the product only has a single provider defined in
provider: "stripe", it skips this step and opens checkout directly.
4. Checkout Session
Based on the selected provider, the plugin creates a hosted checkout session and sends a private (ephemeral) card to the user with a link to complete payment.
| Provider | Hosted Checkout |
|---|---|
| Stripe | Stripe-hosted checkout page |
| PayPal | PayPal approval redirect link |
| Razorpay | Razorpay Payment Link |
| Polar | Polar-hosted checkout page |
| Crypto | NOWPayments invoice page |
5. Payment Confirmation
Once the user completes payment, the provider fires a webhook to the Store plugin. The bot then:
- Updates the user's checkout card to show Paid.
- Delivers all configured rewards (roles, webhooks).
- Sends a DM receipt to the buyer.
- Posts a purchase log in the configured
store-logschannel. - Records the transaction in the database.
Webhook Endpoints
Each provider has its own dedicated webhook route:
| Provider | Webhook URL |
|---|---|
| Stripe | POST /api/store/webhook/stripe |
| PayPal | POST /api/store/webhook/paypal |
| Razorpay | POST /api/store/webhook/razorpay |
| Polar | POST /api/store/webhook/polar |
| Crypto (NOWPayments) | POST /api/store/webhook/crypto |
Reward Errors
If a reward fails to deliver (e.g. an unknown role ID), the purchase is still recorded as completed with errors and a 200 OK is returned to the payment provider. The error detail is included in the store-logs message so you can investigate without the payment being retried.
Commands
The /store command is restricted to admins (permissions.store_command = "admin").
/store panel <panel> <channel>
Deploys a store panel to the specified channel. Only visible to the command executor.
| Option | Description |
|---|---|
panel | The panel name defined in panel_linking (supports autocomplete). |
channel | The channel to send the panel to. |
/store lookup [user] [transactionid] [email] [date]
Queries completed purchase transactions in the database.
| Option | Description |
|---|---|
user | Filter by purchasing user. |
transactionid | Filter by exact transaction ID (cs_test_...). |
email | Filter by customer email address. |
date | Filter by transaction date (YYYY-MM-DD). |

