Prices
Prices define the unit cost, currency, and billing cycle (optional) for Product. Each price is associated with a product and a product can have multiple pricing options. A price supports either one-off or recurring purchases. For example, you can offer the following pricing options for a software license Product:
- Standard option: $10 / month
- Student discount option: $5 / month
- Lifetime option: $200 one-off purchase
Prices are primarily used in Invoice and Subscription APIs.
POST /api/v1/billing/prices/createGET /api/v1/billing/prices/{id}POST /api/v1/billing/prices/{id}/updateGET /api/v1/billing/prices
Create a price
POST /api/v1/billing/prices/create
Create a new Price object.
Currency of the price (in 3-letter ISO-4217 format).
Unique identifier of the Product object this price is associated with.
Unique request identifier specified by the merchant.
true if the price is available for new purchases, false otherwise. Defaults to true.
Price description.
The fixed amount to be charged. Required when the pricing model is flat.
A set of key-value pairs that you can attach to this object for storing additional information.
Price name.
Specify how to calculate the total billing amount when a quantity is provided. One of per_unit, volume, tiered, or flat. Defaults to per_unit.
The billing cycle for recurring charges.
Specifies billing frequency. One of DAY, WEEK, MONTH or YEAR.
The number of period units between subscription billing cycles. For example, the billing cycle is bi-monthly if period=2 and period_unit=MONTH. Defaults to 1.
List of quantity-based pricing tiers for this price. Required when the pricing model is volume or tiered.
The per-unit amount to be charged for this tier when the pricing model is volume or tiered.
The fixed amount to be charged for this tier when the pricing model is volume or tiered.
The upper quantity limit of this tier. This tier is applicable when the quantity does not exceed the upper bound of this tier, and is greater than the upper bound of the tier below it(or 0 if this is the first tier). For the last tier, the upper bound must be left empty.
The amount to be charged per product unit. Required when the pricing model is per_unit.
true if the price is available for new purchases, false otherwise.
Currency of the price (in 3-letter ISO-4217 format).
Price description.
The fixed amount to be charged. Applicable for flat pricing model only.
Unique identifier of the Price object.
A set of key-value pairs that you can attach to this object for storing additional information.
Price name.
Specify how to calculate the total billing amount when a quantity is provided.
flat: a fixed price.per_unit: a fixed price per unit quantity.volume: the unit price is taken based on which tier the total quantity falls in.tiered: the unit price changes as the quantity grows.
Unique identifier of the Product object this price is associated with.
The billing cycle for recurring charges. Exists when type=RECURRING.
The number of period units between subscription billing cycles. For example, the billing cycle is bi-monthly if period=2 and period_unit=MONTH.
Specifies billing frequency. One of DAY, WEEK, MONTH or YEAR.
Unique request identifier specified by the merchant in the last operation.
List of quantity-based pricing tiers for this price. Applicable for volume and tiered pricing models.
The per-unit amount to be charged for this tier when the pricing model is volume or tiered.
The fixed amount to be charged for this tier when the pricing model is volume or tiered.
The upper quantity limit of this tier. This tier is applicable when the quantity does not exceed the upper bound of this tier, and is greater than the upper bound of the tier below it(or 0 if this is the first tier). For the last tier, the upper bound must be left empty.
The type of the Price. Use ONE_OFF for one-off purchases and RECURRING for recurring purchases (subscriptions).
The amount to be charged per product unit. Applicable for per_unit pricing model only.
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$curl --request POST \> --url 'https://api-demo.airwallex.com/api/v1/billing/prices/create' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json' \> --data '{> "active": true,> "currency": "USD",> "description": "Standard option: $10 / month.",> "flat_amount": "null",> "metadata": {> "foo": "bar"> },> "name": "Standard option",> "pricing_model": "tiered",> "product_id": "prd_hkpd1x2gbgazzvcd42w",> "recurring": {> "period": 1,> "period_unit": "MONTH"> },> "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",> "tiers": [> {> "amount": 10,> "upper_bound": 20> },> {> "amount": 20> }> ],> "unit_amount": "null">}'
1{2 "active": true,3 "currency": "USD",4 "description": "Standard option: $10 / month.",5 "flat_amount": "null",6 "id": "pri_hkpd7fedfgb004apkvs",7 "metadata": {8 "foo": "bar"9 },10 "name": "Standard option",11 "pricing_model": "tiered",12 "product_id": "prd_hkpd1x2gbgazzvcd42w",13 "recurring": {14 "period": 1,15 "period_unit": "MONTH"16 },17 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",18 "tiers": [19 {20 "amount": 10,21 "upper_bound": 2022 },23 {24 "amount": 2025 }26 ],27 "type": "RECURRING",28 "unit_amount": "null"29}
Retrieve a price
GET /api/v1/billing/prices/{id}
Retrieves the details of a Price object by the unique identifier.
Unique identifier of the Price object.
true if the price is available for new purchases, false otherwise.
Currency of the price (in 3-letter ISO-4217 format).
Price description.
The fixed amount to be charged. Applicable for flat pricing model only.
Unique identifier of the Price object.
A set of key-value pairs that you can attach to this object for storing additional information.
Price name.
Specify how to calculate the total billing amount when a quantity is provided.
flat: a fixed price.per_unit: a fixed price per unit quantity.volume: the unit price is taken based on which tier the total quantity falls in.tiered: the unit price changes as the quantity grows.
Unique identifier of the Product object this price is associated with.
The billing cycle for recurring charges. Exists when type=RECURRING.
The number of period units between subscription billing cycles. For example, the billing cycle is bi-monthly if period=2 and period_unit=MONTH.
Specifies billing frequency. One of DAY, WEEK, MONTH or YEAR.
Unique request identifier specified by the merchant in the last operation.
List of quantity-based pricing tiers for this price. Applicable for volume and tiered pricing models.
The per-unit amount to be charged for this tier when the pricing model is volume or tiered.
The fixed amount to be charged for this tier when the pricing model is volume or tiered.
The upper quantity limit of this tier. This tier is applicable when the quantity does not exceed the upper bound of this tier, and is greater than the upper bound of the tier below it(or 0 if this is the first tier). For the last tier, the upper bound must be left empty.
The type of the Price. Use ONE_OFF for one-off purchases and RECURRING for recurring purchases (subscriptions).
The amount to be charged per product unit. Applicable for per_unit pricing model only.
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 404 | Not Found. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$curl --request GET \> --url 'https://api-demo.airwallex.com/api/v1/billing/prices/price_id' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json'
1{2 "active": true,3 "currency": "USD",4 "description": "Standard option: $10 / month.",5 "flat_amount": "null",6 "id": "pri_hkpd7fedfgb004apkvs",7 "metadata": {8 "foo": "bar"9 },10 "name": "Standard option",11 "pricing_model": "tiered",12 "product_id": "prd_hkpd1x2gbgazzvcd42w",13 "recurring": {14 "period": 1,15 "period_unit": "MONTH"16 },17 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",18 "tiers": [19 {20 "amount": 10,21 "upper_bound": 2022 },23 {24 "amount": 2025 }26 ],27 "type": "RECURRING",28 "unit_amount": "null"29}
Update a price
POST /api/v1/billing/prices/{id}/update
Updates the attributes of an existing Price by setting the values of the request parameters. Any parameters not provided will be left unchanged.
Unique identifier of the Price object.
Unique request identifier specified by the merchant.
true if the price is available for new purchases, false otherwise.
Price description.
A set of key-value pairs that you can attach to this object for storing additional information.
Price name.
true if the price is available for new purchases, false otherwise.
Currency of the price (in 3-letter ISO-4217 format).
Price description.
The fixed amount to be charged. Applicable for flat pricing model only.
Unique identifier of the Price object.
A set of key-value pairs that you can attach to this object for storing additional information.
Price name.
Specify how to calculate the total billing amount when a quantity is provided.
flat: a fixed price.per_unit: a fixed price per unit quantity.volume: the unit price is taken based on which tier the total quantity falls in.tiered: the unit price changes as the quantity grows.
Unique identifier of the Product object this price is associated with.
The billing cycle for recurring charges. Exists when type=RECURRING.
The number of period units between subscription billing cycles. For example, the billing cycle is bi-monthly if period=2 and period_unit=MONTH.
Specifies billing frequency. One of DAY, WEEK, MONTH or YEAR.
Unique request identifier specified by the merchant in the last operation.
List of quantity-based pricing tiers for this price. Applicable for volume and tiered pricing models.
The per-unit amount to be charged for this tier when the pricing model is volume or tiered.
The fixed amount to be charged for this tier when the pricing model is volume or tiered.
The upper quantity limit of this tier. This tier is applicable when the quantity does not exceed the upper bound of this tier, and is greater than the upper bound of the tier below it(or 0 if this is the first tier). For the last tier, the upper bound must be left empty.
The type of the Price. Use ONE_OFF for one-off purchases and RECURRING for recurring purchases (subscriptions).
The amount to be charged per product unit. Applicable for per_unit pricing model only.
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 404 | Not Found. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$curl --request POST \> --url 'https://api-demo.airwallex.com/api/v1/billing/prices/price_id/update' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json' \> --data '{> "active": true,> "description": "Standard option: $10 / month.",> "metadata": {> "foo": "bar"> },> "name": "Standard option",> "request_id": "ee939540-3203-4a2c-9172-89a566485dd9">}'
1{2 "active": true,3 "currency": "USD",4 "description": "Standard option: $10 / month.",5 "flat_amount": "null",6 "id": "pri_hkpd7fedfgb004apkvs",7 "metadata": {8 "foo": "bar"9 },10 "name": "Standard option",11 "pricing_model": "tiered",12 "product_id": "prd_hkpd1x2gbgazzvcd42w",13 "recurring": {14 "period": 1,15 "period_unit": "MONTH"16 },17 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",18 "tiers": [19 {20 "amount": 10,21 "upper_bound": 2022 },23 {24 "amount": 2025 }26 ],27 "type": "RECURRING",28 "unit_amount": "null"29}
Get list of prices
GET /api/v1/billing/prices
Retrieve a list of Prices based on the query parameters.
true if the price is available for new purchases, false otherwise.
The currency of Price (in 3-letter ISO-4217 format).
Page number starting from 0. Defaults to 0.
Number of Prices to be listed per page. Defaults to 20.
Unique identifier of the Product object this price is associated with.
The number of period units between subscription billing cycles. For example, the billing cycle is bi-monthly if period=2 and period_unit=MONTH.
Specifies billing frequency. Either DAY, WEEK, MONTH or YEAR.
A flag which identifies whether there are more results.
Paged results.
true if the price is available for new purchases, false otherwise.
Currency of the price (in 3-letter ISO-4217 format).
Price description.
The fixed amount to be charged. Applicable for flat pricing model only.
Unique identifier of the Price object.
A set of key-value pairs that you can attach to this object for storing additional information.
Price name.
Specify how to calculate the total billing amount when a quantity is provided.
flat: a fixed price.per_unit: a fixed price per unit quantity.volume: the unit price is taken based on which tier the total quantity falls in.tiered: the unit price changes as the quantity grows.
Unique identifier of the Product object this price is associated with.
The billing cycle for recurring charges. Exists when type=RECURRING.
The number of period units between subscription billing cycles. For example, the billing cycle is bi-monthly if period=2 and period_unit=MONTH.
Specifies billing frequency. One of DAY, WEEK, MONTH or YEAR.
Unique request identifier specified by the merchant in the last operation.
List of quantity-based pricing tiers for this price. Applicable for volume and tiered pricing models.
The per-unit amount to be charged for this tier when the pricing model is volume or tiered.
The fixed amount to be charged for this tier when the pricing model is volume or tiered.
The upper quantity limit of this tier. This tier is applicable when the quantity does not exceed the upper bound of this tier, and is greater than the upper bound of the tier below it(or 0 if this is the first tier). For the last tier, the upper bound must be left empty.
The type of the Price. Use ONE_OFF for one-off purchases and RECURRING for recurring purchases (subscriptions).
The amount to be charged per product unit. Applicable for per_unit pricing model only.
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$curl --request GET \> --url 'https://api-demo.airwallex.com/api/v1/billing/prices' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json'
1{2 "has_more": true,3 "items": [4 {5 "active": true,6 "currency": "USD",7 "description": "Standard option: $10 / month.",8 "flat_amount": "null",9 "id": "pri_hkpd7fedfgb004apkvs",10 "metadata": {11 "foo": "bar"12 },13 "name": "Standard option",14 "pricing_model": "tiered",15 "product_id": "prd_hkpd1x2gbgazzvcd42w",16 "recurring": {17 "period": 1,18 "period_unit": "MONTH"19 },20 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",21 "tiers": [22 {23 "amount": 10,24 "upper_bound": 2025 },26 {27 "amount": 2028 }29 ],30 "type": "RECURRING",31 "unit_amount": "null"32 }33 ]34}