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

# Prices

> Create and manage prices for your products. Prices define the cost and billing structure (one-time or recurring) for your products.

This API allows you to create and manage prices for your products. Prices define the cost and billing structure (one-time or recurring) for your products, enabling customers to make cryptocurrency payments.

## The price object

<ResponseField name="id" type="string">
  Unique identifier with `price_` prefix (e.g., `price_abc123def456`).
</ResponseField>

<ResponseField name="amount" type="integer">
  The price amount in cents (e.g., `2999` for \$29.99).
</ResponseField>

<ResponseField name="product_id" type="string">
  The associated product's ID.
</ResponseField>

<ResponseField name="active" type="boolean">
  Whether the price is active. Defaults to `true` on creation.
</ResponseField>

<ResponseField name="recurring" type="object">
  Recurring billing configuration. `null` for one-time prices.

  <Expandable title="recurring properties">
    <ResponseField name="interval" type="string">
      Billing interval: `day`, `week`, `month`, or `year`.
    </ResponseField>

    <ResponseField name="interval_count" type="integer">
      Number of intervals between charges.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="created_at" type="string">
  When the price was created (ISO 8601).
</ResponseField>

<ResponseField name="updated_at" type="string">
  When the price was last updated (ISO 8601).
</ResponseField>

### One-time price example

```json theme={null}
{
  "id": "price_def456ghi789",
  "amount": 4999,
  "product_id": "prod_xyz789ghi012",
  "active": true,
  "recurring": null,
  "created_at": "2024-01-02T10:30:00Z",
  "updated_at": "2024-01-02T10:30:00Z"
}
```

### Recurring price example

```json theme={null}
{
  "id": "price_abc123def456",
  "amount": 2999,
  "product_id": "prod_xyz789ghi012",
  "active": true,
  "recurring": {
    "interval": "month",
    "interval_count": 1
  },
  "created_at": "2024-01-01T12:00:00Z",
  "updated_at": "2024-01-01T12:00:00Z"
}
```

## List prices

```
GET /v1/prices
```

Retrieves a paginated list of all prices in your account.

<ParamField query="page" type="integer" default="1">
  Page number for pagination. Results are returned 25 items per page.
</ParamField>

```bash theme={null}
curl https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN"
```

```json Response theme={null}
{
  "prices": [
    {
      "id": "price_abc123def456",
      "amount": 2999,
      "product_id": "prod_xyz789ghi012",
      "active": true,
      "recurring": {
        "interval": "month",
        "interval_count": 1
      },
      "created_at": "2024-01-01T12:00:00Z",
      "updated_at": "2024-01-01T12:00:00Z"
    },
    {
      "id": "price_def456ghi789",
      "amount": 4999,
      "product_id": "prod_xyz789ghi012",
      "active": true,
      "recurring": null,
      "created_at": "2024-01-02T10:30:00Z",
      "updated_at": "2024-01-02T10:30:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "pages": 3,
    "count": 67
  }
}
```

## Get price

```
GET /v1/prices/:id
```

Retrieves a specific price by ID.

<ParamField path="id" type="string" required>
  The price's ID (e.g., `price_abc123def456`).
</ParamField>

```bash theme={null}
curl https://api.gettrxn.com/v1/prices/price_abc123def456 \
  -H "Authorization: Bearer $TRXN_TOKEN"
```

```json Response (recurring) theme={null}
{
  "id": "price_abc123def456",
  "amount": 2999,
  "product_id": "prod_xyz789ghi012",
  "active": true,
  "recurring": {
    "interval": "month",
    "interval_count": 1
  },
  "created_at": "2024-01-01T12:00:00Z",
  "updated_at": "2024-01-01T12:00:00Z"
}
```

```json Response (one-time) theme={null}
{
  "id": "price_def456ghi789",
  "amount": 4999,
  "product_id": "prod_xyz789ghi012",
  "active": true,
  "recurring": null,
  "created_at": "2024-01-02T10:30:00Z",
  "updated_at": "2024-01-02T10:30:00Z"
}
```

## Create price

```
POST /v1/prices
```

Creates a new price for a product in your account.

<ParamField body="product_id" type="string" required>
  The product's ID (e.g., `prod_abc123def456`). Must belong to your account.
</ParamField>

<ParamField body="amount" type="integer" required>
  The price amount in cents (e.g., `2999` for \$29.99). Must be 0 or greater.
</ParamField>

<ParamField body="recurring" type="object">
  Object containing recurring billing configuration. Omit for one-time prices.

  <Expandable title="recurring properties">
    <ParamField body="recurring.interval" type="string" required>
      Billing interval. One of: `day`, `week`, `month`, `year`.
    </ParamField>

    <ParamField body="recurring.interval_count" type="integer" required>
      Number of intervals between charges. Must be a positive integer (e.g., `1` for monthly, `3` for quarterly).
    </ParamField>
  </Expandable>
</ParamField>

### Create a one-time price

```bash theme={null}
curl -X POST https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prod_abc123def456",
    "amount": 4999
  }'
```

