Payment broker · self-hosted
One payment API.
Any gateway behind it.
The broker creates the checkout, talks to the gateway, verifies every webhook and hands your app a signed result. Your code learns one contract.
- 14:02:11.204connect
blackevin-prod · $49.90 · payment
- 14:02:11.380route
stripe-us · card · USD
- 14:02:38.912webhook.received
checkout.session.completed · signature ok
- 14:02:39.020ledger
+$48.15 net · fee $1.75
- 14:02:39.071session.paid
→ app.blackevin.com · 200 OK
Stripe
Cards · subscriptions · global
Asaas
PIX · boleto · cards (Brazil)
AbacatePay
PIX (Brazil)
How it works
Three steps from the pay button to money in the statement.
The flow is the same for every gateway. Switching providers is changing an app's route, not your code.
- 01
Create an app, plug in a gateway
Each product gets an app with its own key. Paste the gateway keys and set the app's routes: which gateway takes its payments, and when.
- 02
Call /connect
Your backend sends POST /connect with the app key, the amount and return_to. The app decides whether it is a payment or a subscription and which gateway takes it, then you send the customer to redirect_url.
- 03
Get the result
The customer pays at the gateway's own checkout and comes back with a signed token. Your server also receives a session.paid webhook signed in X-Pay-Signature.
Features
What usually waits for later ships on day one.
Subscriptions, reconciliation, reliable webhooks and many accounts per provider, from the first day.
Ledger with fees
Every movement keeps gross, gateway fee and net. The statement comes per day and per month, per currency.
| Date | Movement | Gross | Fee | Net |
|---|---|---|---|---|
| Sep 23 | Payment ps_7f3a | 49.90 | 1.75 | 48.15 |
| Sep 23 | Renewal sub_4k2p | 29.00 | 1.14 | 27.86 |
| Sep 22 | Refund ps_58d2 | −49.90 | — | −49.90 |
Subscriptions
Every paid cycle becomes a session in the statement. Plan changes with replaces, async cancellation with cancel_at.
Signed webhooks
Your app receives session.paid, subscription.renewed and more, with X-Pay-Signature and up to 8 attempts.
Routes per app
Gateways in order, each with an optional From and Until. If one fails to open the checkout, the next route takes over by itself.
Secure by default
Encrypted secrets, deduplicated events, a JWS return and SSRF protection on outbound calls.
API
One call to charge. One signature to trust.
Call /connect with the app key and verify the webhook with its signing secret. That's it.
curl https://pay.contagorda.com/connect \-H "Authorization: Bearer $PAY_SECRET_KEY" \-H "Idempotency-Key: order-1042" \-d '{"amount": "49.90", "currency": "USD","customer": { "external_ref": "user_42", "email": "[email protected]" },"return_to": "https://app.example.com/billing"}'# → { "id": "7f3a…", "kind": "payment", "status": "processing",# "redirect_url": "https://checkout.stripe.com/c/pay/…" }
# X-Pay-Signature: t=1758639759,v1=5f2c…def createheader = request.headers["X-Pay-Signature"]t, v1 = header.scan(/(?:t|v1)=([^,]+)/).flattenexpected = OpenSSL::HMAC.hexdigest("SHA256", secret,"#{t}.#{request.raw_post}")return head(:unauthorized) unlessActiveSupport::SecurityUtils.secure_compare(expected, v1)Billing.apply(JSON.parse(request.raw_post))head :okend