What Are Skills?

Claude Code skills are pre-defined slash commands (e.g., /rohopay-collect) that Claude Code executes with full context about your task. They save you from re-explaining the same context each time. Add skills to .claude/commands/ in your project to make them available as / commands.

Available RohoPay Skills

/rohopay-collect

Generate a mobile money collection handler for your framework of choice. File: .claude/commands/rohopay-collect.md
Generate a production-ready mobile money collection function for RohoPay.

Requirements:
- POST to https://api.rohopay.com/api/v1/collect
- Authorization: Bearer {ROHOPAY_API_KEY env var}
- Include Idempotency-Key header (generate UUID)
- Phone in international format (256XXXXXXXXX for Uganda)
- Amount in UGX integer units
- Include callback_url parameter
- Handle VALIDATION_ERROR, RATE_LIMIT_EXCEEDED, PROVIDER_LINE_DOWN errors
- Return the internal_reference for polling
- Add a polling helper function (5s interval, max 30 attempts)

Ask the user which language/framework they're using before generating.

/rohopay-webhook

Generate a webhook handler with signature verification. File: .claude/commands/rohopay-webhook.md
Generate a secure RohoPay webhook handler.

Requirements:
- Verify X-RohoPay-Signature using HMAC-SHA256
- Secret from ROHOPAY_WEBHOOK_SECRET env var
- Use timing-safe comparison (avoid timing attacks)
- Parse JSON body AFTER signature verification
- Handle both "successful" and "failed" status events
- Return HTTP 200 within 10 seconds (process async if needed)
- Include error handling for invalid signatures (return 401)

Ask the user which framework (Next.js App Router, Express, FastAPI, Go, Laravel, etc.) before generating.

/rohopay-card

Generate a card payment checkout flow. File: .claude/commands/rohopay-card.md
Generate a complete card payment checkout flow using RohoPay.

Requirements:
- POST to https://api.rohopay.com/api/v1/checkout
- api_key goes in REQUEST BODY (not Authorization header)
- Validate card expiry client-side (MM/YY format, reject past dates)
- Detect card brand (Visa: starts 4, MC: starts 51-55 or 2221-2720)
- After getting payment_url: redirect browser with window.location.href
- On return URL: poll /api/v1/transactions/:ref every 2.5s for status
- Do NOT trust ?status= query param alone - always poll/use webhook
- Use test cards: 4111...1111 (Visa success), 4000...0002 (Visa decline)

Generate both server-side checkout initiator and client-side return page handler.

/rohopay-errors

Show common RohoPay error codes and fixes. File: .claude/commands/rohopay-errors.md
Show the user a reference table of common RohoPay API error codes, their meanings, and how to fix them.

Include:
- VALIDATION_ERROR: check field formats (phone, amount, currency)
- MISSING_IDEMPOTENCY_KEY: add Idempotency-Key header
- UNAUTHORIZED: check API key format (test_ or live_ prefix)
- DISBURSE_TEST_BLOCKED: disbursements require live_ key
- INSUFFICIENT_BALANCE: check wallet balance first
- PROVIDER_LINE_DOWN: retry with exponential backoff
- RATE_LIMIT_EXCEEDED: slow down, add delays between requests
- CARD_EXPIRED: validate expiry before sending (MM/YY, must be future)

/rohopay-digital

Generate a digital product payment link integration. File: .claude/commands/rohopay-digital.md
Generate code to interact with RohoPay Digital Products API.

Context:
- Base path: /api/v2/digital/* (requires dashboard session auth)
- Public checkout: /api/v2/public/checkout/:slug/pay
- Order polling: /api/v2/public/checkout/:slug/order/:id

Ask which operation:
1. Create a product (POST /api/v2/digital/products)
2. Create a payment link (POST /api/v2/digital/links)
3. Poll order status until paid (GET /api/v2/public/checkout/:slug/order/:id)
4. Handle order webhook

Installing Skills

Option 1: Copy Skill Files

mkdir -p .claude/commands

# Create each skill file
cat > .claude/commands/rohopay-collect.md << 'EOF'
[paste skill content here]
EOF

Option 2: Download from Docs

# From your project root
curl -o .claude/commands/rohopay-collect.md \
  https://docs.rohopay.com/skills/rohopay-collect.md

curl -o .claude/commands/rohopay-webhook.md \
  https://docs.rohopay.com/skills/rohopay-webhook.md

curl -o .claude/commands/rohopay-card.md \
  https://docs.rohopay.com/skills/rohopay-card.md

curl -o .claude/commands/rohopay-digital.md \
  https://docs.rohopay.com/skills/rohopay-digital.md

Using Skills

Once installed, use them in your Claude Code session:
> /rohopay-collect
> /rohopay-webhook
> /rohopay-card
> /rohopay-errors
Claude Code will execute the skill with full context and generate the requested code or information.

Writing Custom Skills

Customize skills for your specific use case:
# .claude/commands/my-payment-flow.md

Generate the payment flow for our e-commerce checkout page.

Context:
- We use Next.js 15 App Router with TypeScript
- Backend is at https://api.rohopay.com
- Our callback URL is https://our-site.com/api/webhooks/rohopay
- Currency: UGX, phone prefix: 256 (Uganda only)
- We use Drizzle ORM with PostgreSQL

Generate:
1. Server action to initiate collection
2. Client component to show USSD pending state
3. Webhook route to confirm payment and update order