Documentation Index
Fetch the complete documentation index at: https://docs.shoppex.io/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Use this setup when you want the frontend to feel fully yours, but you still want Shoppex to handle the hard backend parts.Your Frontend
You control the branding, layout, auth flow, and customer experience.
Shoppex Backend
Shoppex handles order creation, affiliate attribution, balances, and payout requests.
API-First Flow
You connect your app to Shoppex through API endpoints instead of using a hosted dashboard UI.
This guide is for merchants who want a white-label customer or affiliate portal.
What Shoppex Handles
Orders With Affiliate Attribution
Create an order and attach an
affiliate_code so the referral stays linked to the invoice.Affiliate Stats And Balance
Read referral links, clicks, sales, commissions, claims, and balance buckets for your frontend.
Convert To Store Balance
Let affiliates move approved earnings into store balance with an API-triggered action.
Crypto Payout Requests
Accept payout requests without forcing automatic onchain payouts.
Recommended Portal Experience
For a strong headless setup, your portal usually needs three surfaces:Orders
Show invoices, payment state, and order history.
Affiliate
Show referral code, referral link, clicks, conversions, and commissions.
Balance Actions
Let affiliates convert earnings into store balance or request a payout.
Typical Integration Flow
Start provider payment
Your app starts the payment session for the gateway you want, like Stripe or PayPal.
Resolve And Attribute Affiliate Codes In A Custom Storefront
If you run your own storefront, use the Storefront affiliate endpoints before checkout to validate a code and read its customer discount metadata. When a customer lands on?ref=creator10, your frontend calls POST /v1/storefront/affiliates/resolve to check if the code is valid and whether it unlocks a discount. When the customer continues, your frontend calls POST /v1/storefront/affiliates/attribution to lock in the referral.
These are Storefront API endpoints under
/v1/storefront/*, not Dev API endpoints under /dev/v1/*.discount_active is true and discount_percent is 12, your storefront can immediately show “12% affiliate discount applied”.
This makes it easier to build a custom referral banner, pricing preview, or coupon-style affiliate UX without guessing the effective discount.
1. Create The Order
Create the invoice or order from your frontend or backend and attach the affiliate code. Your backend calls the invoice create flow and includesaffiliate_code: "creator123" — Shoppex stores the affiliate attribution on the invoice automatically.
This keeps the affiliate relationship on the order and uses the same attribution rules as the modern storefront flow.
2. Start Payment With The Provider You Want
You do not need to use a generic Shoppex checkout page if your flow is more API-first. Create the invoice, start a Stripe or PayPal payment session, send the customer into that provider flow, and let Shoppex complete the invoice through the normal payment lifecycle.Think of Shoppex as the payment and accounting backend, while your frontend stays fully branded.
3. Read Affiliate Data For Your Frontend
For a headless customer or affiliate dashboard, use the Dev API affiliate endpoints.Affiliate Summary
GET /dev/v1/customers/{id}/affiliateConvert To Balance
POST /dev/v1/customers/{id}/affiliate/convert-to-balancePayout Request
POST /dev/v1/customers/{id}/affiliate/payout-requests- referral link and code
- clicks and sales
- commissions
- claims
- balance buckets like
available,requested, andconverted
4. Convert Affiliate Balance Into Store Balance
This is the self-serve flow for affiliates who want to spend their earnings inside the store instead of cashing out.25 and the user enters 10, Shoppex creates the balance claim and credits 10 into store balance.
Example response:
5. Create A Crypto Payout Request
This flow is for affiliates who want to request a payout without forcing fully automatic onchain settlement.This does not go through a payment gateway like Stripe or PayPal. The API stores a payout request, and your own ops flow, webhook consumer, or treasury process decides whether and how the crypto payout gets fulfilled.
6. Process Payout Requests In Your Merchant UI
If you are building a headless merchant dashboard or an ops backoffice, you can now process affiliate payout requests through the Dev API as well. The affiliate submits a payout request, your merchant tool lists pending requests, your ops user approves or rejects, and the affiliate sees the updated state in their portal.List Requests
GET /dev/v1/affiliates/payout-requestsApprove Request
POST /dev/v1/affiliates/payout-requests/{id}/approveReject Request
POST /dev/v1/affiliates/payout-requests/{id}/rejectComplete Or Cancel
POST /dev/v1/affiliates/payout-requests/{id}/complete
and
POST /dev/v1/affiliates/payout-requests/{id}/cancelRecommended Scopes
A good starting scope set for this type of portal is:| Scope | Why you usually need it |
|---|---|
affiliates.read | List affiliate applications, merchant payout requests, and partner ops data |
affiliates.write | Approve or reject applications and process payout requests |
customers.read | Read affiliate summaries and customer-linked data |
customers.write | Convert balances and create payout requests |
orders.read | Show order history or order-linked affiliate activity |
invoices.read | Read invoice state for payment and attribution context |
Implementation Rule
Keep one clear source of truth:- Shoppex owns affiliate balances, claims, payout requests, and invoice attribution
- your frontend owns branding, navigation, and UX
Best Fit
This setup is a strong fit when you want:- a fully branded customer portal
- a branded affiliate dashboard
- custom onboarding or checkout entry pages
- Shoppex handling the accounting and payment-side complexity in the background