Skip to content

paystack

← All modules

9 endpoints.

GET /api/v1/settings/paystack

Get Paystack

The site's Paystack settings, secret key withheld.

200 — Successful Response

json
{}

PUT /api/v1/settings/paystack

Update Paystack

Upsert the Paystack settings, then return the refreshed (masked) view.

Request body

json
{
  "properties": {
    "public_key": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Public Key"
    },
    "secret_key": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255
        },
        {
          "type": "null"
        }
      ],
      "title": "Secret Key"
    },
    "currency": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 8
        },
        {
          "type": "null"
        }
      ],
      "title": "Currency"
    },
    "subaccount": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 64
        },
        {
          "type": "null"
        }
      ],
      "title": "Subaccount"
    }
  },
  "type": "object",
  "title": "PaystackIn",
  "description": "Partial update for the site's Paystack settings. A field omitted\n(``None``) is left untouched; an empty string clears that field."
}

200 — Successful Response

json
{}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/settings/paystack/test

Test Paystack

Live-check the currently-saved secret key against the Paystack API (a lightweight, read-only call). Charges nothing. Returns {ok, detail}.

200 — Successful Response

json
{}

GET /api/v1/paystack/pay/{token}

Paystack Pay Link

Public "Pay Now" link embedded in the invoice PDF/email (see app.services.accounting_pdf) — no login required. The invoice is looked up by its opaque, unguessable pay_token (see :func:app.services.accounting_payment_paystack.ensure_pay_token); that token IS the authorization, exactly like an Invitation.token link. Starts a fresh Paystack checkout on every click (so the link never goes stale, unlike a baked-in checkout URL) and redirects the browser to it — for the customer's amount due (their positive GL balance, matching the ageing total shown on the PDF), not this one invoice's own figure: the invoice only identifies whose account to settle.

Parameters

NameInRequiredTypeDescription
tokenpathyesstring

200 — Successful Response

json
{}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/paystack/debit-order/{token}

Paystack Debit Order Link

Public "Debit Order" signup link embedded in the invoice PDF/email — the exact same Paystack checkout as :func:paystack_pay_link (collects the customer's amount due), except the transaction is flagged debit_order so the webhook vaults the returned authorization code as a standing debit-order mandate (last_source="debit_order") for future off-session charges.

Parameters

NameInRequiredTypeDescription
tokenpathyesstring

200 — Successful Response

json
{}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/paystack/pay-statement/{token}

Paystack Pay Statement Link

Public "Pay Now" link embedded in the Statement of Account PDF/web view — a one-time charge of the customer's amount due, no standing mandate. Looked up by statement_token (the statement web view's own token, see :mod:app.api.public_documents) instead of an invoice pay_token. Sibling of :func:paystack_pay_statement_debit_order_link, which is the same checkout with debit_order=True.

Parameters

NameInRequiredTypeDescription
tokenpathyesstring

200 — Successful Response

json
{}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/paystack/debit-order-statement/{token}

Paystack Pay Statement Debit Order Link

Public "Pay Now & Auto-Charge Monthly" link embedded in the Statement of Account PDF/email — looked up by the customer's statement_token (the statement web view's own token, see :mod:app.api.public_documents) instead of an invoice pay_token. Same checkout + settlement as :func:paystack_pay_statement_link above: the customer's amount due (positive GL balance — exactly the statement's closing figure) — except the transaction is flagged debit_order so the webhook also vaults the returned authorization code as a standing mandate for future off-session monthly charges.

Parameters

NameInRequiredTypeDescription
tokenpathyesstring

200 — Successful Response

json
{}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

GET /api/v1/paystack/pay-quote/{token}

Paystack Pay Quote Link

Public "Pay Now" deposit link embedded in a Quotation/Sales Order PDF/email (see app.services.accounting_pdf) — no login required. Looked up across both doctypes by pay_token (see :func:app.services.accounting_payment_paystack.ensure_quote_like_pay_token). Unlike the invoice link, this pays the document's own grand_total as a deposit — there's no "open balance" to settle since a quote/order isn't an invoice yet (see :func:app.services.accounting_payment_paystack.init_quote_like_payment).

Parameters

NameInRequiredTypeDescription
tokenpathyesstring

200 — Successful Response

json
{}

422 — Validation Error

json
{
  "properties": {
    "detail": {
      "items": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "type": "array",
      "title": "Detail"
    }
  },
  "type": "object",
  "title": "HTTPValidationError"
}

POST /api/v1/paystack/webhook

Paystack Webhook

200 — Successful Response

json
{}

Lubb ERP Documentation