# Billing for the end customer

Source: https://www.pontive.com/docs/api-reference/management/billing-for-the-end-customer

Base URL: `https://api.{region}.pontive.com/v1` (operations that name another server say so).

Authentication: send `Authorization: Bearer <token>` with a secret key (`pontive_sk_…`, which implies its instance) or an access token issued for this API. A token that can reach several instances also names one with `X-Pontive-Instance-ID: inst_…`. Secret keys are for servers only.

## GET /v1/me/billing/balances

```http
GET https://{auth_domain}/v1/me/billing/balances
```

billing.ledger.v1.MeLedgerService/ListMyBalances (36-credits-ledger.md, API Surface). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `ListMyBalances` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |
| `page` | integer |  | Page number, from 1 |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |
| `unit` | string |  | unit |

### Responses

- `200` A list of Balance objects with pagination: List
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/me/billing/checkout-sessions

```http
POST https://{auth_domain}/v1/me/billing/checkout-sessions
```

billing.contract.v1.MeContractService/CreateMyCheckoutSession (35-contracts.md, End-customer portal and API Surface). The body is { subject?, packages, success_url, cancel_url }. billing-svc checks both URLs against the browser's Origin, which the gateway passes in the request context, and refuses a request without one (35-contracts.md, Checkout; billing-svc docs/questions.md, P71). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `CreateMyCheckoutSession` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `201` A MyCheckoutSession object, object checkout_session: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/checkout-sessions/{checkout_session_id}

```http
GET https://{auth_domain}/v1/me/billing/checkout-sessions/{checkout_session_id}
```

billing.contract.v1.MeContractService/GetMyCheckoutSession (35-contracts.md, End-customer portal and API Surface). Under pontive:billing:pay, the scope the checkout element holds (41-embedded-organization-management.md, section 5.1). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `GetMyCheckoutSession` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `checkout_session_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Responses

- `200` A MyCheckoutSession object, object checkout_session: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/me/billing/checkout-sessions/{checkout_session_id}/confirm

```http
POST https://{auth_domain}/v1/me/billing/checkout-sessions/{checkout_session_id}/confirm
```

billing.contract.v1.MeContractService/ConfirmMyCheckoutSession (35-contracts.md, End-customer portal and API Surface). The body is { package, billing_frequency, billing_address?, tax_id?, promotion_code? }, package a pkg_ id or the package's key (api-route-review D55). The answer carries a client secret: no log or span holds the response body (billing-svc docs/m17-design.md, R8). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `ConfirmMyCheckoutSession` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `checkout_session_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `200` The ConfirmMyCheckoutSessionResponse fields: outcome, contract_id, invoice_id, payment_id, client_secret, intent_type, decline_message and keys: object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/me/billing/checkout-sessions/{checkout_session_id}/preview

```http
POST https://{auth_domain}/v1/me/billing/checkout-sessions/{checkout_session_id}/preview
```

billing.contract.v1.MeContractService/PreviewMyCheckoutSession (35-contracts.md, End-customer portal and API Surface). The body is confirm's (P65). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48). The RPC writes nothing and takes no idempotency key, so X-Idempotency-Key is not read.

Operation ID: `PreviewMyCheckoutSession` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `checkout_session_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Responses

- `200` The first Invoice as it would be; nothing is saved: object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/contracts

```http
GET https://{auth_domain}/v1/me/billing/contracts
```

billing.contract.v1.MeContractService/ListMyContracts (35-contracts.md, End-customer portal and API Surface). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `ListMyContracts` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |
| `page` | integer |  | Page number, from 1 |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |

### Responses

- `200` A list of MyContract objects, object contract, with pagination: List
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/me/billing/contracts/{contract_id}/cancel

```http
POST https://{auth_domain}/v1/me/billing/contracts/{contract_id}/cancel
```

billing.contract.v1.MeContractService/CancelMyContract (35-contracts.md, End-customer portal and API Surface). The body is { reason? }. An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `CancelMyContract` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `contract_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `200` A MyContract object, object contract: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/me/billing/contracts/{contract_id}/change-package

```http
POST https://{auth_domain}/v1/me/billing/contracts/{contract_id}/change-package
```

