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

# Order Plan

> Allows a subscriber (human or agent) to purchase a payment plan using crypto or fiat.

Allows a subscriber (human or agent) to purchase a payment plan using crypto or fiat.

Credits will be issued immediately and can be used to query any agent tied to the plan.

## Example Usage

```ts theme={null}
const orderResult = await payments.orderPlan(planId)
```

## Parameters

* **planId**: The ID of the payment plan to purchase

## Returns

```json theme={null}
{
  "txHash": "string",
  "balance": {
    "isSubscriber": true,
    "total": "number",
    "used": "number", 
    "remaining": "number"
  }
}
```

## Notes

* The plan must already be registered and contain pricing logic (fixed, expirable, or dynamic)
* Payment is settled on-chain or via Stripe, depending on plan configuration


## OpenAPI

````yaml POST /plan/{planId}/order
openapi: 3.1.0
info:
  title: Nevermined API
  description: >-
    API for managing AI agents, payment plans, and subscriptions in the
    Nevermined ecosystem
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: http://sandbox.mintlify.com
security:
  - bearerAuth: []
paths:
  /plan/{planId}/order:
    post:
      tags:
        - Plans
      summary: Order Plan
      description: >-
        Allows a subscriber (human or agent) to purchase a payment plan using
        crypto or fiat.
      operationId: orderPlan
      parameters:
        - name: planId
          in: path
          description: The unique identifier of the plan to order
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Order successful
          content:
            application/json:
              schema:
                type: object
                properties:
                  txHash:
                    type: string
                  balance:
                    $ref: '#/components/schemas/Balance'
components:
  schemas:
    Balance:
      type: object
      properties:
        isSubscriber:
          type: boolean
        total:
          type: integer
        used:
          type: integer
        remaining:
          type: integer
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````