Invoices
View as Markdown

Create a one-off invoice (charged to the card on file, or sent with a pay link)

Needs the invoices:write scope, or a full-access key. About scopes

POST
/api/v1/invoices/one-off

Authorization

Authorization
Required
Bearer <token>

An API key: gpy_test_… or gpy_live_… (or an agent key, agk_…).

In: header

Request Body

application/jsonOptional

customer_idstring

Format: "uuid"

customer_external_idstring

Exactly one of customer_id / customer_external_id.

lines
Required
array<Any properties in object, object, object>

currencystring

Optional check; must equal the customer’s currency.

Value in: "USD" | "AUD" | "CAD" | "GBP" | "EUR" | "INR" | "NPR"

metadataobject

At most 20 flat keys, 4 KB as JSON; carried by invoice.paid. credit_pack_pool, credit_pack_amount and tax_notes are reserved.

collection_methodstring

Default: "charge_automatically"Value in: "charge_automatically" | "send_invoice"

days_until_dueinteger

For send_invoice (asked for, or the no-card fallback). Default 14.

Minimum: 1Maximum: 365

Header Parameters

Idempotency-Key
Required
string

Required. A unique value for this operation, chosen by you. A retry with the same key and the same body returns the first response instead of running again. The same key with a different body answers 409 idempotency_key_reused; a key whose first request is still running answers 409 idempotency_in_progress.

curl -X POST "https://globalymint.com/api/v1/invoices/one-off" \
  -H "Idempotency-Key: order-8842-charge" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "customer_external_id": "string",
    "lines": [
      {
        "plan_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "quantity": 1
      }
    ],
    "currency": "USD",
    "metadata": {
      "gos_pack": "25k",
      "gos_credits": "25000",
      "gos_request_id": "r1"
    },
    "collection_method": "charge_automatically",
    "days_until_due": 1
  }'

The invoice, finalized. With a card on file it is charged after commit (payment.status attempted; paid is confirmed by invoice.paid, which carries the metadata). With no card it is issued as send_invoice with a due_date and pay_url, and never auto-charged. A declined card is payment.status failed with a pay_url — not an error. Paid at once (payment null) when the customer credit balance covers it.

{
  "data": {
    "invoice": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "number": "string",
      "status": "finalized",
      "total_cents": "1999",
      "amount_due_cents": "1999",
      "currency": "USD",
      "collection_method": "charge_automatically",
      "due_date": "2019-08-24",
      "metadata": {
        "property1": null,
        "property2": null
      }
    },
    "payment": {
      "status": "attempted",
      "payment_intent_id": "string",
      "reason": "string"
    },
    "pay_url": "string"
  },
  "_agent": {
    "summary": "string",
    "status": "ok",
    "next_actions": [
      "string"
    ],
    "warnings": [
      "string"
    ]
  },
  "api_version": "2026-07-01"
}