billing.contract.v1.MeContractService/ChangeMyContract (35-contracts.md, End-customer portal and API Surface). The body is the preview's, with its preview_hash; preview_stale when the preview changed. An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `ChangeMyContractPackage` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `contract_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `200` A MyContract object, object contract: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/me/billing/contracts/{contract_id}/change-package/preview

```http
POST https://{auth_domain}/v1/me/billing/contracts/{contract_id}/change-package/preview
```

billing.contract.v1.MeContractService/PreviewMyContractChange (35-contracts.md, End-customer portal and API Surface). The body is { package, billing_frequency? } or { quantity, subscription_id? }. An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48). The RPC writes nothing and takes no idempotency key, so X-Idempotency-Key is not read.

Operation ID: `PreviewMyContractChange` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `contract_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Responses

- `200` The PreviewMyContractChangeResponse fields: contract, invoices, upcoming_invoice and preview_hash: object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## DELETE /v1/me/billing/contracts/{contract_id}/edits/{edit_id}

```http
DELETE https://{auth_domain}/v1/me/billing/contracts/{contract_id}/edits/{edit_id}
```

billing.contract.v1.MeContractService/DeleteMyContractEdit (35-contracts.md, Package changes and End-customer portal; billing-svc P124). Cancels the contract's pending change, a scheduled downgrade, by deleting its edit: edit_id is the contract's pending_change.edit_id, and any other edit is not_found. Only a change the end customer asked for, pending_change.initiated_by customer, may be cancelled here; one the client made is change_not_allowed. billing.contract.edit_cancelled is written as for DELETE /v1/billing/contracts/{contract_id}/edits/{edit_id}. An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `DeleteMyContractEdit` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `contract_id` | string | yes | id |
| `edit_id` | string | yes | edit_id: the contract's pending_change.edit_id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `204` No Content
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/me/billing/contracts/{contract_id}/revoke-cancellation

```http
POST https://{auth_domain}/v1/me/billing/contracts/{contract_id}/revoke-cancellation
```

billing.contract.v1.MeContractService/RevokeMyContractCancellation (35-contracts.md, End-customer portal and API Surface). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `RevokeMyContractCancellation` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `contract_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `200` A MyContract object, object contract: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/credit-notes

```http
GET https://{auth_domain}/v1/me/billing/credit-notes
```

billing.invoice.v1.MeInvoiceService/ListMyCreditNotes (37-invoicing.md, API Surface). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `ListMyCreditNotes` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |
| `page` | integer |  | Page number, from 1 |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |

### Responses

- `200` A list of CreditNote objects with pagination: List
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/credit-notes/{credit_note_id}/pdf

```http
GET https://{auth_domain}/v1/me/billing/credit-notes/{credit_note_id}/pdf
```

billing.invoice.v1.MeInvoiceService/GetMyCreditNotePdf (37-invoicing.md, API Surface). The credit note's PDF as a download, not an envelope: Content-Type application/pdf and Content-Disposition attachment with the file name billing-svc gives. A voided credit note's is the VOID rendition. Another Customer's credit note is credit_note_not_found. Needs a token for the instance's me audience with pontive:billing:read.

