Payments

Cookbook

Credit a deposit to its holder

A verified subject, a PATH address, a holding and a vIBAN anchored to it — a deposit credited to that holding, returned, or held for review, with its payee receipt — and a route that pays the address.

Needs one test key with the scopes addresses, endpoints and accounts, and tools to read the payee receipt.

A deposit reaches its holder because the identifier it was paid to is anchored to a holding. The chain is: a subject, a PATH address of the subject, an endpoint of the address (here a vIBAN), and the anchor of the endpoint to a holding.

1. Create and verify a subject

const subject = await pg.addresses.createSubject(
  { type: 'legal_entity', name: 'Example Treasury Ltd', country: 'DE', reference: 'customer-118' },
  { idempotencyKey: 'subject-customer-118' },
);
// subject.identity.status: 'verified' | 'review' | 'rejected'

The identity of a subject is checked by Proof when it is created. pg.addresses.verifySubject(id) runs the check again, or records a verdict decided in Proof. In the sandbox a subject is verified. A verified subject is a subject of the PATH network: subject.path_subject names it, and subject.attestation is its kyb_level attestation (kyc_level for an individual).

2. Issue a PATH address

const address = await pg.addresses.issue({ subject: subject.id, profile: 'directory' }, { idempotencyKey: 'address-customer-118' });
// address.address: 'path:…'
// address.terms: 'derived', address.commitment: null

An address starts on derived terms: it accepts what its receive targets receive, and pledges nothing.

3. Open a holding

const account = await pg.accounts.openOmni({ holder: { name: 'Example Treasury Ltd' }, subject: subject.id, reference: 'customer-118' });
const holding = await pg.accounts.openHolding(
  { kind: 'virtual_account', account: account.id, currency: 'EUR' },
  { idempotencyKey: 'holding-customer-118-eur' },
);

4. Issue a vIBAN anchored to the holding

const issuable = await pg.endpoints.issuable({ type: 'viban', asset: 'EUR' });
// [{ type: 'viban', issuer: '…', asset: 'EUR', networks: ['sepa-inst', 'sepa-ct', 'swift'], format: 'iban' }]

const endpoint = await pg.endpoints.issue(
  { address: address.id, type: 'viban', asset: 'EUR', anchor: { holding: holding.id } },
  { idempotencyKey: 'viban-customer-118' },
);
{
  "id": "ep_…",
  "kind": "endpoint",
  "address": "addr_…",
  "type": "viban",
  "networks": ["sepa-inst", "sepa-ct", "swift"],
  "assets": ["EUR"],
  "format": "iban",
  "identifier": "DE…",
  "pay_to": { "identifier": "DE…" },
  "country": "DE",
  "bic": "…",
  "rails_enabled": ["sepa-inst", "sepa-ct", "swift"],
  "status": "active",
  "anchor": { "target": { "holding": "va_…" }, "anchored_at": "…" }
}

pay_to is what the payer sends: here the IBAN. format_status is the status of the iban link on its first network. pg.endpoints.anchor(id, { holding }) anchors an endpoint later, or moves its anchor; pg.endpoints.release(id) removes it.

The anchored vIBAN is a receive target of the address on the PATH network, one per rail:

const view = await pg.addresses.get(address.id);
// view.rails: one per network of the vIBAN, each published
//   { network: 'sepa-inst', asset: 'EUR', capability: { rail: 'sepa-inst', asset_type: 'fiat', asset_code: 'EUR' },
//     published: true, pledged: null, accepted: true, … }
//   and the same for 'sepa-ct' and 'swift'
// view.accepts: [{ rail: 'sepa-inst', asset_type: 'fiat', asset_code: 'EUR' }, { rail: 'sepa-ct', … }, { rail: 'swift', … }]

The same call issues the other types: wallet_address, wallet_address_memo, virtual_address, viban, account_number, alias, card_pan and card_token. For an address with a memo, the payer sends both parts of pay_to:

const pooled = await pg.endpoints.issue(
  { address: address.id, type: 'wallet_address_memo', asset: 'PATHUSD', network: 'tempo' },
  { idempotencyKey: 'tempo-memo-customer-118' },
);
// pooled.format: 'tempo-address-memo'
// pooled.pay_to: { identifier: '0x…', memo: { type: 'bytes32', value: '0x…' } }

pg.catalogue.networkEndpointFormats('tempo') lists the formats of a network, the fields a payer sends with each, and what Path Global issues in each.

5. A deposit arrives

// Test mode only: a deposit arrives on the endpoint, as the network would notify it.
const deposit = await pg.endpoints.simulateDeposit(endpoint.id, {
  amount: { value: '2500.00', asset: 'EUR' },
  network: 'sepa-inst',
  payer: { name: 'Meridian Markets' },
  rail_reference: 'E2E-2026-0001',
  rail_reference_type: 'end_to_end_id',
});
{
  "id": "dp_…",
  "kind": "endpoint.deposit",
  "endpoint": "ep_…",
  "network": "sepa-inst",
  "amount": { "value": "2500.00", "asset": "EUR" },
  "status": "credited",
  "holding": "va_…",
  "rail_reference": "E2E-2026-0001",
  "rail_reference_type": "end_to_end_id",
  "payer": { "name": "Meridian Markets" },
  "received_at": "…",
  "receipt": { "reference": "rcp_…", "status": "settled" }
}

