REST API

# Payment Links API

Create, list, and manage shareable payment links programmatically. A payment link is a hosted URL where customers pay by card — create one once and reuse it, or issue a fresh link per invoice.

## When to use payment links

Reach for payment links when you want a shareable URL you can create once and reuse across many payments, collect payment manually (WhatsApp, email, SMS, QR code) outside an automated checkout flow, or let non-developers manage links from the dashboard. Each billing cycle is a fresh link.

Reach for [checkout sessions](https://za.manza.finance/docs/api/checkout-sessions) instead when you need a per-order page tied to a specific cart, with `metadata` round-tripping and a post-payment redirect.

## Required scopes

| Endpoint | Scope |
| --- | --- |
| List / Get payment links | `payment_links:read` |
| Create / Cancel payment links | `payment_links:write` |

## Payment link object

The embedded `account` object is a compact projection (no balance or status). You are viewing the **ZAR** deployment, so a payment link looks like this:

```json
{
  "id": "01964a3b-7c8d-7000-8000-deadbeef1234",
  "slug": "a1B2c3D4e5F6",
  "status": "active",
  "link_type": "single",
  "amount": "1500.00",
  "currency_code": "ZAR",
  "description": "March consulting invoice",
  "payment_reference": "INV-000042",
  "payments_count": 0,
  "max_payments": null,
  "expires_at": "2026-04-15T23:59:59Z",
  "paid_at": null,
  "settled_at": null,
  "reversed_amount": "0.0",
  "redirect_url": "https://app.example.com/thank-you",
  "url": "https://pay.za.manza.finance/payment-link/a1B2c3D4e5F6",
  "invoice_id": null,
  "account": {
    "id": "01964a3b-0000-7000-8000-ac6000000a01",
    "name": "Operations",
    "currency_code": "ZAR",
    "account_number": "1234567890"
  },
  "created_at": "2026-03-15T09:00:00Z",
  "updated_at": "2026-03-15T09:00:00Z",
  "collect_billing_address": null,
  "billing_address": {}
}
```

> **Effective status:** The `status` field reflects effective status: a link may be `active` in the database but shown as `expired` once `expires_at` has passed or `payments_count >= max_payments`. A paid single-use link reads `clearing` until the provider settles the payment, then `paid` with `settled_at` set (a `payment_link.payment_settled` webhook fires at that moment).

> **Refunds and chargebacks:** `reversed_amount` is what completed refunds and chargebacks took back, over every payment the link received (`0.0` when none). Each one also fires a `payment_link.refunded` or `payment_link.charged_back` webhook naming the payment and the reversal, and an opened dispute fires `payment_link.dispute_opened` (South Africa only).

## List payment links

`GET` `/api/payment_links`

Filter by `status` and `link_type`, with cursor pagination (`limit` 1–100, default 25).

cURL

CLI

JavaScript

Ruby

Python

Go

Rust

Elixir

Crystal

PHP

```console
curl "https://za.manza.finance/api/payment_links?status=active" \
  -H "Authorization: Bearer sk_live_..."
```

```console
manza payment-links list --status active
```

```javascript
import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });

await manza.paymentLinks.list({ status: "active" });
```

```ruby
require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])

manza.payment_links.list(status: "active")
```

```python
from manza import Manza
client = Manza()  # reads MANZA_API_KEY

client.payment_links.list(status="active")
```

```go
import manza "github.com/getmanza/manza-go/v2"

client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))

page, err := client.PaymentLinks.List(ctx, manza.PaymentLinkListParams{Status: "active"})
```

```rust
let client = manza::Client::builder()
    .api_key(std::env::var("MANZA_API_KEY")?)
    .build()?;

let params = manza::PaymentLinkListParams { status: Some("active".into()), ..Default::default() };
let page = client.payment_links().list(params)?;
```

```elixir
{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))

{:ok, page} = Manza.PaymentLinks.list(client, status: "active")
```

```crystal
require "manza"

client = Manza::Client.new # reads MANZA_API_KEY

page = client.payment_links.list(status: "active")
```

```php
use Manza\Client;

$client = new Client(apiKey: getenv('MANZA_API_KEY'));

$page = $client->paymentLinks->list(status: 'active');
```

```json
{
  "data": [
    {
      "id": "01964a3b-7c8d-7000-8000-deadbeef1234",
      "slug": "a1B2c3D4e5F6",
      "status": "active",
      "link_type": "single",
      "amount": "1500.00",
      "currency_code": "ZAR",
      "description": "March consulting invoice",
      "payment_reference": "INV-000042",
      "payments_count": 0,
      "max_payments": null,
      "expires_at": "2026-04-15T23:59:59Z",
      "paid_at": null,
      "settled_at": null,
      "reversed_amount": "0.0",
      "redirect_url": "https://app.example.com/thank-you",
      "url": "https://pay.za.manza.finance/payment-link/a1B2c3D4e5F6",
      "invoice_id": null,
      "account": {
        "id": "01964a3b-0000-7000-8000-ac6000000a01",
        "name": "Operations",
        "currency_code": "ZAR",
        "account_number": "1234567890"
      },
      "created_at": "2026-03-15T09:00:00Z",
      "updated_at": "2026-03-15T09:00:00Z",
      "collect_billing_address": null,
      "billing_address": {}
    }
  ],
  "has_more": true,
  "next_cursor": "eyJpZCI6IjAxOTY0..."
}
```

## Create payment link

`POST` `/api/payment_links`

Required fields: `account_id` and `amount`. Discover valid account IDs via [GET /api/accounts](https://za.manza.finance/docs/api/accounts). The slug, currency, and URL are generated for you; `link_type` defaults to `single`.

> **Amount limits:** Amounts must be greater than 0. There is no API-side maximum — per-payer single-transaction and daily caps driven by the payer's KYC tier are enforced when the card is charged.

cURL

CLI

JavaScript

Ruby

Python

Go

Rust

Elixir

Crystal

PHP

```console
curl -X POST "https://za.manza.finance/api/payment_links" \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "account_id": "01964a3b-0000-7000-8000-ac6000000a01",
    "amount": "1500.00",
    "description": "March consulting invoice",
    "payment_reference": "INV-000042",
    "link_type": "single"
  }'
```

```console
manza payment-links create \
  --account-id 01964a3b-0000-7000-8000-ac6000000a01 \
  --amount 1500.00 \
  --description "March consulting invoice"
```

```javascript
import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });

await manza.paymentLinks.create({
  account_id: "01964a3b-0000-7000-8000-ac6000000a01",
  amount: "1500.00",
  description: "March consulting invoice",
  payment_reference: "INV-000042",
  link_type: "single",
});
```

```ruby
require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])

manza.payment_links.create(
  account_id: "01964a3b-0000-7000-8000-ac6000000a01",
  amount: "1500.00",
  description: "March consulting invoice",
  payment_reference: "INV-000042",
  link_type: "single"
)
```

```python
from manza import Manza
client = Manza()  # reads MANZA_API_KEY

client.payment_links.create(
    account_id="01964a3b-0000-7000-8000-ac6000000a01",
    amount="1500.00",
    description="March consulting invoice",
    payment_reference="INV-000042",
    link_type="single",
)
```

```go
import manza "github.com/getmanza/manza-go/v2"

client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))

link, err := client.PaymentLinks.Create(ctx, manza.Attributes{
    "account_id":        "01964a3b-0000-7000-8000-ac6000000a01",
    "amount":            "1500.00",
    "description":       "March consulting invoice",
    "payment_reference": "INV-000042",
    "link_type":         "single",
})
```

```rust
let client = manza::Client::builder()
    .api_key(std::env::var("MANZA_API_KEY")?)
    .build()?;

let link = client.payment_links().create(&serde_json::json!({
    "account_id": "01964a3b-0000-7000-8000-ac6000000a01",
    "amount": "1500.00",
    "description": "March consulting invoice",
    "payment_reference": "INV-000042",
    "link_type": "single",
}))?;
```

```elixir
{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))

{:ok, link} =
  Manza.PaymentLinks.create(client, %{
    "account_id" => "01964a3b-0000-7000-8000-ac6000000a01",
    "amount" => "1500.00",
    "description" => "March consulting invoice",
    "payment_reference" => "INV-000042",
    "link_type" => "single"
  })
```

```crystal
require "manza"

client = Manza::Client.new # reads MANZA_API_KEY

link = client.payment_links.create(
  account_id: "01964a3b-0000-7000-8000-ac6000000a01",
  amount: "1500.00",
  description: "March consulting invoice",
  payment_reference: "INV-000042",
  link_type: "single"
)
```

```php
use Manza\Client;

$client = new Client(apiKey: getenv('MANZA_API_KEY'));

$link = $client->paymentLinks->create([
    'account_id' => '01964a3b-0000-7000-8000-ac6000000a01',
    'amount' => '1500.00',
    'description' => 'March consulting invoice',
    'payment_reference' => 'INV-000042',
    'link_type' => 'single',
]);
```

```json
{
  "id": "01964a3b-7c8d-7000-8000-deadbeef1234",
  "slug": "a1B2c3D4e5F6",
  "status": "active",
  "link_type": "single",
  "amount": "1500.00",
  "currency_code": "ZAR",
  "description": "March consulting invoice",
  "payment_reference": "INV-000042",
  "payments_count": 0,
  "max_payments": null,
  "expires_at": "2026-04-15T23:59:59Z",
  "paid_at": null,
  "settled_at": null,
  "reversed_amount": "0.0",
  "redirect_url": "https://app.example.com/thank-you",
  "url": "https://pay.za.manza.finance/payment-link/a1B2c3D4e5F6",
  "invoice_id": null,
  "account": {
    "id": "01964a3b-0000-7000-8000-ac6000000a01",
    "name": "Operations",
    "currency_code": "ZAR",
    "account_number": "1234567890"
  },
  "created_at": "2026-03-15T09:00:00Z",
  "updated_at": "2026-03-15T09:00:00Z",
  "collect_billing_address": null,
  "billing_address": {}
}
```

## Billing address

The card form on the payment page can ask the payer for a billing address, which card issuers use to check that a payment is genuine. Two optional create fields control it:

| Field | Type | Meaning |
| --- | --- | --- |
| `collect_billing_address` | boolean or null | `true` asks, `false` shows card fields only. Omit it (or send `null`) to follow the workspace default in Settings → Payments. |
| `billing_address` | object | The payer's address, when you already know it. Keys: `line1`, `line2`, `city`, `state`, `postal_code`, `country` (ISO 3166-1 alpha-2, e.g. `ZA`). Single-use links only. |

When `billing_address` has at least `line1`, `city` and `country`, it is sent with the payment and the payer is not asked for it. Unknown keys are rejected with a 422. Links created from an invoice use the invoice customer's billing address automatically.

```json
{
  "account_id": "acc_…",
  "amount": "1500.00",
  "collect_billing_address": true,
  "billing_address": {
    "line1": "1 Long Street",
    "city": "Cape Town",
    "postal_code": "8001",
    "country": "ZA"
  }
}
```

## Get payment link

`GET` `/api/payment_links/:id`

Returns the full payment link object.

cURL

CLI

JavaScript

Ruby

Python

Go

Rust

Elixir

Crystal

PHP

```console
curl "https://za.manza.finance/api/payment_links/01964a3b-7c8d-7000-8000-deadbeef1234" \
  -H "Authorization: Bearer sk_live_..."
```

```console
manza payment-links get 01964a3b-7c8d-7000-8000-deadbeef1234
```

```javascript
import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });

await manza.paymentLinks.get("01964a3b-7c8d-7000-8000-deadbeef1234");
```

```ruby
require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])

manza.payment_links.get("01964a3b-7c8d-7000-8000-deadbeef1234")
```

```python
from manza import Manza
client = Manza()  # reads MANZA_API_KEY

client.payment_links.get("01964a3b-7c8d-7000-8000-deadbeef1234")
```

```go
import manza "github.com/getmanza/manza-go/v2"

client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))

link, err := client.PaymentLinks.Get(ctx, "01964a3b-7c8d-7000-8000-deadbeef1234")
```

```rust
let client = manza::Client::builder()
    .api_key(std::env::var("MANZA_API_KEY")?)
    .build()?;

let link = client.payment_links().get("01964a3b-7c8d-7000-8000-deadbeef1234")?;
```

```elixir
{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))

{:ok, link} = Manza.PaymentLinks.get(client, "01964a3b-7c8d-7000-8000-deadbeef1234")
```

```crystal
require "manza"

client = Manza::Client.new # reads MANZA_API_KEY

link = client.payment_links.get("01964a3b-7c8d-7000-8000-deadbeef1234")
```

```php
use Manza\Client;

$client = new Client(apiKey: getenv('MANZA_API_KEY'));

$link = $client->paymentLinks->get('01964a3b-7c8d-7000-8000-deadbeef1234');
```

## Cancel payment link

`POST` `/api/payment_links/:id/cancel`

Only `active` links that have not effectively expired can be cancelled. Links past `expires_at` or at `max_payments` cannot be cancelled even if their database status is still `active`. Cancelling a payment link does **not** cancel a linked invoice.

cURL

CLI

JavaScript

Ruby

Python

Go

Rust

Elixir

Crystal

PHP

```console
curl -X POST "https://za.manza.finance/api/payment_links/01964a3b-7c8d-7000-8000-deadbeef1234/cancel" \
  -H "Authorization: Bearer sk_live_..."
```

```console
manza payment-links cancel 01964a3b-7c8d-7000-8000-deadbeef1234
```

```javascript
import { Manza } from "@getmanza/sdk";
const manza = new Manza({ apiKey: process.env.MANZA_API_KEY });

await manza.paymentLinks.cancel("01964a3b-7c8d-7000-8000-deadbeef1234");
```

```ruby
require "manza"
manza = Manza.new(api_key: ENV["MANZA_API_KEY"])

manza.payment_links.cancel("01964a3b-7c8d-7000-8000-deadbeef1234")
```

```python
from manza import Manza
client = Manza()  # reads MANZA_API_KEY

client.payment_links.cancel("01964a3b-7c8d-7000-8000-deadbeef1234")
```

```go
import manza "github.com/getmanza/manza-go/v2"

client, _ := manza.New(manza.WithAPIKey(os.Getenv("MANZA_API_KEY")))

link, err := client.PaymentLinks.Cancel(ctx, "01964a3b-7c8d-7000-8000-deadbeef1234")
```

```rust
let client = manza::Client::builder()
    .api_key(std::env::var("MANZA_API_KEY")?)
    .build()?;

let link = client.payment_links().cancel("01964a3b-7c8d-7000-8000-deadbeef1234")?;
```

```elixir
{:ok, client} = Manza.new(api_key: System.fetch_env!("MANZA_API_KEY"))

{:ok, link} = Manza.PaymentLinks.cancel(client, "01964a3b-7c8d-7000-8000-deadbeef1234")
```

```crystal
require "manza"

client = Manza::Client.new # reads MANZA_API_KEY

link = client.payment_links.cancel("01964a3b-7c8d-7000-8000-deadbeef1234")
```

```php
use Manza\Client;

$client = new Client(apiKey: getenv('MANZA_API_KEY'));

$link = $client->paymentLinks->cancel('01964a3b-7c8d-7000-8000-deadbeef1234');
```

## Payment links for invoices

To let a customer pay an invoice by card, send `"generate_payment_link": true` when you create or update the invoice through the [Invoices API](https://za.manza.finance/docs/api/invoices), while payment links are enabled for your account. Manza makes the link when the invoice is approved, for the invoice's total and into the invoice's own account, and the invoice email includes it. Read the link from the invoice's `payment_link` field. Setting the field needs the `payment_links:write` scope. The link can be paid from approval on, also when the invoice was never sent: a payment at the invoice's total marks it `paid`.

## Adding payment links to your website

Payment links are **hosted pages**. Send the customer to the Manza-hosted URL and they pay there. To put one behind a button, make the button a normal link to the payment URL — the customer pays (including 3D Secure) and is sent back to your `redirect_url`. No API key and no JavaScript run in the customer's browser.

> **Do not iframe the payment page:** The hosted page sets a `frame-ancestors` policy, so browsers block it from loading inside a frame on another domain. This is deliberate: it protects against clickjacking and is required for 3D Secure. Link out to the page (same tab or new tab) instead of framing it.

Common questions when integrating a payment link into a website:

| Topic | Answer |
| --- | --- |
| **Cross-origin requests (CORS)** | Not applicable — you link to the hosted page rather than calling it from code. The API itself is server-side only and sends no CORS headers. |
| **Referrer policy** | No restriction. Visitors may arrive from any site. |
| **IP allowlisting** | None. The payment page is reachable from any IP address. |
| **Domain restrictions** | None on which site may link to a payment URL — any site can. The only limit is the frame-ancestors rule above, which stops the page being embedded in a frame on an external domain. |

## Checkout identifiers

Append query parameters to a payment link URL to identify the payer. Only these are accepted (all others are silently ignored): `client_reference_id`, `customer_email`, `customer_id`, `customer_name`. They are stored with the payment and returned as top-level fields in the `payment_link.paid` and `payment_link.payment_settled` webhooks (always present, set to `null` when not supplied). Each webhook carries the identifiers of the payment that triggered it, so a reusable link that has taken several payments still reports the right payer on every event.

> **Privacy — these are payer-modifiable:** These parameters are passed via the URL and can be modified by the payer. Safe for identifying who is paying — never use them to authorize actions on your side. Fields like `customer_email` and `customer_name` are visible in browser history, server logs, and shared links; prefer opaque identifiers. Passing email or name is opt-in PII exposure with possible compliance implications (GDPR/CCPA). To tie a payment to an order, use a dedicated link per order and the server-side `payment_reference` field.

## Returning customers to your mobile app

After a successful payment, the customer briefly sees the hosted confirmation page and is then redirected to the URL configured in `redirect_url`. The redirect is client-side: HTTPS URLs route through the browser, custom-scheme URLs route through the OS deep-link handler. If `redirect_url` is omitted, the customer stays on the hosted success page instead.

If the customer paid inside your mobile app — an in-app browser or a system browser launched from the app — there are three options for `redirect_url`, best to worst:

1. **Universal Link / App Link (recommended). **A plain HTTPS URL on your own domain that the OS routes to your installed app, falling back to the web if it isn't installed. Configure `apple-app-site-association` (iOS) and `assetlinks.json` (Android) on the same domain — one URL works on mobile and desktop, with no broken-redirect failure mode.
2. **Dispatcher page on your own domain. **An HTTPS URL that runs JavaScript on load to redirect to your app's custom scheme, falling back to the App Store or Play Store when no scheme handler fires.
3. **Custom app scheme directly. **A URL like `myapp://payment-success` that the OS hands to your installed app. Works only if the app is installed; in-app browsers (Facebook, Instagram, some mail clients) may silently swallow it with no fallback.

> **Schemes rejected for security:** The API accepts all three forms in `redirect_url`, but always rejects `http`, `javascript`, `data`, `file`, `vbscript`, `about`, and `blob` schemes. Always treat the `payment_link.paid` webhook — never the redirect arriving — as the canonical fulfillment signal: deep links can be swallowed by in-app browsers, and custom schemes fail when the app isn't installed.

## Immutability & status

Payment links are **intentionally immutable** after creation — you cannot change the amount, currency, link type, or account. For different terms, cancel the link and create a new one. This keeps an already-shared URL a consistent commitment.

The API can only **cancel** links. Marking a link `paid` happens exclusively through the card payment flow (a webhook from the payment processor), never via the API — this prevents payment fraud by requiring actual payment verification. Set `link_type: "reusable"` with `max_payments` to accept multiple payments; the link auto-expires once the count is reached.

## Recurring billing

Manza does not auto-charge stored cards. Your application schedules a fresh payment request each billing period, and the customer authorizes each payment. Follow the [Recurring billing guide](https://za.manza.finance/docs/recurring-billing) for the full workflow, approval options, reminders and webhook reconciliation.

## Error responses

| Scenario | Status | Type | Param |
| --- | --- | --- | --- |
| Invalid account_id | 422 | `validation_error` | `account_id` |
| Amount ≤ 0 | 422 | `validation_error` | `amount` |
| Invalid redirect_url | 422 | `validation_error` | `redirect_url` |
| Cancel non-active or expired link | 422 | `state_error` | — |
| expires_at in the past | 422 | `validation_error` | `expires_at` |