Operation ID: `GetMyCreditNotePdf` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `credit_note_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Responses

- `200` The PDF: file, file
- `401` Unauthorized: ErrResponse, ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse, ErrResponse
- `404` Not Found: ErrResponse, ErrResponse
- `422` Unprocessable Entity: ErrResponse, ErrResponse

## PATCH /v1/me/billing/customer

```http
PATCH https://{auth_domain}/v1/me/billing/customer
```

billing.payment.v1.MePaymentService/SetMyDefaultPaymentMethod (38-payments-and-tax.md, API Surface; api-route-review D38). The caller's Customer, or the subject's it names: default_payment_method_id, one of its payment methods, becomes its default. An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `UpdateMyCustomer` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `200` The default PaymentMethod object: object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/customers

```http
GET https://{auth_domain}/v1/me/billing/customers
```

billing.customer.v1.MeCustomerService/ListMyCustomers (32-billing-overview.md, End-customer surface). The caller's own user Customer, the token's organization's where they hold a billing key, and the suspended or closed organizations they own and may recover (P79, P122), each with what the caller may do there: recovery marks those, and closed marks one its client closed, where only paying and the payment method are open. An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `ListMyCustomers` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `page` | integer |  | Page number |
| `limit` | integer |  | Items per page, 1 to 100 |

### Responses

- `200` A list of MyCustomer objects, object customer, without pagination: List
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/entitlements

```http
GET https://{auth_domain}/v1/me/billing/entitlements
```

billing.entitlement.v1.MeEntitlementService/ListMyEntitlements (39-entitlements-and-controls.md, API Surface). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `GetMyEntitlements` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Responses

- `200` An EntitlementSet object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/invoices

```http
GET https://{auth_domain}/v1/me/billing/invoices
```

billing.invoice.v1.MeInvoiceService/ListMyInvoices (37-invoicing.md, API Surface). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `ListMyInvoices` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |
| `page` | integer |  | Page number, from 1 |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |
| `status` | string |  | status |

### Responses

- `200` A list of Invoice objects with pagination: List
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/invoices/upcoming

```http
GET https://{auth_domain}/v1/me/billing/invoices/upcoming
```

billing.invoice.v1.MeInvoiceService/GetMyUpcomingInvoice (37-invoicing.md, API Surface). The upcoming invoice of the contract in force; invoice_not_found when there is none. An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `GetMyUpcomingInvoice` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Responses

- `200` An Invoice object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/invoices/{invoice_id}

```http
GET https://{auth_domain}/v1/me/billing/invoices/{invoice_id}
```

billing.invoice.v1.MeInvoiceService/GetMyInvoice (37-invoicing.md, API Surface). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `GetMyInvoice` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Responses

- `200` An Invoice object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/me/billing/invoices/{invoice_id}/pay

```http
POST https://{auth_domain}/v1/me/billing/invoices/{invoice_id}/pay
```

billing.payment.v1.MePaymentService/PayMyInvoice (38-payments-and-tax.md, API Surface). The body is { method }, saved or new. The answer carries a client secret: no log or span holds the response body (billing-svc docs/m17-design.md, R8). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `PayMyInvoice` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `200` The PayMyInvoiceResponse fields: outcome, payment_id, client_secret, intent_type, decline_message and keys: object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/invoices/{invoice_id}/pdf

```http
GET https://{auth_domain}/v1/me/billing/invoices/{invoice_id}/pdf
```

billing.invoice.v1.MeInvoiceService/GetMyInvoicePdf (37-invoicing.md, API Surface). The invoice's PDF as a download, not an envelope: Content-Type application/pdf and Content-Disposition attachment with the file name billing-svc gives. An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `GetMyInvoicePdf` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `invoice_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Responses

- `200` The PDF: file, file
- `401` Unauthorized: ErrResponse, ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse, ErrResponse
- `404` Not Found: ErrResponse, ErrResponse
- `422` Unprocessable Entity: ErrResponse, ErrResponse

## GET /v1/me/billing/ledger-entries

```http
GET https://{auth_domain}/v1/me/billing/ledger-entries
```

billing.ledger.v1.MeLedgerService/ListMyLedgerEntries (36-credits-ledger.md, API Surface). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `ListMyLedgerEntries` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |
| `after` | string |  | Cursor: a next_cursor, to continue forward |
| `before` | string |  | Cursor: a next_cursor, to read the page just before it |
| `type` | string |  | type |
| `from` | string |  | RFC 3339 time |
| `to` | string |  | RFC 3339 time |

### Responses

- `200` A list of LedgerEntry objects, walked by cursor (api-route-review D41): CursorList
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## POST /v1/me/billing/payment-method-session

```http
POST https://{auth_domain}/v1/me/billing/payment-method-session
```

billing.payment.v1.MePaymentService/CreateMyPaymentMethodSession (38-payments-and-tax.md, API Surface). The body is { mode?, return_url? }. The answer carries a client secret: no log or span holds the response body (billing-svc docs/m17-design.md, R8). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `CreateMyPaymentMethodSession` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `201` A PaymentMethodSession object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/payment-methods

```http
GET https://{auth_domain}/v1/me/billing/payment-methods
```

billing.payment.v1.MePaymentService/ListMyPaymentMethods (38-payments-and-tax.md, API Surface). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `ListMyPaymentMethods` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |
| `page` | integer |  | Page number, from 1 |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |

### Responses

