> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prava.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Charge a Mandate

> Mint single-use card credentials against an active mandate — no passkey.

Mint fresh single-use card credentials against an active mandate — **no passkey**. Merchant callers receive plaintext `credentials`; agent callers receive an `encrypted_payload` (credentials encrypted to the agent's public key).

`POST /v1/mandates/{id}/charge` · Authenticated with your secret key (merchants) or Ed25519 signature (agents).

Need to **create** a mandate first? Mandate creation is part of the Session APIs — [create a mandate](https://docs.prava.space/api-reference/create-session.md#mandate-setup) with a `mandate_setup` block on Create Session.

> [!NOTE]
>
> Charging is available to **merchants** (secret key) and **agents** (Ed25519
> signature). It is deliberately **not** exposed over [MCP](https://docs.prava.space/mcp/tools.md#mandates).
> See [Mandates](https://docs.prava.space/concepts/mandates.md) for the model.

## Path parameters

**id** `string` *required*

The mandate id (from [List Mandates](https://docs.prava.space/api-reference/mandate-list.md)).

## Body

**amount** `string` *required*

Charge amount as a decimal string with up to 2 decimals, e.g. `"40.00"`. The per-charge cap is enforced by the card network — an over-cap charge is declined.

**reference** `string`

Idempotency key (max 255). The same mandate id + `reference` returns the original charge (`deduplicated: true`) instead of minting again. Omit it and every call is a distinct charge. A *failed* charge clears its key, so a retry after failure is not deduplicated.

**purchase\_context** `object[]`

Optional per-charge product details (exactly one entry, same shape as the `purchase_context.custom` entries in [Create Session](https://docs.prava.space/api-reference/create-session.md)). Omit to reuse the mandate's setup context. Currency always comes from the mandate, never the charge.

## Response

**mandateId** `string`

**instructionId** `string`

**transactionId** `string`

Pass this to [Report a Mandate Charge](https://docs.prava.space/api-reference/mandate-report.md).

**orderId** `string`

**status** `string`

`awaiting_result` or `failed`.

**fetchStatus** `string`

`SUCCESS` or `FAILURE`.

**credentials** `object`

Merchant callers: `{ token, dynamicCvv, expiryMonth, expiryYear }`.

**encrypted\_payload** `object`

Agent callers: `{ ephemeral_public_key, iv, auth_tag, data }`, decrypted client-side.

**errorCode** `string`

The existing public failure code. Use this field to select your error handler; see the [error catalog](https://docs.prava.space/webhooks/errors.md).

**errorMessage** `string`

Fixed, safe text from the error catalog. Raw provider diagnostics are not returned. Do not parse this message for an upstream reason.

**deduplicated** `boolean`

True when a prior charge with the same `reference` was returned.

## Notes

* The mandate must be `active`. Charging a non-active mandate returns `409 MANDATE_NOT_ACTIVE`.
* An over-cap rejection is a normal outcome: `status: "failed"`, typically `errorCode: "DECLINED"`, with a fixed safe message. The amount cap is enforced at the card-network level; the response does not expose its raw threshold diagnostic.
* A charge outside a `listed` mandate's merchant returns `403 MANDATE_MERCHANT_NOT_ALLOWED`.
* After checkout, settle the outcome with [Report a Mandate Charge](https://docs.prava.space/api-reference/mandate-report.md).

## Error responses

| Status | Code | Cause |
| - | - | - |
| 400 | `VAL_2001` | Missing or invalid `amount` |
| 401 | `AUTH_REQUIRED` | Missing or invalid credentials |
| 403 | `MANDATE_FORBIDDEN` | Caller does not own this mandate |
| 403 | `MANDATE_MERCHANT_NOT_ALLOWED` | Listed-scope mandate; the charge names a merchant not on the allow-list |
| 409 | `MANDATE_NOT_ACTIVE` | Mandate is not `active` |
| 409 | `NO_INSTRUCTION` / `NO_ORDER` | Mandate is missing its instruction/order |
| 500 | `NO_TOKEN` | Credential minting failed |

```bash cURL theme={null}
curl -X POST https://sandbox.api.prava.space/v1/mandates/mdt_123/charge \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{ "amount": "40.00", "reference": "invoice_2026_07" }'
```

```python Python theme={null}
import requests

resp = requests.post(
    "https://sandbox.api.prava.space/v1/mandates/mdt_123/charge",
    headers={"Authorization": "Bearer sk_test_..."},
    json={"amount": "40.00", "reference": "invoice_2026_07"},
)
```

```javascript JavaScript theme={null}
const resp = await fetch("https://sandbox.api.prava.space/v1/mandates/mdt_123/charge", {
  method: "POST",
  headers: {
    Authorization: "Bearer sk_test_...",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    amount: "40.00",
    reference: "invoice_2026_07",
  }),
});
```

```json 200 Success theme={null}
{
  "mandateId": "mdt_123",
  "instructionId": "ins_1",
  "transactionId": "txn_9",
  "orderId": "ord_9",
  "status": "awaiting_result",
  "fetchStatus": "SUCCESS",
  "credentials": { "token": "4111111111111111", "dynamicCvv": "123", "expiryMonth": "12", "expiryYear": "2030" },
  "deduplicated": false
}
```

```json 403 Forbidden theme={null}
{
  "error": { "code": "MANDATE_FORBIDDEN", "message": "Caller does not own this mandate" }
}
```

```json 409 Mandate Not Active theme={null}
{
  "error": { "code": "MANDATE_NOT_ACTIVE", "message": "Mandate is not active" }
}
```


## OpenAPI

````yaml api-reference/openapi.json POST /v1/mandates/{id}/charge
openapi: 3.1.0
info:
  title: Prava Payments API
  description: >-
    Server-side REST API for Prava Payments. All requests are authenticated with
    your secret key (sk_test_* in sandbox, sk_live_* in production).
  version: 1.0.0
servers:
  - url: https://sandbox.api.prava.space
    description: Sandbox
  - url: https://api.prava.space
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/mandates/{id}/charge:
    post:
      summary: Charge a Mandate
      description: >-
        Mint fresh single-use card credentials against an active mandate — no
        passkey. Available to merchants (secret key) and agents (Ed25519
        signature); not exposed over MCP. For agent callers the credentials are
        returned as an encrypted_payload.
      operationId: chargeMandate
      parameters:
        - name: id
          in: path
          required: true
          description: The mandate id (from List Mandates).
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MandateChargeRequest'
      responses:
        '200':
          description: Charge initiated; single-use credentials issued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MandateChargeResult'
        '400':
          $ref: '#/components/responses/Error'
        '401':
          $ref: '#/components/responses/Error'
        '403':
          $ref: '#/components/responses/Error'
        '409':
          $ref: '#/components/responses/Error'
        '500':
          $ref: '#/components/responses/Error'
components:
  schemas:
    MandateChargeRequest:
      type: object
      required:
        - amount
      properties:
        amount:
          type: string
          pattern: ^\d+(\.\d{1,2})?$
          description: >-
            Charge amount as a decimal string, e.g. "40.00". Must be within the
            mandate cap.
        reference:
          type: string
          maxLength: 255
          description: >-
            Idempotency key. The same mandate id + reference returns the
            original charge.
        purchase_context:
          type: array
          minItems: 1
          maxItems: 1
          description: >-
            Optional per-charge product details — same shape as
            purchase_context.custom in Create Session.
          items:
            $ref: '#/components/schemas/CustomPurchaseContext'
    MandateChargeResult:
      type: object
      properties:
        mandateId:
          type: string
        instructionId:
          type: string
        transactionId:
          type: string
        orderId:
          type: string
        status:
          type: string
          enum:
            - awaiting_result
            - failed
        fetchStatus:
          type: string
          enum:
            - SUCCESS
            - FAILURE
        credentials:
          type: object
          description: 'Present for merchant callers: single-use card credentials.'
          properties:
            token:
              type: string
            dynamicCvv:
              type: string
            expiryMonth:
              type: string
            expiryYear:
              type: string
        encrypted_payload:
          type: object
          description: >-
            Present for agent callers: credentials encrypted to the agent's
            public key.
          properties:
            ephemeral_public_key:
              type: string
            iv:
              type: string
            auth_tag:
              type: string
            data:
              type: string
        errorCode:
          type: string
        errorMessage:
          type: string
          description: >-
            Fixed safe catalog message. Raw provider diagnostics are excluded;
            use errorCode to select your handler.
        deduplicated:
          type: boolean
    CustomPurchaseContext:
      type: object
      required:
        - merchant_details
        - product_details
      properties:
        merchant_details:
          type: object
          required:
            - name
            - url
            - country_code_iso2
          properties:
            name:
              type: string
              minLength: 1
              description: Merchant display name
            url:
              type: string
              format: uri
              pattern: ^https://
              description: >-
                Merchant website URL. Must use https - the URL is forwarded to
                Visa.
            country_code_iso2:
              type: string
              minLength: 2
              maxLength: 2
              pattern: ^[A-Z]{2}$
              description: Two uppercase ISO 3166-1 country code (e.g. "US")
            category_code:
              type: string
              maxLength: 10
              description: Merchant category code
            category:
              type: string
              maxLength: 100
              description: Merchant category description
        product_details:
          type: array
          minItems: 1
          items:
            type: object
            required:
              - description
              - unit_price
            properties:
              description:
                type: string
                minLength: 1
                description: Product description
              unit_price:
                type: string
                minLength: 1
                description: Unit price as a string (no fixed decimal format enforced)
              product_id:
                type: string
                maxLength: 50
                description: Your external product identifier
              quantity:
                type: integer
                minimum: 1
                default: 1
                description: Quantity of this product
        effective_until_minutes:
          type: integer
          minimum: 1
          default: 15
          description: >-
            How long the mandate remains effective, in minutes. Positive
            integer, no maximum.
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code (e.g. VAL_2001, AUTH_1001)
            message:
              type: string
              description: Human-readable error message
            details:
              type: object
              description: >-
                Optional — included for validation errors to specify which
                fields failed
  responses:
    Error:
      description: Error response
      headers:
        X-Response-ID:
          $ref: '#/components/headers/XResponseId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  headers:
    XResponseId:
      description: >-
        UUID correlation identifier for this response. Include it when
        contacting Prava support.
      schema:
        type: string
        format: uuid
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Your secret key: sk_test_* (sandbox) or sk_live_* (production).'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.