The holding now holds it:

const entries = await pg.accounts.entries(holding.id);
// [{ kind: 'deposit', amount: '2500.00', asset: 'EUR', reference: deposit.id, ... }]

const view = await pg.accounts.holding(holding.id);
// view.balances: [{ value: '2500.00', asset: 'EUR' }]

pg.endpoints.deposits(endpoint.id) lists the deposits of the endpoint, and pg.endpoints.deposits() those of every endpoint of the caller.

6. Read the payee receipt

The deposit came through a rail the address publishes and carries a rail reference, so it has a payee receipt: a path.receipt of the PATH protocol, issued for the address. deposit.receipt carries its reference and status; the signed statements are read with Path Tools.

const chain = await pg.tools.run<{ status: string; transitions: { from: string | null; to: string; envelope: Record<string, unknown> }[] }>(
  'receipt_chain',
  { reference: deposit.receipt!.reference },
);
// chain.status: 'settled'
// chain.transitions: pending, then settled
{
  "type": "path.receipt",
  "reference": "rcp_…",
  "issuer": "path-global",
  "issued_by": "payee",
  "payee": { "member": "path-global", "address": "path:…" },
  "via": { "rail": "sepa-inst", "asset_type": "fiat", "asset_code": "EUR" },
  "received": { "value": "2500", "asset_type": "fiat", "asset_code": "EUR" },
  "rail_references": [{ "type": "end_to_end_id", "value": "E2E-2026-0001" }],
  "status": "settled",
  "reason_code": null,
  "supersedes": "…",
  "route": null,
  "grammar": 2,
  "…": "…"
}

The receipt names the PATH address, the capability and the rail reference; it does not name the holding, the vIBAN or the payer. received is in the canonical decimal form of PATH. Each statement cites the one before in supersedes:

const [pending, settled] = chain.transitions.map((t) => t.envelope);
await pg.tools.run('receipt_verify', { envelope: settled, chain: [pending] });
// { valid: true }

A deposit without a rail reference, or through a rail the address does not publish, has no receipt.

7. Pledge what the address accepts

const pledged = await pg.addresses.pledge(address.id, {
  accepts: [
    { network: 'sepa-inst', asset: 'EUR', limits: { max_single: { value: '10000.00', asset: 'EUR' } } },
    { network: 'swift', asset: 'EUR' },
  ],
});
// pledged.terms: 'pledged'
// pledged.commitment: the PATH commitment of the address
// (await pg.addresses.accepts(address.id))[0]: version 1, grammar 2, signed

const over = await pg.endpoints.simulateDeposit(endpoint.id, {
  amount: { value: '12000.00', asset: 'EUR' },
  network: 'sepa-inst',
  rail_reference: 'E2E-2026-0002',
});
// over.status: 'returned', over.reason: 'outside the limits of the address'
// over.receipt: { reference: 'rcp_…', status: 'failed', reason_code: 'limit_exceeded' }

The entries are in order of preference. A payer reads them with RESOLVER (pg.tools.resolver(address.address)), with the commitment of the pledge.

8. Pay the address

A payer pays the address as a PATH destination, destination: { path: address.address }, or by the alias of its subject. Path Global holds the address, so the route resolves it without SONAR, reads the pledge, and pays the payment instruction issued for the sepa-inst entry, within its 10 000 EUR limit:

// payerAccount: an Omni Account with a funded EUR holding.
const quote = await pg.router.quote({
  amount: { value: '400.00', asset: 'EUR' },
  source: { omni_account: payerAccount.id },
  destination: { path: address.address },
  deliver: { asset: 'EUR' },
});
// quote.route.destination: { network: 'sepa-inst', path_address: address.address, capability: { rail: 'sepa-inst', … }, commitment: pledged.commitment, intent_version: 1 }

The quote and the route name the address, the capability and the commitment, never the vIBAN. A revoked address answers 410 pathglobal.addresses.revoked, a replaced one 410 pathglobal.addresses.moved.

Other outcomes

CaseDeposit statusPayee receipt, with a rail reference
The endpoint has no anchorreturned to the payer, with a reasonfailed, destination_closed
The holding is frozen with scope allreview: held, not creditedpending
The endpoint is anchored to a destination outside Path Global ({ forward: { to } })forwarded, with the route that carries itsettled
Outside the limits the address pledgesreturned, outside the limits of the addressfailed, limit_exceeded
await pg.accounts.freeze(holding.id, { reason: 'a document review', scope: 'all' });
const held = await pg.endpoints.simulateDeposit(endpoint.id, { amount: { value: '300.00', asset: 'EUR' }, network: 'sepa-inst' });
// held.status === 'review'; the balance is unchanged

await pg.accounts.unfreeze(holding.id);

A freeze with scope debits, the default, stops what leaves the holding and still credits its deposits.

Only your own objects

A subject, an address, an endpoint, a holding and a deposit are read by the client that created them. Another client's key gets 404, as for an object that does not exist.

See accounts, addresses and endpoints.

On this page