📋 Billing & SubscriptionsInvoices

Estimate invoice net by payment rail

Estimate per-rail processing fees and net-after-fees for an invoice amount.

POST/invoices/{id}/margin-estimate

Estimate per-rail processing fees and net-after-fees for an invoice amount.


Related endpoints

  • PUT /invoices/external/batch — Batch upsert invoices by external ID
  • GET /invoices/{id}/usage-explain — Explain invoice usage charges
  • GET /invoices — List invoices
  • POST /invoices — Create invoice
  • GET /invoices/{id} — Get invoice
  • PATCH /invoices/{id} — Update invoice
  • DELETE /invoices/{id} — Delete invoice
  • POST /invoices/{id}/refund — Refund invoice

Common errors

  • 404 resource_missing — the referenced resource does not exist or is not visible to your key.

Idempotency

Pass an Idempotency-Key header (UUID v4 recommended) to make retries safe. Keys are valid for 24 hours; see the idempotency guide.

x-api-key<token>

Your RevKeen merchant API key. Create and manage keys in Dashboard → Settings → Developer. Use rk_sandbox_* for staging/test and rk_live_* for production. The same key may be sent as Authorization: Bearer <key> if that suits your HTTP client better. A missing, invalid, expired, or revoked key returns 401 with a WWW-Authenticate: Bearer challenge; a valid key without the required scope returns 403.

In: header

Path Parameters

id*string

Invoice ID.

Formatuuid

Request Body

application/json

Margin estimate inputs

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

Stuck on an error response? Ask the RevKeen assistant to explain it.
curl -X POST "https://api.revkeen.com/v2/invoices/11111111-1111-4111-8111-111111111111/margin-estimate" \
  -H "x-api-key: $REVKEEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount_minor": 1000,
    "rails": [
      "card"
    ],
    "card_scheme": "example",
    "card_schemes": [
      "example"
    ]
  }'

Synthetic documentation data, validated against the response schema; not a live API result.

{  "data": {    "invoice_id": "00000000-0000-4000-8000-000000000001",    "amount_minor": 0,    "currency": "string",    "estimates": [      {        "rail": "card",        "card_scheme": "string",        "gross_minor": 0,        "estimated_fee_minor": 0,        "net_after_fees_minor": 0,        "fee_breakdown": {          "percentage_fee_minor": 0,          "fixed_fee_minor": 0,          "minimum_fee_adjustment_minor": 0        },        "pricing_source": "matrix",        "matrix_version": "string"      }    ]  }}

Put this endpoint to work