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.

pay.contagorda.com · live
  1. 14:02:11.204
    connect

    blackevin-prod · $49.90 · payment

  2. 14:02:11.380
    route

    stripe-us · card · USD

  3. 14:02:38.912
    webhook.received

    checkout.session.completed · signature ok

  4. 14:02:39.020
    ledger

    +$48.15 net · fee $1.75

  5. 14:02:39.071
    session.paid

    → app.blackevin.com · 200 OK

Stripe

Cards · subscriptions · global

Available

Asaas

PIX · boleto · cards (Brazil)

Coming soon

AbacatePay

PIX (Brazil)

Coming soon

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.

  1. 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.

  2. 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.

  3. 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.

DateMovementGrossFeeNet
Sep 23Payment ps_7f3a49.901.7548.15
Sep 23Renewal sub_4k2p29.001.1427.86
Sep 22Refund 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.

POST /connect201
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/…" }
webhooks_controller.rb
# X-Pay-Signature: t=1758639759,v1=5f2c…
def create
header = request.headers["X-Pay-Signature"]
t, v1 = header.scan(/(?:t|v1)=([^,]+)/).flatten
expected = OpenSSL::HMAC.hexdigest("SHA256", secret,
"#{t}.#{request.raw_post}")
return head(:unauthorized) unless
ActiveSupport::SecurityUtils.secure_compare(expected, v1)
Billing.apply(JSON.parse(request.raw_post))
head :ok
end

Ready to charge.
On any gateway.