Subscriptions
A Subscription is a customer's recurring purchase record. Airwallex automatically charges the customers on every billing cycle with the provided PaymentConsent until the subscription is cancelled.
A subscription with a free trial moves from IN_TRIAL status to ACTIVE when the trial period ends. Airwallex automatically charges your customer at the start of each subscription billing cycle. The subscription status is UNPAID when a payment fails. In this case, Airwallex will retry payment several times depending on the dunning policy. The default dunning policy is to retry at most 4 times (after 1 day, 2 days, 5 days and 7 days). The subscription moves to ACTIVE if any payment retry attempt has succeeded or CANCELLED after all retries have failed. A subscription moves to CANCELLED if it has ended or been cancelled.
POST /api/v1/billing/subscriptions/createGET /api/v1/billing/subscriptions/{id}POST /api/v1/billing/subscriptions/{id}/updatePOST /api/v1/billing/subscriptions/{id}/cancelGET /api/v1/billing/subscriptionsGET /api/v1/billing/subscriptions/{id}/items/{item_id}GET /api/v1/billing/subscriptions/{id}/items
Create a subscription
POST /api/v1/billing/subscriptions/create
Create a new Subscription on an existing Customer to charge the customer on a recurring basis. Before creating a Subscription, you must create a Payment Consent that represents the consent between you and the customer on the future use of the saved payments details.
Unique identifier of the customer who subscribes to this subscription.
List of SubscriptionItems.
Unique identifier of the Price subscribed by the customer. The Price's recurring values must match the recurring values set out in this subscription.
A set of key-value pairs that you can attach to this object for storing additional information.
The product quantity. Defaults to 1.
Unique identifier of the PaymentConsent to pay for the subscription at each billing period.
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.
Unique request identifier specified by the merchant.
A set of key-value pairs that you can attach to this object for storing additional information.
The total number of billing cycles of the subscription. For example, the subscription will last for 1 year if total_billing_cycles=12, period=1 and period_unit=MONTH. The subscription will continue indefinitely if total_billing_cycles is null.
The end time of the trial if applicable.
Time when the subscription is scheduled to be cancelled.
true if the subscription is scheduled to be cancelled at the end of the current billing period, false otherwise.
Time when the cancellation request was received.
Time when the subscription was created.
The end time of the current period that the subscription has been invoiced for.
The start time of the current period that the subscription has been invoiced for.
Unique identifier of the customer who subscribes to this subscription.
Unique identifier of the Subscription object.
The unique identifier of the latest invoice generated for this subscription.
A set of key-value pairs that you can attach to this object for storing additional information.
Time of the next billing date.
Unique identifier of the PaymentConsent to pay for the subscription at each billing period.
The billing cycle for recurring charges.
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.
The remaining billing cycles of the subscription.
Unique request identifier specified by the merchant in the last operation.
Status of the subscription, one of IN_TRIAL, ACTIVE, UNPAID or CANCELLED.
The total number of billing cycles of the subscription. For example, the subscription will last for 1 year if total_billing_cycles=12, period=1 and period_unit=MONTH. The subscription will continue indefinitely if total_billing_cycles is null.
The end time of the trial if applicable.
The start time of the trial period if applicable.
Time when the subscription was last updated.
| 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/subscriptions/create' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json' \> --data '{> "customer_id": "cus_ps8e0ZgQzd2QnCxVpzJrHD6KOVu",> "items": [> {> "metadata": {> "foo": "bar"> },> "price_id": "pri_hkpd7fedfgb004apkvs",> "quantity": 2> }> ],> "metadata": {> "foo": "bar"> },> "payment_consent_id": "cst_u79lnfufjxxfdc0",> "recurring": {> "period": 1,> "period_unit": "MONTH"> },> "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",> "total_billing_cycles": 12,> "trial_end_at": "2022-01-05T10:15:30+0000">}'
1{2 "cancel_at": "null",3 "cancel_at_period_end": false,4 "cancel_requested_at": "null",5 "created_at": "2022-01-01T10:15:30+0000",6 "current_period_end_at": "2022-02-05T10:15:30+0000",7 "current_period_start_at": "2022-01-05T10:15:30+0000",8 "customer_id": "cus_ps8e0ZgQzd2QnCxVpzJrHD6KOVu",9 "id": "sub_hkpdkcmxdgazzq53jbk",10 "latest_invoice_id": "inv_hkpdmiq8hgb00f8cpdl",11 "metadata": {12 "foo": "bar"13 },14 "next_billing_at": "2022-02-05T10:15:30+0000",15 "payment_consent_id": "cst_u79lnfufjxxfdc0",16 "recurring": {17 "period": 1,18 "period_unit": "MONTH"19 },20 "remaining_billing_cycles": 12,21 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",22 "status": "ACTIVE",23 "total_billing_cycles": 12,24 "trial_end_at": "2022-01-05T10:15:30+0000",25 "trial_start_at": "2022-01-01T10:15:30+0000",26 "updated_at": "2022-01-01T10:15:30+0000"27}
Retrieve a subscription
GET /api/v1/billing/subscriptions/{id}
Retrieves the details of a Subscription using the given Subscription unique identifier.
Unique identifier of the Subscription object.
Time when the subscription is scheduled to be cancelled.
true if the subscription is scheduled to be cancelled at the end of the current billing period, false otherwise.
Time when the cancellation request was received.
Time when the subscription was created.
The end time of the current period that the subscription has been invoiced for.
The start time of the current period that the subscription has been invoiced for.
Unique identifier of the customer who subscribes to this subscription.
Unique identifier of the Subscription object.
The unique identifier of the latest invoice generated for this subscription.
A set of key-value pairs that you can attach to this object for storing additional information.
Time of the next billing date.
Unique identifier of the PaymentConsent to pay for the subscription at each billing period.
The billing cycle for recurring charges.
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.
The remaining billing cycles of the subscription.
Unique request identifier specified by the merchant in the last operation.
Status of the subscription, one of IN_TRIAL, ACTIVE, UNPAID or CANCELLED.
The total number of billing cycles of the subscription. For example, the subscription will last for 1 year if total_billing_cycles=12, period=1 and period_unit=MONTH. The subscription will continue indefinitely if total_billing_cycles is null.
The end time of the trial if applicable.
The start time of the trial period if applicable.
Time when the subscription was last updated.
| 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/subscriptions/subscription_id' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json'
1{2 "cancel_at": "null",3 "cancel_at_period_end": false,4 "cancel_requested_at": "null",5 "created_at": "2022-01-01T10:15:30+0000",6 "current_period_end_at": "2022-02-05T10:15:30+0000",7 "current_period_start_at": "2022-01-05T10:15:30+0000",8 "customer_id": "cus_ps8e0ZgQzd2QnCxVpzJrHD6KOVu",9 "id": "sub_hkpdkcmxdgazzq53jbk",10 "latest_invoice_id": "inv_hkpdmiq8hgb00f8cpdl",11 "metadata": {12 "foo": "bar"13 },14 "next_billing_at": "2022-02-05T10:15:30+0000",15 "payment_consent_id": "cst_u79lnfufjxxfdc0",16 "recurring": {17 "period": 1,18 "period_unit": "MONTH"19 },20 "remaining_billing_cycles": 12,21 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",22 "status": "ACTIVE",23 "total_billing_cycles": 12,24 "trial_end_at": "2022-01-05T10:15:30+0000",25 "trial_start_at": "2022-01-01T10:15:30+0000",26 "updated_at": "2022-01-01T10:15:30+0000"27}
Update a subscription
POST /api/v1/billing/subscriptions/{id}/update
Update an existing Subscription.
Unique identifier of the Subscription object.
Unique request identifier specified by the merchant.
Specifies how to handle billing when updating the subscription. One of
DEFER_CHARGE_AND_KEEP_CYCLE: Prorated in-advance fees are applied to the next upcoming invoice. In-arrears fees are still billed on its original billing date. Keep the current billing cycle anchor unchanged.IMMEDIATE_CHARGE_AND_KEEP_CYCLE: A one-time adjustment invoice is generated and attempted for payment upon the subscription update. Keep the current billing cycle anchor unchanged.IMMEDIATE_CHARGE_AND_RESET_CYCLE: Resets the subscription'sbilling_cycle_anchor_atto the time of update request. After you reset the billing cycle anchor, the subscription immediately sends an invoice for prorations. The upcoming billing cycles will be aligned on the new billing cycle anchor.
Defaults to DEFER_CHARGE_AND_KEEP_CYCLE.
true if the subscription is scheduled to be cancelled at the end of the current period, false otherwise.
By default, how to handle credit and fee prorations for all Subscription Item changes. One of
ALL: credits the full remaining creditable amount of the old items for the current billing cycle, and charges the full amount of the new items for the current billing cycle.PRORATED: calculates and applies the proration on both credit and fee for the Subscription's unused time.NONE: does not issue any credit for the Subscription's unused time, only charges the new fee from the next billing cycle.
Defaults to PRORATED.
List of Subscription Items to be added, updated, or deleted. It may trigger credit and proration when the subscription status is ACTIVE. If an existing item is not included in the list, it remains unchanged. You may add 100 items at a time.
If set to true, will delete the specified subscription item.
List of discounts to be applied to the Subscription Item. Discounts of subscription items are applied before subscription discounts. Currently, only one element is supported.
Unique identifier of the Subscription Item to be updated or be deleted. If not provided, a new Subscription Item will be added.
A set of string key-value pairs that you can attach to this object for storing additional information.
Unique identifier of the Price. Required when adding a new item. You can't update the price_id of the existing item.
Specifies how to handle credit and fee prorations for the Subscription Item. This field overrides the default_proration_mode provided in the update request. One of
ALL: credits the full remaining creditable amount of the old items for the current billing cycle, and charges the full amount of the new items for the current billing cycle.PRORATED: calculates and applies the proration on both credit and fee for the Subscription's unused time.NONE: does not issue any credit for the Subscription's unused time, only charges the new fee from the next billing cycle.
Defaults to PRORATED.
The quantity of the product.
A set of key-value pairs that you can attach to this object for storing additional information.
Unique identifier of the PaymentConsent to pay for the subscription at each billing period.
The total number of billing cycles of the subscription. The subscription will continue indefinitely if total_billing_cycles is null. It only can be updated when status is IN_TRIAL, ACTIVE or UNPAID.
The end time of the trial if applicable. Use NOW to end the trial immediately.
Time when the subscription is scheduled to be cancelled.
true if the subscription is scheduled to be cancelled at the end of the current billing period, false otherwise.
Time when the cancellation request was received.
Time when the subscription was created.
The end time of the current period that the subscription has been invoiced for.
The start time of the current period that the subscription has been invoiced for.
Unique identifier of the customer who subscribes to this subscription.
Unique identifier of the Subscription object.
The unique identifier of the latest invoice generated for this subscription.
A set of key-value pairs that you can attach to this object for storing additional information.
Time of the next billing date.
Unique identifier of the PaymentConsent to pay for the subscription at each billing period.
The billing cycle for recurring charges.
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.
The remaining billing cycles of the subscription.
Unique request identifier specified by the merchant in the last operation.
Status of the subscription, one of IN_TRIAL, ACTIVE, UNPAID or CANCELLED.
The total number of billing cycles of the subscription. For example, the subscription will last for 1 year if total_billing_cycles=12, period=1 and period_unit=MONTH. The subscription will continue indefinitely if total_billing_cycles is null.
The end time of the trial if applicable.
The start time of the trial period if applicable.
Time when the subscription was last updated.
| 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/subscriptions/subscription_id/update' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json' \> --data '{> "cancel_at_period_end": false,> "metadata": {> "foo": "bar"> },> "payment_consent_id": "cst_u79lnfufjxxfdc0",> "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",> "total_billing_cycles": 12,> "trial_end_at": "2022-05-20T13:14:00+0000",> "items": [> {> "id": "sit_hkpdwesy9gazzrtqbkg",> "price_id": "pri_hkpd7fedfgb004apkvs",> "quantity": 2,> "metadata": {> "foo": "bar"> },> "discounts": [],> "deleted": false,> "proration_mode": "PRORATED"> }> ],> "billing_action": "DEFER_CHARGE_AND_KEEP_CYCLE",> "default_proration_mode": "PRORATED">}'
1{2 "cancel_at": "null",3 "cancel_at_period_end": false,4 "cancel_requested_at": "null",5 "created_at": "2022-01-01T10:15:30+0000",6 "current_period_end_at": "2022-02-05T10:15:30+0000",7 "current_period_start_at": "2022-01-05T10:15:30+0000",8 "customer_id": "cus_ps8e0ZgQzd2QnCxVpzJrHD6KOVu",9 "id": "sub_hkpdkcmxdgazzq53jbk",10 "latest_invoice_id": "inv_hkpdmiq8hgb00f8cpdl",11 "metadata": {12 "foo": "bar"13 },14 "next_billing_at": "2022-02-05T10:15:30+0000",15 "payment_consent_id": "cst_u79lnfufjxxfdc0",16 "recurring": {17 "period": 1,18 "period_unit": "MONTH"19 },20 "remaining_billing_cycles": 12,21 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",22 "status": "ACTIVE",23 "total_billing_cycles": 12,24 "trial_end_at": "2022-01-05T10:15:30+0000",25 "trial_start_at": "2022-01-01T10:15:30+0000",26 "updated_at": "2022-01-01T10:15:30+0000"27}
Cancel a subscription
POST /api/v1/billing/subscriptions/{id}/cancel
Cancels a customer's Subscription immediately, and provides a refund for any pending prorations.
Unique identifier of the Subscription object.
Determines how to handle prorations when canceling the Subscription. One of ALL, PRORATED, NONE.
Passing ALL will refund the charge of the current period.
Passing PRORATED will refund the proration.
Passing NONE won't refund for the Subscription's unused time.
Unique request identifier specified by the merchant.
Time when the subscription is scheduled to be cancelled.
true if the subscription is scheduled to be cancelled at the end of the current billing period, false otherwise.
Time when the cancellation request was received.
Time when the subscription was created.
The end time of the current period that the subscription has been invoiced for.
The start time of the current period that the subscription has been invoiced for.
Unique identifier of the customer who subscribes to this subscription.
Unique identifier of the Subscription object.
The unique identifier of the latest invoice generated for this subscription.
A set of key-value pairs that you can attach to this object for storing additional information.
Time of the next billing date.
Unique identifier of the PaymentConsent to pay for the subscription at each billing period.
The billing cycle for recurring charges.
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.
The remaining billing cycles of the subscription.
Unique request identifier specified by the merchant in the last operation.
Status of the subscription, one of IN_TRIAL, ACTIVE, UNPAID or CANCELLED.
The total number of billing cycles of the subscription. For example, the subscription will last for 1 year if total_billing_cycles=12, period=1 and period_unit=MONTH. The subscription will continue indefinitely if total_billing_cycles is null.
The end time of the trial if applicable.
The start time of the trial period if applicable.
Time when the subscription was last updated.
| 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/subscriptions/subscription_id/cancel' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json' \> --data '{> "proration_behavior": "NONE",> "request_id": "ee939540-3203-4a2c-9172-89a566485dd9">}'
1{2 "cancel_at": "null",3 "cancel_at_period_end": false,4 "cancel_requested_at": "null",5 "created_at": "2022-01-01T10:15:30+0000",6 "current_period_end_at": "2022-02-05T10:15:30+0000",7 "current_period_start_at": "2022-01-05T10:15:30+0000",8 "customer_id": "cus_ps8e0ZgQzd2QnCxVpzJrHD6KOVu",9 "id": "sub_hkpdkcmxdgazzq53jbk",10 "latest_invoice_id": "inv_hkpdmiq8hgb00f8cpdl",11 "metadata": {12 "foo": "bar"13 },14 "next_billing_at": "2022-02-05T10:15:30+0000",15 "payment_consent_id": "cst_u79lnfufjxxfdc0",16 "recurring": {17 "period": 1,18 "period_unit": "MONTH"19 },20 "remaining_billing_cycles": 12,21 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",22 "status": "ACTIVE",23 "total_billing_cycles": 12,24 "trial_end_at": "2022-01-05T10:15:30+0000",25 "trial_start_at": "2022-01-01T10:15:30+0000",26 "updated_at": "2022-01-01T10:15:30+0000"27}
Get list of subscriptions
GET /api/v1/billing/subscriptions
Retrieves a list of Subscriptions based on the query parameters.
Unique identifier of the customer who subscribes to this subscription.
The start date of created_at in ISO8601 format (inclusive).
Page number starting from 0. Defaults to 0.
Number of Subscriptions per page. Defaults to 20.
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.
Status of the subscription, one of IN_TRIAL, ACTIVE, UNPAID or CANCELLED.
The end date of created_at in ISO8601 format (exclusive).
A flag which identifies whether there are more results.
Paged results.
Time when the subscription is scheduled to be cancelled.
true if the subscription is scheduled to be cancelled at the end of the current billing period, false otherwise.
Time when the cancellation request was received.
Time when the subscription was created.
The end time of the current period that the subscription has been invoiced for.
The start time of the current period that the subscription has been invoiced for.
Unique identifier of the customer who subscribes to this subscription.
Unique identifier of the Subscription object.
The unique identifier of the latest invoice generated for this subscription.
A set of key-value pairs that you can attach to this object for storing additional information.
Time of the next billing date.
Unique identifier of the PaymentConsent to pay for the subscription at each billing period.
The billing cycle for recurring charges.
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.
The remaining billing cycles of the subscription.
Unique request identifier specified by the merchant in the last operation.
Status of the subscription, one of IN_TRIAL, ACTIVE, UNPAID or CANCELLED.
The total number of billing cycles of the subscription. For example, the subscription will last for 1 year if total_billing_cycles=12, period=1 and period_unit=MONTH. The subscription will continue indefinitely if total_billing_cycles is null.
The end time of the trial if applicable.
The start time of the trial period if applicable.
Time when the subscription was last updated.
| 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/subscriptions' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json'
1{2 "has_more": false,3 "items": [4 {5 "cancel_at": "null",6 "cancel_at_period_end": false,7 "cancel_requested_at": "null",8 "created_at": "2022-01-01T10:15:30+0000",9 "current_period_end_at": "2022-02-05T10:15:30+0000",10 "current_period_start_at": "2022-01-05T10:15:30+0000",11 "customer_id": "cus_ps8e0ZgQzd2QnCxVpzJrHD6KOVu",12 "id": "sub_hkpdkcmxdgazzq53jbk",13 "latest_invoice_id": "inv_hkpdmiq8hgb00f8cpdl",14 "metadata": {15 "foo": "bar"16 },17 "next_billing_at": "2022-02-05T10:15:30+0000",18 "payment_consent_id": "cst_u79lnfufjxxfdc0",19 "recurring": {20 "period": 1,21 "period_unit": "MONTH"22 },23 "remaining_billing_cycles": 12,24 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",25 "status": "ACTIVE",26 "total_billing_cycles": 12,27 "trial_end_at": "2022-01-05T10:15:30+0000",28 "trial_start_at": "2022-01-01T10:15:30+0000",29 "updated_at": "2022-01-01T10:15:30+0000"30 }31 ]32}
Retrieve a SubscriptionItem
GET /api/v1/billing/subscriptions/{id}/items/{item_id}
Retrieves the details of a SubscriptionItem.
Unique identifier of the Subscription object that this subscription item belongs to.
Unique identifier of the SubscriptionItem object.
Unique identifier of the SubscriptionItem object.
A set of key-value pairs that you can attach to this object for storing additional information.
The price on a subscription item.
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.
The product quantity.
Unique identifier of the Subscription object that this subscription item belongs to.
| 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/subscriptions/subscription_id/items/item_id' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json'
1{2 "id": "sit_hkpdwesy9gazzrtqbkg",3 "metadata": {4 "foo": "bar"5 },6 "price": {7 "active": true,8 "currency": "USD",9 "description": "Standard option: $10 / month.",10 "flat_amount": "null",11 "id": "pri_hkpd7fedfgb004apkvs",12 "metadata": {13 "foo": "bar"14 },15 "name": "Standard option",16 "pricing_model": "tiered",17 "product_id": "prd_hkpd1x2gbgazzvcd42w",18 "recurring": {19 "period": 1,20 "period_unit": "MONTH"21 },22 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",23 "tiers": [24 {25 "amount": 10,26 "upper_bound": 2027 },28 {29 "amount": 2030 }31 ],32 "type": "RECURRING",33 "unit_amount": "null"34 },35 "quantity": 2,36 "subscription_id": "sub_hkpdkcmxdgazzq53jbk"37}
Get list of SubscriptionItems
GET /api/v1/billing/subscriptions/{id}/items
Retrieves a list of SubscriptionItems based on the query parameters.
Unique identifier of the Subscription object that the subscription items belong to.
Page number starting from 0. Defaults to 0.
Number of SubscriptionItems per page. Defaults to 20.
A flag which identifies whether there are more results.
Paged results.
Unique identifier of the SubscriptionItem object.
A set of key-value pairs that you can attach to this object for storing additional information.
The price on a subscription item.
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.
The product quantity.
Unique identifier of the Subscription object that this subscription item belongs to.
| 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/subscriptions/subscription_id/items' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json'
1{2 "has_more": false,3 "items": [4 {5 "id": "sit_hkpdwesy9gazzrtqbkg",6 "metadata": {7 "foo": "bar"8 },9 "price": {10 "active": true,11 "currency": "USD",12 "description": "Standard option: $10 / month.",13 "flat_amount": "null",14 "id": "pri_hkpd7fedfgb004apkvs",15 "metadata": {16 "foo": "bar"17 },18 "name": "Standard option",19 "pricing_model": "tiered",20 "product_id": "prd_hkpd1x2gbgazzvcd42w",21 "recurring": {22 "period": 1,23 "period_unit": "MONTH"24 },25 "request_id": "ee939540-3203-4a2c-9172-89a566485dd9",26 "tiers": [27 {28 "amount": 10,29 "upper_bound": 2030 },31 {32 "amount": 2033 }34 ],35 "type": "RECURRING",36 "unit_amount": "null"37 },38 "quantity": 2,39 "subscription_id": "sub_hkpdkcmxdgazzq53jbk"40 }41 ]42}