Slice · AI prompt
Framework-parity Indonesia payment providers behind one slug and one provider-discriminated Convex data model. React/Next remains default; Svelte 5/SvelteKit adds native DOKU hosted/direct/status/instructions and Midtrans checkout/orders surfaces over shared contracts/tools. CLI 1.18 scopes provider runtime deps + backend actions: doku installs no provider npm SDK and only DOKU env/action; midtrans adds midtrans-client + Midtrans env/action; add-all receives the union. HMAC/signature verification, webhook idempotency, amount validation, and provider secrets stay server-side.
# Install `payment` — Payment — Indonesia PSP (DOKU · Midtrans)
> Framework-parity Indonesia payment providers behind one slug and one provider-discriminated Convex data model.
📚 Knowledge base : https://resource.rahmanef.com/llms.txt
📦 Slice detail : https://resource.rahmanef.com/slices/payment
🧠 JSON catalog : https://resource.rahmanef.com/api/knowledge?slice=payment
🔗 Source : https://github.com/rahmanef63/resource-site/tree/main/frontend/slices/payment
## 1. Install
```bash
# alias: npx rr add payment
```
The CLI copies `frontend/slices/payment/` into your project + augments `.env.example` + installs npm deps automatically. Run it from your project root.
## 2. What it ships
- npm: `midtrans-client`
- shadcn primitives: `badge`, `button`, `card`, `dialog`, `input`, `label`, `select`, `skeleton`
- peer slices (cascade install):
- `convex-auth` — Order ownership requires authenticated user (guest checkout works without).
- env vars:
- `DOKU_CLIENT_ID` (convex)
- `DOKU_SECRET_KEY` (convex)
- `DOKU_IS_PRODUCTION` (convex)
- `MIDTRANS_SERVER_KEY` (convex)
- `MIDTRANS_CLIENT_KEY` (next-public)
- `MIDTRANS_IS_PRODUCTION` (convex)
- convex feature paths: `convex/features/payment`
## 3. Wire it up
Install one provider with rr add payment doku|midtrans, or both with rr add payment; append --framework sveltekit for native Svelte. CLI 1.18 gates provider action/npm/env while retaining shared payment schema/query/mutation/webhook support. DOKU injects checkout/direct actions and keeps HMAC secrets server-side. Midtrans injects createTransaction + optional Snap onPay bridge; only the client key is browser-visible.
## Rules of engagement
- shadcn-only UI primitives. No raw `<button>` / `<dialog>` / native date or file inputs.
- 200-line hard cap per source file (extract neighbours when over).
- All Convex queries hit an index (`.withIndex(...)`); never bare `.collect()`.
- Public mutations/queries declare `args:` validators + authz.
- Full ruleset: https://resource.rahmanef.com/best-practice
The agent will fetch /llms.txt for the full ruleset and use /api/knowledge for the JSON catalog.