Prerequisites
- A Supabase account (create one free)
- Supabase project URL and service role key
- Database client or Supabase SQL Editor access
Create a Supabase project
Create new project
- Log in to Supabase Dashboard
- Click “New project”
- Choose your organization
- Enter a project name (e.g.,
payonproof) - Set a strong database password
- Select a region close to your users
- Click “Create new project”
Get connection credentials
Once your project is ready:
- Go to Settings → API
- Copy the Project URL (this is your
SUPABASE_URL) - Copy the service_role key (this is your
SUPABASE_SERVICE_ROLE_KEY)
Run database migrations
PayOnProof includes SQL migration files inservices/api/sql/. Run these in order:
1. Anchors catalog table
This table stores the anchor registry used for route discovery. File:services/api/sql/001_anchors_catalog.sql
- Go to Supabase Dashboard → SQL Editor
- Click New query
- Copy and paste the contents of
001_anchors_catalog.sql - Click Run
This migration includes seed data for a US → MX corridor (MoneyGram and Bitso). You can modify or remove this based on your needs.
2. Anchor capabilities table
This migration adds columns for SEP (Stellar Ecosystem Proposal) capabilities and operational status. File:services/api/sql/002_anchors_catalog_capabilities.sql
- Go to Supabase Dashboard → SQL Editor
- Click New query
- Copy and paste the contents of
002_anchors_catalog_capabilities.sql - Click Run
3. Anchor callback events table
This table stores callback events from anchors during transaction processing. File:services/api/sql/003_anchor_callback_events.sql
- Go to Supabase Dashboard → SQL Editor
- Click New query
- Copy and paste the contents of
003_anchor_callback_events.sql - Click Run
Database schema overview
anchors_catalog
Stores registered Stellar anchors and their capabilities.| Column | Type | Description |
|---|---|---|
id | text | Primary key, unique anchor identifier |
name | text | Human-readable anchor name |
domain | text | Anchor domain (e.g., stellar.moneygram.com) |
country | text | Country code (e.g., US, MX) |
currency | text | Currency code (e.g., USD, MXN) |
type | text | on-ramp or off-ramp |
active | boolean | Whether the anchor is currently active |
sep24 | boolean | Supports SEP-24 (hosted deposit/withdrawal) |
sep6 | boolean | Supports SEP-6 (deposit/withdrawal API) |
sep31 | boolean | Supports SEP-31 (cross-border payments) |
sep10 | boolean | Supports SEP-10 (Stellar Web Auth) |
operational | boolean | Whether the anchor is currently operational |
fee_fixed | numeric | Fixed fee amount |
fee_percent | numeric | Percentage-based fee |
transfer_server_sep24 | text | SEP-24 transfer server URL |
transfer_server_sep6 | text | SEP-6 transfer server URL |
web_auth_endpoint | text | SEP-10 authentication endpoint |
direct_payment_server | text | SEP-31 direct payment server |
last_checked_at | timestamptz | Last capability check timestamp |
diagnostics | jsonb | Diagnostic information array |
created_at | timestamptz | Record creation timestamp |
updated_at | timestamptz | Record update timestamp |
anchor_callback_events
Stores webhook callbacks from anchors during transaction processing.| Column | Type | Description |
|---|---|---|
transaction_id | text | Transaction identifier (primary key) |
callback_token | text | Callback authentication token (primary key) |
status | text | Transaction status |
stellar_tx_hash | text | Stellar blockchain transaction hash |
external_transaction_id | text | External transaction ID from anchor |
source_anchor | text | Source anchor identifier |
raw_payload | jsonb | Complete callback payload |
received_at | timestamptz | Callback received timestamp |
updated_at | timestamptz | Record update timestamp |
Row Level Security (RLS)
For production deployments, consider enabling RLS on user-facing tables:Verifying the setup
Verify your database is set up correctly:Check tables exist
In Supabase Dashboard → Table Editor, you should see:
anchors_cataloganchor_callback_events
Verify seed data
Check that the seed data was inserted:You should see MoneyGram (US) and Bitso (MX) entries.
Troubleshooting
Connection errors
- Verify
SUPABASE_URLandSUPABASE_SERVICE_ROLE_KEYin your.envfile - Check that your Supabase project is active and not paused
- Ensure you’re using the service role key, not the anon key
Migration failures
- Run migrations in order: 001, 002, 003
- Check for syntax errors in the SQL editor
- Verify you have sufficient database permissions
Missing seed data
- The
on conflictclause will update existing records - If seed data is missing, re-run migration 001