# Order a subscription

`POST https://api.cryptohopper.com/v1/subscription/order`

Part of [Subscriptions](https://www.cryptohopper.com/api-documentation/api-reference/subscriptions.md) in the Cryptohopper API reference.

Buys a subscription plan with the user's credits. Call it once without confirm to get a confirmation code, then call it again with that code in confirm to place and pay the order.

The first call returns data with message and confirm (the code to send back). Only plan_id 1, 2, 3 and 89 can be ordered; payment_term is year or month, anything else means month. discount_code is optional. The user profile must be complete and the credit balance must cover the total including tax. hopper_id is read but the new subscription is not assigned to that bot; use Assign subscription afterwards.

## Headers

| Name | Type | Required | Description |
|---|---|---|---|
| `access-token` | string | yes | The OAuth access token of the user. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `payment_term` | string | no | One of: year, month. |
| `plan_id` | integer | yes |  |
| `confirm` | string | no |  |
| `discount_code` | string | no |  |
| `hopper_id` | integer | no |  |

## Example request

```bash
curl -X POST "https://api.cryptohopper.com/v1/subscription/order" \
  -H "access-token: YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"plan_id":2,"payment_term":"month","confirm":"9e107d9d372bb6826bd81d3542a419d6"}'
```

## Response

Example response (illustrative values):

```json
{
    "data": {
        "message": "Your subscription has been ordered and paid.",
        "subscription_id": 466001,
        "plan_id": 2,
        "payment_id": 501234
    }
}
```

Status codes: 200. Errors return JSON with `status`, `error` and `message`, plus a numeric `code` when the error comes from the API itself rather than the gateway.
