Rails API
Invoice in dollars, settle in stablecoin — over a clean REST API. Create an invoice, collect by ACH, and receive net USDT/USDC to your wallet, with screening and reconciliation built in.
Quickstart
Every request is JSON over HTTPS and authenticated with your tenant API key. Create an invoice, and Rails issues the ACH collection and drives settlement — you receive webhook events as state changes.
# 1 · create an invoice curl -X POST https://rails-api.infinihash.com/api/v1/invoices \ -H "Authorization: Bearer $IHB_KEY" \ -H "Content-Type: application/json" \ -d '{ "number": "INV-2001", "customer": "Northgate Wholesale", "terms": "Net 14", "lineItems": [ { "description": "Wholesale order", "quantity": 1, "unitCents": 204120 } ] }'
Authentication
Pass your tenant API key as a bearer token on every request. Keys are per-tenant and issued from the admin console; treat them as secrets and rotate them if exposed.
Authorization: Bearer ihb_live_xxxxxxxxxxxxxxxxxxxxxxxx
Sandbox
Point at the same base URL with a sandbox key to run the entire invoice-to-stablecoin flow against test rails. Payments, screening, and settlement all execute end-to-end — nothing touches real money. Move to production by swapping the key.
Invoices
Invoices are the entry point. Create one with line items; Rails computes totals, generates a branded PDF, and issues the ACH collection link. Statuses flow draft → sent → partially_paid → paid.
# list invoices curl https://rails-api.infinihash.com/api/v1/invoices \ -H "Authorization: Bearer $IHB_KEY"
Payments & settlement
When an invoice is paid, Rails runs the settlement pipeline: screen the destination wallet (KYT + sanctions), deduct the platform fee, convert dollars to stablecoin, and settle net USDT/USDC to your wallet. The whole thing is fail-closed — if screening doesn't pass, funds don't move.
# settlement result (via webhook or GET) { "status": "settled", "fiatInCents": 204120, "feeCents": 8165, "usdtOut": "1959.55", "destChain": "tron", "screeningRef": "kyt_…", "txHash": "…" }
Onboarding (KYB)
Bring a new business onto your platform with a white-label verification flow. Create an invite from the admin API to get a magic link; the customer completes a branded KYB wizard whose sensitive data streams straight to the regulated partner. Poll status or receive it by webhook.
# create an onboarding invite (internal token) curl -X POST https://rails-api.infinihash.com/admin/kyb/invites \ -H "Authorization: Bearer $INTERNAL_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "legalName": "Northgate Wholesale LLC", "contactEmail": "ap@northgate.example" }' # → { "magicLink": "https://onboard.infinihash.com/onboard/…" }
Endpoint reference
| Method | Path | Description |
|---|---|---|
| POST | /api/v1/invoices | Create an invoice |
| GET | /api/v1/invoices | List invoices |
| GET | /api/v1/invoices/:id | Retrieve an invoice |
| POST | /api/v1/invoices/:id/pay | Simulate/collect payment → triggers settlement |
| GET | /api/v1/settlements | List settlements for the tenant |
| POST | /admin/kyb/invites | Create a KYB onboarding invite |
| GET | /admin/kyb/invites | List onboarding applications + status |
| POST | /admin/kyb/invites/:id/sync | Pull latest verification status |
| POST | /admin/webhooks | Register a webhook endpoint |
Webhooks
Register an endpoint and Rails posts a signed event for every state change — invoice.sent, payment.received, settlement.settled, kyb.approved, and more. Each delivery is HMAC-SHA256 signed with your endpoint secret so you can verify authenticity, and failed deliveries are retried.
# example event { "event": "settlement.settled", "data": { "invoice": "INV-2001", "usdtOut": "1959.55", "chain": "tron" } }
X-Infinihash-Signature header against the raw request body using your endpoint's signing secret before trusting an event.