API Reference — Orders & Invoicing

Manage subscription orders, trial limits, and invoices via API.

Create Order

cURL
$curl --request POST \
> --url 'https://cp-api.withpaygent.com/api/v1/orders' \
> --header 'Content-Type: application/json' \
> --header 'paygent-api-key: YOUR_API_KEY' \
> --data '{
> "customerExternalId": "customer-id",
> "orderName": "order-name",
> "startDate": "YYYY-MM-DD",
> "lineItems": [{ "agentId": "agent-id" }]
> }'

Get Order Invoices

Retrieve a list of invoices generated for a specific order.

cURL
$curl --request GET \
> --url 'https://cp-api.withpaygent.com/api/v1/orders/YOUR_ORDER_ID/invoices' \
> --header 'paygent-api-key: YOUR_API_KEY'

Mark Invoice Paid

Once an invoice is marked paid, any pending replacement orders tied to the invoice will be activated, and the old plan order will be set to superseded.

cURL
$curl --request POST \
> --url 'https://cp-api.withpaygent.com/api/v1/invoices/YOUR_INVOICE_ID/mark-paid' \
> --header 'paygent-api-key: YOUR_API_KEY'