Skip to main content
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

id
string
Unique identifier with price_ prefix (e.g., price_abc123def456).
amount
integer
The price amount in cents (e.g., 2999 for $29.99).
product_id
string
The associated product’s ID.
active
boolean
Whether the price is active. Defaults to true on creation.
recurring
object
Recurring billing configuration. null for one-time prices.
created_at
string
When the price was created (ISO 8601).
updated_at
string
When the price was last updated (ISO 8601).

One-time price example

{
  "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

{
  "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.
page
integer
default:"1"
Page number for pagination. Results are returned 25 items per page.
curl https://api.gettrxn.com/v1/prices \
  -H "Authorization: Bearer $TRXN_TOKEN"
Response
{
  "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.
id
string
required
The price’s ID (e.g., price_abc123def456).
curl https://api.gettrxn.com/v1/prices/price_abc123def456 \
  -H "Authorization: Bearer $TRXN_TOKEN"
Response (recurring)
{
  "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"
}
Response (one-time)
{
  "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.
product_id
string
required
The product’s ID (e.g., prod_abc123def456). Must belong to your account.
amount
integer
required
The price amount in cents (e.g., 2999 for $29.99). Must be 0 or greater.
recurring
object
Object containing recurring billing configuration. Omit for one-time prices.

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": 4999
  }'

Create a monthly recurring 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
    }
  }'

Create a quarterly recurring 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": 9999,
    "recurring": {
      "interval": "month",
      "interval_count": 3
    }
  }'
Response
{
  "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

Amount is required
{
  "errors": {
    "amount": ["can't be blank"]
  }
}
Amount must be non-negative
{
  "errors": {
    "amount": ["must be greater than or equal to 0"]
  }
}
Interval is required for recurring prices
{
  "errors": {
    "interval": ["is required for recurring prices. Valid options are: \"day\", \"week\", \"month\", or \"year\""]
  }
}
Interval count is required
{
  "errors": {
    "interval_count": ["is required for recurring prices"]
  }
}
Interval count must be a positive integer
{
  "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.
id
string
required
The price’s ID (e.g., price_abc123def456).
active
boolean
Whether the price is active. Set to false to deactivate.
curl -X PATCH https://api.gettrxn.com/v1/prices/price_abc123def456 \
  -H "Authorization: Bearer $TRXN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "active": false
  }'
Response
{
  "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.
This action is irreversible and will also delete associated subscriptions and line items.
id
string
required
The price’s ID (e.g., price_abc123def456).
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:
Configurationintervalinterval_count
Dailyday1
Weeklyweek1
Bi-weeklyweek2
Monthlymonth1
Quarterlymonth3
Semi-annuallymonth6
Yearlyyear1

Recurring billing examples

Weekly subscription ($9.99/week)
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
    }
  }'
Quarterly subscription ($49.99 every 3 months)
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
    }
  }'
Annual subscription ($99.99/year)
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

# 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

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.