Documentation

Build on Pyncht

Pyncht prices every charge you take, line by line, and marks the fees that are avoidable. REST over HTTPS, JSON in and out, idempotent writes, and official libraries for Node, Python, Ruby, Go, and PHP.

Filters the documentation index below as you type.

Quickstart

Three steps to your first itemised charge

About four minutes against a test key. Test keys read and write test data only — nothing on this page can move real money.

  1. Install the library

    Node 18 or later. TypeScript definitions ship inside the package, so there is no separate @types install.

    npm install pyncht
  2. Authenticate

    One client per process. maxNetworkRetries re-sends with the same idempotency key, so a retried create never charges twice.

    pyncht.js
    const pyncht = require('pyncht')(process.env.PYNCHT_SECRET_KEY, {
      apiVersion: '2026-07-14',
      maxNetworkRetries: 2,
    });
    
    module.exports = pyncht;
  3. Make your first request

    Create a charge, expand its fee lines, and read what the charge actually cost you. Every line is a fee somebody genuinely bills.

    charge.js
    const charge = await pyncht.charges.create({
      amount: 4200,          // smallest currency unit
      currency: 'usd',
      source: 'tok_visa',
      description: 'Invoice 8841',
      expand: ['fee_lines'],
    });
    
    // Every charge carries its own itemised cost.
    for (const line of charge.fee_lines) {
      console.log(`${line.category}: ${line.amount_cents}c`);
    }
    // interchange: 69c · scheme: 6c · markup: 19c · fixed: 10c

The four fee lines above are the real breakdown of a $42.00 US Visa credit charge: 165 bps interchange, 14 bps scheme, 45 bps markup and a 10c fixed fee — 104c in total, or 248 bps. Full API reference

Reference

The rest of the documentation

API objects

Every response, in full

Eight resources carry the whole product. Six of them look like any payments API. The last two — fee_lines and opportunities — are the ones Pyncht exists for.

Bodies below are from the sample analysis that powers the demo dashboard: an illustrative merchant on $269,269 a month, not a customer.

GET /v1/charges/:id
{
  "id": "ch_3QwZ8kR2P1a4Kd",
  "object": "charge",
  "amount": 4200,
  "currency": "usd",
  "captured": true,
  "network": "visa",
  "funding": "credit",
  "customer": "cus_QkP2m4Rd81",
  "description": "Invoice 8841",
  "cost_cents": 104,
  "effective_rate_bps": 248,
  "fee_lines": ["fl_9dT2", "fl_9dT3", "fl_9dT4", "fl_9dT5"],
  "opportunities": ["opp_network_tokens"],
  "created": 1785283200
}

cost_cents is the sum of the charge's four fee lines. 104c on a $42.00 charge is 248 bps, against a 249 bps blended rate for this account.