- `200` A list of PaymentMethod objects with pagination: List
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## DELETE /v1/me/billing/payment-methods/{payment_method_id}

```http
DELETE https://{auth_domain}/v1/me/billing/payment-methods/{payment_method_id}
```

billing.payment.v1.MePaymentService/RemoveMyPaymentMethod (38-payments-and-tax.md, API Surface). {id} is the spec's {pm}. An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:pay (D31, D48).

Operation ID: `DeleteMyPaymentMethod` · Capability: `billing`

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `payment_method_id` | string | yes | id |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-Idempotency-Key` | string |  | Idempotency key |

### Responses

- `200` The removed PaymentMethod object, with warnings: object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/payments

```http
GET https://{auth_domain}/v1/me/billing/payments
```

billing.payment.v1.MePaymentService/ListMyPayments (38-payments-and-tax.md, API Surface). An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `ListMyPayments` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |
| `page` | integer |  | Page number, from 1 |
| `limit` | integer |  | Items per page, 1 to 100, default 25 |

### Responses

- `200` A list of Payment objects with pagination: List
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## GET /v1/me/billing/usage

```http
GET https://{auth_domain}/v1/me/billing/usage
```

billing.metering.v1.MeUsageService/GetMyUsage (33-metering.md, API Surface). The same parameters as GET /v1/usage, for the caller's Customer. An instance user's token must be issued for the instance's me audience, https://{auth domain}/me/, with pontive:billing:read (D31, D48).

Operation ID: `GetMyUsage` · Capability: `billing`

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `subject_type` | string |  | user or organization: the subject whose Customer to act for; with subject_id |
| `subject_id` | string |  | the subject's id, usr_ or org_; with subject_type |
| `meter` | string |  | A mtr_ id or a meter key; named without _id because it takes either (route review D1) |
| `from` | string |  | RFC 3339 time |
| `to` | string |  | RFC 3339 time |
| `granularity` | string |  | granularity |
| `group_by` | string |  | group_by, repeated or comma separated |

### Responses

- `200` A UsageSeries object: Object
- `401` Unauthorized: ErrResponse
- `403` module_required: the instance's billing capability is off: ErrResponse
- `404` Not Found: ErrResponse
- `409` Conflict: ErrResponse
- `422` Unprocessable Entity: ErrResponse

## Schemas

### List

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | Object[] |  |  |
| `object` | string |  |  |
| `pagination` | Pagination |  | Pagination is the page answered (api-route-review D9). |

### ErrResponse

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | ErrBody |  |  |

### Object

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string |  | ID is its prefixed id. |
| `object` | string |  | Object names the kind: customer, invoice, contract, … |

### CursorList

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | Object[] |  |  |
| `next_cursor` | string |  |  |
| `object` | string |  |  |

### Pagination

Pagination is the page answered (api-route-review D9).

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | integer |  | Limit is the maximum number of items per page. |
| `page` | integer |  | Page is the 1-based index of the returned page. |
| `total` | integer |  | Total is the total number of items across all pages. |
| `total_pages` | integer |  | TotalPages is the total number of pages available. |

### ErrBody

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string |  | Code is the spec's machine-readable code for this error, in snake case: a domain code such as seat_limit_reached where the refusal has one, otherwise a generic one such as permission_denied, not_found, conflict, invalid_request or service_unavailable. |
| `details` | ErrDetail[] |  | Details are per-field findings, present only on a refusal that has them, e.g. a 422 invalid_theme names each invalid value by its path, a 422 package_invalid each problem, and a 409 capability_in_use each count by its name. |
| `doc_url` | string |  | DocURL links to documentation about this error, when available. |
| `message` | string |  | Message is a human-readable description of what went wrong. |
| `object` | string |  | Object is the discriminator; always "error". |
| `param` | string |  | Param names the request parameter this error refers to, when applicable. |
| `type` | "validation_error" \| "authentication_error" \| "authorization_error" \| "not_found" \| "conflict_error" \| "rate_limit_error" \| "internal_error" |  | Type is the error's category, set by its HTTP status: one of validation_error, authentication_error, authorization_error, not_found, conflict_error, rate_limit_error, internal_error. |

### ErrDetail

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | string |  | Field is where the finding is: for a theme, its dotted path. |
| `message` | string |  | Message is what is wrong there. |