### Create a monthly recurring price

```bash theme={null}
curl -X POST https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prod_abc123def456",
    "amount": 2999,
    "recurring": {
      "interval": "month",
      "interval_count": 1
    }
  }'
```

### Create a quarterly recurring price

```bash theme={null}
curl -X POST https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prod_abc123def456",
    "amount": 9999,
    "recurring": {
      "interval": "month",
      "interval_count": 3
    }
  }'
```

```json Response theme={null}
{
  "id": "price_new123price456",
  "amount": 2999,
  "product_id": "prod_abc123def456",
  "active": true,
  "recurring": {
    "interval": "month",
    "interval_count": 1
  },
  "created_at": "2024-01-15T14:30:00Z",
  "updated_at": "2024-01-15T14:30:00Z"
}
```

### Validation errors

```json Amount is required theme={null}
{
  "errors": {
    "amount": ["can't be blank"]
  }
}
```

```json Amount must be non-negative theme={null}
{
  "errors": {
    "amount": ["must be greater than or equal to 0"]
  }
}
```

```json Interval is required for recurring prices theme={null}
{
  "errors": {
    "interval": ["is required for recurring prices. Valid options are: \"day\", \"week\", \"month\", or \"year\""]
  }
}
```

```json Interval count is required theme={null}
{
  "errors": {
    "interval_count": ["is required for recurring prices"]
  }
}
```

```json Interval count must be a positive integer theme={null}
{
  "errors": {
    "interval_count": ["must be greater than zero and only integer values are valid"]
  }
}
```

## Update price

```
PATCH /v1/prices/:id
```

Updates a price's active status. Only the `active` attribute can be modified after creation.

<ParamField path="id" type="string" required>
  The price's ID (e.g., `price_abc123def456`).
</ParamField>

<ParamField body="active" type="boolean">
  Whether the price is active. Set to `false` to deactivate.
</ParamField>

```bash theme={null}
curl -X PATCH https://api.gettrxn.com/v1/prices/price_abc123def456 \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "active": false
  }'
```

```json Response theme={null}
{
  "id": "price_abc123def456",
  "amount": 2999,
  "product_id": "prod_xyz789ghi012",
  "active": false,
  "recurring": {
    "interval": "month",
    "interval_count": 1
  },
  "created_at": "2024-01-01T12:00:00Z",
  "updated_at": "2024-01-15T16:45:00Z"
}
```

## Delete price

```
DELETE /v1/prices/:id
```

Deletes a price from your account.

<Warning>
  This action is irreversible and will also delete associated subscriptions and line items.
</Warning>

<ParamField path="id" type="string" required>
  The price's ID (e.g., `price_abc123def456`).
</ParamField>

```bash theme={null}
curl -X DELETE https://api.gettrxn.com/v1/prices/price_abc123def456 \
  -H "Authorization: Bearer $TRXN_TOKEN"
```

Returns `204 No Content` on successful deletion.

## Recurring billing intervals

Prices can be configured for recurring billing with flexible intervals:

| Configuration | interval | interval\_count |
| ------------- | -------- | --------------- |
| Daily         | `day`    | `1`             |
| Weekly        | `week`   | `1`             |
| Bi-weekly     | `week`   | `2`             |
| Monthly       | `month`  | `1`             |
| Quarterly     | `month`  | `3`             |
| Semi-annually | `month`  | `6`             |
| Yearly        | `year`   | `1`             |

## Recurring billing examples

```bash Weekly subscription ($9.99/week) theme={null}
curl -X POST https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prod_abc123def456",
    "amount": 999,
    "recurring": {
      "interval": "week",
      "interval_count": 1
    }
  }'
```

```bash Quarterly subscription ($49.99 every 3 months) theme={null}
curl -X POST https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prod_abc123def456",
    "amount": 4999,
    "recurring": {
      "interval": "month",
      "interval_count": 3
    }
  }'
```

```bash Annual subscription ($99.99/year) theme={null}
curl -X POST https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prod_abc123def456",
    "amount": 9999,
    "recurring": {
      "interval": "year",
      "interval_count": 1
    }
  }'
```

## Integration example

```bash theme={null}
# 1. Create a product
curl -X POST https://api.gettrxn.com/v1/products \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Premium Course"}'

# Response: {"id": "prod_abc123def456", "name": "Premium Course", ...}

# 2. Create a one-time price
curl -X POST https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prod_abc123def456",
    "amount": 19999
  }'

# Response: {"id": "price_onetime123", "amount": 19999, "recurring": null, ...}

# 3. Create a monthly subscription price
curl -X POST https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": "prod_abc123def456",
    "amount": 2999,
    "recurring": {
      "interval": "month",
      "interval_count": 1
    }
  }'

# Response: {"id": "price_monthly123", "amount": 2999, "recurring": {...}, ...}
```

## Sandbox support

<Note>
  The API respects sandbox scoping. If your API token is associated with a sandbox, you can only access prices for products created in that sandbox.
</Note>
