rspace-online/backlog/tasks/task-125 - Configure-Stripe...

64 lines
3.5 KiB
Markdown

---
id: TASK-125
title: Configure Stripe & Mollie API keys and test HyperSwitch payment channels
status: To Do
assignee: []
created_date: '2026-03-24 00:56'
labels:
- payments
- hyperswitch
- infrastructure
dependencies: []
references:
- 'https://pay.rspace.online/health'
- 'https://dashboard.stripe.com/test/apikeys'
- 'https://my.mollie.com/dashboard'
priority: medium
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
HyperSwitch payment orchestrator is deployed at `pay.rspace.online` with merchant account `rspace_merchant` and DB migrations complete. The connector configuration and end-to-end payment testing is blocked on obtaining real API keys from Stripe and Mollie.
## Context
- HyperSwitch is live: `https://pay.rspace.online/health`
- Merchant account created with publishable key `pk_snd_9167de4f...`
- Merchant API key saved to `.env` as `HS_MERCHANT_SECRET_KEY`
- Internal mint/escrow/confirm APIs verified working on rspace-online
- Bonding curve ($MYCO) endpoints live and tested
- `INTERNAL_API_KEY` and `RSPACE_INTERNAL_API_KEY` deployed to both repos
## Steps
1. **Obtain Stripe API key** — create Stripe account or use existing, get test mode API key (`sk_test_...`)
2. **Obtain Mollie API key** — create Mollie account, get test API key
3. **Add keys to Infisical**`STRIPE_API_KEY`, `STRIPE_WEBHOOK_SECRET`, `MOLLIE_API_KEY` in rspace project
4. **Add keys to payment-infra `.env`** on Netcup
5. **Run `scripts/setup-hyperswitch.sh`** — configures Stripe + Mollie connectors, geo-based routing (EU→Mollie, US→Stripe), webhook endpoint
6. **Rebuild payment-infra onramp/offramp services** — they have new HyperSwitch integration code (`hyperswitch.ts`, `hyperswitch-offramp.ts`) but haven't been rebuilt
7. **Test Stripe channel** — create payment intent, complete with test card `4242424242424242`, verify cUSDC minted
8. **Test Mollie channel** — create payment intent with EU billing, complete via Mollie test mode, verify cUSDC minted
9. **Test off-ramp** — initiate withdrawal, verify escrow burn, simulate payout webhook, verify confirm/reverse
10. **Run `bun scripts/test-full-loop.ts`** — full loop: fiat in → cUSDC → $MYCO → cUSDC → fiat out
## Key files
- `payment-infra/scripts/setup-hyperswitch.sh` — connector + routing setup script
- `payment-infra/services/onramp-service/src/hyperswitch.ts` — on-ramp integration
- `payment-infra/services/offramp-service/src/hyperswitch-offramp.ts` — off-ramp integration
- `rspace-online/scripts/test-full-loop.ts` — end-to-end test script
- `rspace-online/server/index.ts` — internal mint/escrow/confirm endpoints (lines 570-680)
- `payment-infra/config/hyperswitch/config.toml` — HyperSwitch TOML config on Netcup
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 Stripe test API key obtained and added to Infisical + payment-infra .env
- [ ] #2 Mollie test API key obtained and added to Infisical + payment-infra .env
- [ ] #3 setup-hyperswitch.sh runs successfully — Stripe + Mollie connectors configured with geo-based routing
- [ ] #4 onramp-service and offramp-service rebuilt with HyperSwitch integration code
- [ ] #5 Stripe test payment completes end-to-end: card payment → webhook → cUSDC minted in CRDT ledger
- [ ] #6 Mollie test payment completes end-to-end: iDEAL/SEPA → webhook → cUSDC minted
- [ ] #7 Off-ramp escrow flow verified: escrow burn → payout → confirm (or reverse on failure)
- [ ] #8 Full loop test passes: fiat → cUSDC → $MYCO swap → cUSDC → fiat withdrawal
<!-- AC:END -->