### List Products Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/products/list-products This example demonstrates how to list products using a GET request. You can filter products by various attributes and control the pagination of the results. ```APIDOC ## GET /products.json ### Description Retrieves a list of products. Supports filtering by IDs, inclusion of archived products, and pagination. ### Method GET ### Endpoint /products.json ### Query Parameters - **date_field** (string) - Optional - Specifies the date field to use for sorting or filtering (e.g., `updated_at`). - **filter[ids]** (string) - Optional - A comma-separated list of product IDs to filter by. - **page** (integer) - Optional - The page number for pagination. Defaults to 1. - **per_page** (integer) - Optional - The number of results per page. Defaults to 50. - **include_archived** (boolean) - Optional - Whether to include archived products in the results. - **include** (string) - Optional - Specifies related data to include in the response (e.g., `prepaid_product_price_point`). ### Request Example ```bash curl -X GET -G \ --url 'https://subdomain.chargify.com/products.json' \ -H 'Accept: application/json' \ -d 'date_field=updated_at' \ -d 'filter[ids]=1%2C2%2C3' \ -d 'page=1' \ -d 'per_page=50' \ -d 'include_archived=true' \ -d 'include=prepaid_product_price_point' ``` ### Response #### Success Response (200) Returns an array of Product Response objects. - **product** (object) - Contains product details. - **id** (integer) - The product's unique identifier. - **name** (string) - The name of the product. - **handle** (string) - A URL-friendly identifier for the product. - **description** (string) - A description of the product. - **accounting_code** (string) - An accounting code for the product. - **request_credit_card** (boolean) - Whether a credit card is required for signup. - **expiration_interval** (integer) - The interval for expiration. - **expiration_interval_unit** (string) - The unit for the expiration interval (e.g., `month`). - **created_at** (datetime) - The timestamp when the product was created. - **updated_at** (datetime) - The timestamp when the product was last updated. - **price_in_cents** (integer) - The base price of the product in cents. - **interval** (integer) - The billing interval for the product. - **interval_unit** (string) - The unit for the billing interval (e.g., `month`). - **initial_charge_in_cents** (integer) - The initial charge amount in cents. - **trial_price_in_cents** (integer) - The price in cents during the trial period. - **trial_interval** (integer) - The duration of the trial period. - **trial_interval_unit** (string) - The unit for the trial interval (e.g., `month`). - **archived_at** (datetime) - The timestamp when the product was archived, or null if not archived. - **require_credit_card** (boolean) - Alias for `request_credit_card`. - **return_params** (string) - Parameters to be returned upon signup. - **taxable** (boolean) - Whether the product is taxable. - **update_return_url** (string) - The URL to redirect to after updating. - **initial_charge_after_trial** (boolean) - Whether an initial charge occurs after the trial. - **version_number** (integer) - The version number of the product. - **update_return_params** (string) - Parameters to be returned after updating. - **product_family** (object) - Details about the product family. - **id** (integer) - The product family's unique identifier. - **name** (string) - The name of the product family. - **handle** (string) - A URL-friendly identifier for the product family. - **accounting_code** (string) - An accounting code for the product family. - **description** (string) - A description of the product family. - **created_at** (datetime) - The timestamp when the product family was created. - **updated_at** (datetime) - The timestamp when the product family was last updated. - **public_signup_pages** (array) - A list of public signup pages associated with the product. - **id** (integer) - The signup page's unique identifier. - **return_url** (string) - The URL to redirect to after signup. - **return_params** (string) - Parameters to be returned upon signup. - **url** (string) - The URL of the public signup page. - **product_price_point_name** (string) - The name of the default product price point. - **request_billing_address** (boolean) - Whether a billing address is required. - **require_billing_address** (boolean) - Alias for `request_billing_address`. - **require_shipping_address** (boolean) - Whether a shipping address is required. - **use_site_exchange_rate** (boolean) - Whether to use the site's exchange rate. - **tax_code** (string) - The tax code for the product. - **default_product_price_point_id** (integer) - The ID of the default product price point. #### Response Example ```json [ { "product": { "id": 0, "name": "string", "handle": "string", "description": "string", "accounting_code": "string", "request_credit_card": true, "expiration_interval": 0, "expiration_interval_unit": "month", "created_at": "2023-11-23T10:28:34-05:00", "updated_at": "2023-11-23T10:28:34-05:00", "price_in_cents": 0, "interval": 0, "interval_unit": "month", "initial_charge_in_cents": 0, "trial_price_in_cents": 0, "trial_interval": 0, "trial_interval_unit": "month", "archived_at": null, "require_credit_card": true, "return_params": "string", "taxable": true, "update_return_url": "string", "initial_charge_after_trial": true, "version_number": 0, "update_return_params": "string", "product_family": { "id": 0, "name": "string", "handle": "string", "accounting_code": null, "description": "string", "created_at": "2021-05-05T16:00:21-04:00", "updated_at": "2021-05-05T16:00:21-04:00" }, "public_signup_pages": [ { "id": 0, "return_url": "string", "return_params": "string", "url": "string" } ], "product_price_point_name": "string", "request_billing_address": true, "require_billing_address": true, "require_shipping_address": true, "use_site_exchange_rate": true, "tax_code": "string", "default_product_price_point_id": 0 } } ] ``` ``` -------------------------------- ### List Coupons Request Example Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/coupons/list-coupons This example demonstrates how to list coupons using a GET request with various query parameters for filtering and pagination. Ensure to set the appropriate Accept header. ```curl curl -X GET -G \ --url 'https://subdomain.chargify.com/coupons.json' \ -H 'Accept: application/json' \ -d 'page=1' \ -d 'per_page=50' \ -d 'filter[start_date]=2011-12-17' \ -d 'filter[end_date]=2011-12-15' \ -d 'filter[start_datetime]=2011-12-19T10%3A15%3A30%2B01%3A00' \ -d 'filter[end_datetime]=2019-06-07T17%3A20%3A06Z' \ -d 'filter[ids]=1%2C2%2C3' \ -d 'filter[codes]=free%2Cfree_trial' \ -d 'currency_prices=true' ``` -------------------------------- ### List Metafields Request Example Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/custom-fields/list-metafields This example demonstrates how to list metafields for a resource type using a GET request. It includes query parameters for pagination and filtering. ```curl curl -X GET -G \ --url 'https://subdomain.chargify.com/subscriptions/metafields.json' \ -H 'Accept: application/json' \ -d 'page=1' \ -d 'per_page=50' ``` -------------------------------- ### Allocate Components Request Example Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/subscription-components/allocate-components This example demonstrates how to make a POST request to the /subscriptions/{subscription_id}/allocations.json endpoint to allocate components. It includes setting proration schemes and defining allocations with component IDs, quantities, and memos. ```curl curl -X POST \ --url 'https://subdomain.chargify.com/subscriptions/222/allocations.json' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ --data-raw '{ "proration_upgrade_scheme": "prorate-attempt-capture", "proration_downgrade_scheme": "no-prorate", "allocations": [ { "component_id": 123, "quantity": 10, "memo": "foo" }, { "component_id": 456, "quantity": 5, "memo": "bar" } ] }' ``` -------------------------------- ### Example JSON Response for Get Site Source: https://developers.maxio.com/http/development-tools/using-the-developer-portal This is an example of the JSON response you can expect when making a successful GET Site request. It includes details about your sandbox environment. ```json { "site": { "id": 00000, "name": "test-b2b-site", "subdomain": "test-acme-clone", "currency": "USD", "seller_id": 00000, "non_primary_currencies": ["BRL"], "relationship_invoicing_enabled": true, "customer_hierarchy_enabled": false, "whopays_enabled": false, "whopays_default_payer": "self-ungrouped", "default_payment_collection_method": "automatic", "organization_address": { "street": null, "line2": null, "city": null, "state": null, "zip": null, "country": null, "name": "Your Org Name", "phone": null, }, "tax_configuration": { "kind": "custom", "fully_configured": true, "destination_address": "shipping_then_billing", }, "net_terms": { "default_net_terms": 0, "automatic_net_terms": 0, "remittance_net_terms": 0, "net_terms_on_remittance_signups_enabled": false, "custom_net_terms_enabled": false, }, "test": true, }, } ``` -------------------------------- ### Create Customer Request Example Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/customers/create-customer Use this example to create a new customer. Ensure all required fields like `first_name`, `last_name`, and `email` are provided. The `reference` field must be unique if used. ```curl curl -X POST \ --url 'https://subdomain.chargify.com/customers.json' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ --data-raw '{ "customer": { "first_name": "Martha", "last_name": "Washington", "email": "martha@example.com", "cc_emails": "george@example.com", "organization": "ABC, Inc.", "reference": "1234567890", "address": "123 Main Street", "address_2": "Unit 10", "city": "Anytown", "state": "MA", "zip": "02120", "country": "US", "phone": "555-555-1212", "locale": "es-MX" } }' ``` -------------------------------- ### Get Site Request Source: https://developers.maxio.com/http/development-tools/using-the-developer-portal This example demonstrates how to make a GET request to retrieve site information using cURL. Remember to replace placeholders with your actual subdomain and API key. ```APIDOC ## GET /site.json ### Description Retrieves information about the Maxio Advanced Billing site. ### Method GET ### Endpoint `https://"your-maxio-ab-subdomain".chargify.com/site.json` ### Parameters #### Query Parameters None #### Headers - **Accept**: `application/json` #### Authentication - **Basic Auth**: Username: `"your-api-key"`, Password: `x` ### Request Example ```bash curl -X GET \ --url 'https://"your-maxio-ab-subdomain".chargify.com/site.json' \ -H 'Accept: application/json' \ -u '"your-api-key":x' ``` ### Response #### Success Response (200) - **site** (object) - Contains site details. - **id** (integer) - The unique identifier for the site. - **name** (string) - The name of the site. - **subdomain** (string) - The subdomain of the site. - **currency** (string) - The default currency of the site. - **seller_id** (integer) - The seller ID associated with the site. - **non_primary_currencies** (array) - A list of non-primary currencies enabled for the site. - **relationship_invoicing_enabled** (boolean) - Indicates if relationship invoicing is enabled. - **customer_hierarchy_enabled** (boolean) - Indicates if customer hierarchy is enabled. - **whopays_enabled** (boolean) - Indicates if 'whopays' functionality is enabled. - **whopays_default_payer** (string) - The default payer for 'whopays' functionality. - **default_payment_collection_method** (string) - The default payment collection method. - **organization_address** (object) - Details of the organization's address. - **tax_configuration** (object) - Tax configuration details. - **net_terms** (object) - Net terms configuration details. - **test** (boolean) - Indicates if the site is in test mode. #### Response Example ```json { "site": { "id": 00000, "name": "test-b2b-site", "subdomain": "test-acme-clone", "currency": "USD", "seller_id": 00000, "non_primary_currencies": ["BRL"], "relationship_invoicing_enabled": true, "customer_hierarchy_enabled": false, "whopays_enabled": false, "whopays_default_payer": "self-ungrouped", "default_payment_collection_method": "automatic", "organization_address": { "street": null, "line2": null, "city": null, "state": null, "zip": null, "country": null, "name": "Your Org Name", "phone": null, }, "tax_configuration": { "kind": "custom", "fully_configured": true, "destination_address": "shipping_then_billing", }, "net_terms": { "default_net_terms": 0, "automatic_net_terms": 0, "remittance_net_terms": 0, "net_terms_on_remittance_signups_enabled": false, "custom_net_terms_enabled": false, }, "test": true, } } ``` ``` -------------------------------- ### List Components Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/components/list-components This example demonstrates how to fetch a list of components from your Chargify site. You can filter the results by various parameters. ```APIDOC ## GET /components.json ### Description Retrieves a list of components. Supports filtering and pagination. ### Method GET ### Endpoint /components.json ### Query Parameters - **date_field** (string) - Optional - The field to use for date-based filtering (e.g., `updated_at`). - **page** (integer) - Optional - The page number for pagination. Defaults to 1. - **per_page** (integer) - Optional - The number of results per page. Defaults to 50. - **filter[ids]** (string) - Optional - A comma-separated list of component IDs to filter by. ### Request Example ```bash curl -X GET -G \ --url 'https://subdomain.chargify.com/components.json' \ -H 'Accept: application/json' \ -d 'date_field=updated_at' \ -d 'page=1' \ -d 'per_page=50' \ -d 'filter[ids]=1%2C2%2C3' ``` ### Response #### Success Response (200) Returns an array of Component objects. - **component** (object) - Contains component details. - **id** (integer) - The unique identifier for the component. - **name** (string) - The name of the component. - **pricing_scheme** (string) - The pricing scheme used for the component (e.g., `per_unit`). - **unit_name** (string) - The name of the unit for the component (e.g., `Component`). - **unit_price** (string) - The price per unit. - **product_family_id** (integer) - The ID of the product family this component belongs to. - **kind** (string) - The type of component (e.g., `quantity_based_component`, `on_off_component`). - **archived** (boolean) - Indicates if the component is archived. - **taxable** (boolean) - Indicates if the component is taxable. - **description** (string) - A description of the component. - **default_price_point_id** (integer) - The ID of the default price point for the component. - **prices** (array) - An array of price objects associated with the component. - **price_point_count** (integer) - The number of price points available for the component. - **price_points_url** (string) - The URL to fetch the price points for this component. - **tax_code** (string) - The tax code associated with the component. - **recurring** (boolean) - Indicates if the component is recurring. - **upgrade_charge** (string) - The charge for upgrading the component. - **downgrade_credit** (string) - The credit for downgrading the component. - **created_at** (string) - The timestamp when the component was created. - **default_price_point_name** (string) - The name of the default price point. - **product_family_name** (string) - The name of the product family. - **product_family_handle** (string) - The handle of the product family. - **use_site_exchange_rate** (boolean) - Indicates if the site exchange rate is used. ### Response Example ```json [ { "component": { "id": 399850, "name": "$1.00 component", "pricing_scheme": "per_unit", "unit_name": "Component", "unit_price": "1.0", "product_family_id": 997233, "price_per_unit_in_cents": null, "kind": "quantity_based_component", "archived": false, "taxable": false, "description": "Component", "default_price_point_id": 121000, "prices": [ { "id": 630687, "component_id": 399850, "starting_quantity": 1, "ending_quantity": null, "unit_price": "1.0", "price_point_id": 121000, "formatted_unit_price": "$1.00" } ], "price_point_count": 2, "price_points_url": "https://general-goods.chargify.com/components/399850/price_points", "tax_code": null, "recurring": true, "upgrade_charge": null, "downgrade_credit": null, "created_at": "2019-08-01T09:35:38-04:00", "default_price_point_name": "Original", "product_family_name": "Chargify", "product_family_handle": "chargify", "use_site_exchange_rate": true } } ] ``` ``` -------------------------------- ### List Metadata Request Example (cURL) Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/custom-fields/list-metadata This example demonstrates how to make a GET request to the List Metadata endpoint using cURL. It includes query parameters for pagination and specifies the resource type and ID. ```curl curl -X GET -G \ --url 'https://subdomain.chargify.com/subscriptions/60/metadata.json' \ -H 'Accept: application/json' \ -d 'page=1' \ -d 'per_page=50' ``` -------------------------------- ### List Components for a Subscription Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/subscription-components/list-subscription-components This example demonstrates how to fetch all components for a given subscription ID. You can filter and sort the results using query parameters. ```APIDOC ## GET /subscriptions/{subscription_id}/components.json ### Description Retrieves a list of components for a specific subscription. ### Method GET ### Endpoint /subscriptions/{subscription_id}/components.json ### Query Parameters - **date_field** (string) - Optional - Field used for sorting results. - **filter[currencies]** (string) - Optional - Filter by currency codes (e.g., EUR,USD). - **price_point_ids** (string) - Optional - Filter by price point IDs. Use `not_null` to include components with a price point. - **product_family_ids** (string) - Optional - Filter by product family IDs (e.g., 1,2,3). - **sort** (string) - Optional - Field to sort the results by (e.g., `updated_at`). - **include** (string) - Optional - Include related data such as `subscription` or `historic_usages`. - **in_use** (boolean) - Optional - Filter components that are currently in use. ### Response #### Success Response (200) Returns an array of `Subscription Component Response` objects. - **component** (object) - Contains details of the subscription component. - **component_id** (integer) - The ID of the component. - **subscription_id** (integer) - The ID of the subscription. - **allocated_quantity** (integer) - The quantity allocated for the component. - **pricing_scheme** (string) - The pricing scheme used (e.g., `per_unit`). - **name** (string) - The name of the component. - **kind** (string) - The type of component (e.g., `quantity_based_component`). - **unit_name** (string) - The name of the unit for the component. - **price_point_id** (integer) - The ID of the price point. - **price_point_handle** (string) - The handle of the price point. - **price_point_type** (string) - The type of the price point (e.g., `default`). - **price_point_name** (string) - The name of the price point. - **enabled** (boolean) - Indicates if the component is enabled. - **unit_balance** (integer) - The current unit balance for the component. - **id** (integer) - The unique identifier for the component entry. - **created_at** (string) - The timestamp when the component was created. - **updated_at** (string) - The timestamp when the component was last updated. - **component_handle** (string) - The handle of the component. - **archived_at** (string) - The timestamp when the component was archived, or null. ### Request Example ```bash curl -X GET -G \ --url 'https://subdomain.chargify.com/subscriptions/222/components.json' \ -H 'Accept: application/json' \ -d 'date_field=updated_at' \ -d 'filter[currencies]=EUR%2CUSD' \ -d 'price_point_ids=not_null' \ -d 'product_family_ids=1%2C2%2C3' \ -d 'sort=updated_at' \ -d 'include=subscription%2Chistoric_usages' \ -d 'in_use=true' ``` ### Response Example ```json [ { "component": { "component_id": 0, "subscription_id": 0, "allocated_quantity": 0, "pricing_scheme": "per_unit", "name": "string", "kind": "quantity_based_component", "unit_name": "string", "price_point_id": 0, "price_point_handle": "string", "price_point_type": "default", "price_point_name": "string", "enabled": true, "unit_balance": 0, "id": 0, "created_at": "2022-02-22T14:07:00-05:00", "updated_at": "2022-02-22T14:07:00-05:00", "component_handle": "string", "archived_at": null } } ] ``` ``` -------------------------------- ### Create Product Family Request Example (cURL) Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/product-families/create-product-family This cURL command demonstrates how to create a product family. It includes the necessary headers and the request body with the product family's name and description. ```curl curl -X POST \ --url 'https://subdomain.chargify.com/product_families.json' \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ --data-raw '{ "product_family": { "name": "Acme Projects", "description": "Amazing project management tool" } }' ``` -------------------------------- ### List Customer Subscriptions Request Example Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/customers/list-customer-subscriptions This example demonstrates how to make a GET request to list customer subscriptions using curl. Ensure you replace `subdomain.chargify.com` and `150` with your actual subdomain and customer ID. ```curl curl -X GET \ --url 'https://subdomain.chargify.com/customers/150/subscriptions.json' \ -H 'Accept: application/json' ``` -------------------------------- ### Component Response Example Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/components/list-components This is an example of a successful response when listing components. It returns an array of component objects, each containing detailed pricing and configuration information. ```json [ { "component": { "id": 399850, "name": "$1.00 component", "pricing_scheme": "per_unit", "unit_name": "Component", "unit_price": "1.0", "product_family_id": 997233, "price_per_unit_in_cents": null, "kind": "quantity_based_component", "archived": false, "taxable": false, "description": "Component", "default_price_point_id": 121000, "prices": [ { "id": 630687, "component_id": 399850, "starting_quantity": 1, "ending_quantity": null, "unit_price": "1.0", "price_point_id": 121000, "formatted_unit_price": "$1.00" } ], "price_point_count": 2, "price_points_url": "https://general-goods.chargify.com/components/399850/price_points", "tax_code": null, "recurring": true, "upgrade_charge": null, "downgrade_credit": null, "created_at": "2019-08-01T09:35:38-04:00", "default_price_point_name": "Original", "product_family_name": "Chargify", "product_family_handle": "chargify", "use_site_exchange_rate": true } }, { "component": { "id": 399853, "name": "Annual Support Services", "pricing_scheme": null, "unit_name": "on/off", "unit_price": "100.0", "product_family_id": 997233, "price_per_unit_in_cents": null, "kind": "on_off_component", "archived": false, "taxable": true, "description": "Prepay for support services", "default_price_point_id": 121003, "price_point_count": 4, "price_points_url": "https://general-goods.chargify.com/components/399853/price_points", "tax_code": "D0000000", "recurring": true, "upgrade_charge": null, "downgrade_credit": null, "created_at": "2019-08-01T09:35:37-04:00", "default_price_point_name": "Original", "product_family_name": "Chargify", "product_family_handle": "chargify", "use_site_exchange_rate": true } }, { "component": { "id": 386937, "name": "Cancellation fee", "pricing_scheme": null, "unit_name": "on/off", "unit_price": "35.0", "product_family_id": 997233, "price_per_unit_in_cents": null, "kind": "on_off_component", "archived": false, "taxable": false, "description": "", "default_price_point_id": 108307, "price_point_count": 1, "price_points_url": "https://general-goods.chargify.com/components/386937/price_points", "tax_code": null, "recurring": true, "upgrade_charge": null, "downgrade_credit": null, "created_at": "2019-08-01T09:35:38-04:00", "default_price_point_name": "Original", "product_family_name": "Chargify", "product_family_handle": "chargify", "use_site_exchange_rate": true } } ] ``` -------------------------------- ### Find Subscription Request (cURL) Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/subscriptions/find-subscription Example of how to make a GET request to find a subscription using cURL. Ensure to replace 'subdomain.chargify.com' with your actual subdomain. ```curl curl -X GET -G \ --url 'https://subdomain.chargify.com/subscriptions/lookup.json' \ -H 'Accept: application/json' ``` -------------------------------- ### List Products for Product Family - Request Example Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/product-families/list-products-for-product-family This example demonstrates how to make a GET request to the Chargify API to list products within a specified product family. It includes parameters for pagination, filtering by IDs, and including related data like prepaid product price points. ```curl curl -X GET -G \ --url 'https://subdomain.chargify.com/product_families/product_family_id4/products.json' \ -H 'Accept: application/json' \ -d 'page=1' \ -d 'per_page=50' \ -d 'date_field=updated_at' \ -d 'filter[ids]=1%2C2%2C3' \ -d 'include=prepaid_product_price_point' ``` -------------------------------- ### List All Payment Profiles Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/payment-profiles/list-payment-profiles This example shows how to list all payment profiles for a site using query parameters for pagination. Ensure Basic Authentication is configured. ```HTTP GET /payment_profiles.json ``` -------------------------------- ### Activate Subscription Request Example (JSON) Source: https://developers.maxio.com/http/advanced-billing-api/models/structures/activate-subscription-request Demonstrates how to structure a JSON request to activate a subscription, specifying the `revert_on_failure` parameter. ```json { "revert_on_failure": false } ``` -------------------------------- ### Get One Time Token Request Example Source: https://developers.maxio.com/http/advanced-billing-api/models/structures/get-one-time-token-request This JSON object represents a sample request for obtaining a one-time token. It includes a payment profile with all its associated fields. ```json { "payment_profile": { "id": "id4", "first_name": "first_name4", "last_name": "last_name2", "masked_card_number": "masked_card_number2", "card_type": "bogus", "expiration_month": 133.5, "expiration_year": 156.84, "customer_id": "customer_id2", "current_vault": "stripe", "vault_token": "vault_token6", "billing_address": "billing_address4", "billing_address_2": "billing_address_26", "billing_city": "billing_city8", "billing_country": "billing_country2", "billing_state": "billing_state2", "billing_zip": "billing_zip2", "payment_type": "payment_type6", "disabled": false, "site_gateway_setting_id": 104, "customer_vault_token": "customer_vault_token2", "gateway_handle": "gateway_handle4" } } ``` -------------------------------- ### List Components for Product Family Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/components/list-components-for-product-family This example demonstrates how to list all components for a given product family using the Chargify API. You can specify pagination parameters like `page` and `per_page`, and filter components by their IDs. ```APIDOC ## List Components for Product Family ### Description This endpoint retrieves a list of components belonging to a specific product family. You can paginate the results and filter by component IDs. ### Method GET ### Endpoint /product_families/{product_family_id}/components.json ### Query Parameters - **page** (integer) - Optional - The page number to retrieve. - **per_page** (integer) - Optional - The number of records to retrieve per page. Defaults to 50. - **filter[ids]** (string) - Optional - A comma-separated list of component IDs to filter by. - **date_field** (string) - Optional - The field to use for date-based filtering (e.g., `updated_at`). ### Response #### Success Response (200 OK) Returns an array of component objects. ```json [ { "component": { "id": 399850, "name": "$1.00 component", "pricing_scheme": "per_unit", "unit_name": "Component", "unit_price": "1.0", "product_family_id": 997233, "price_per_unit_in_cents": null, "kind": "quantity_based_component", "archived": false, "taxable": false, "description": "Component", "default_price_point_id": 121000, "prices": [ { "id": 630687, "component_id": 399850, "starting_quantity": 1, "ending_quantity": null, "unit_price": "1.0", "price_point_id": 121000, "formatted_unit_price": "$1.00" } ], "price_point_count": 2, "price_points_url": "https://general-goods.chargify.com/components/399850/price_points", "tax_code": null, "recurring": true, "upgrade_charge": null, "downgrade_credit": null, "created_at": "2019-08-01T09:35:38-04:00", "default_price_point_name": "Original", "product_family_name": "Chargify", "use_site_exchange_rate": true } } ] ``` ``` -------------------------------- ### Retrieve Product by Handle (cURL) Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/products/read-product-by-handle Example using cURL to make a GET request to retrieve a product by its handle. This includes setting the Accept header for JSON response. ```curl curl -X GET \ --url 'https://subdomain.chargify.com/products/handle/api_handle6.json' \ -H 'Accept: application/json' ``` -------------------------------- ### Scheduled Renewal Configuration JSON Example Source: https://developers.maxio.com/http/advanced-billing-api/models/structures/scheduled-renewal-configuration This JSON object represents a scheduled renewal configuration. It includes IDs for the site and subscription, and timestamps for when the renewal starts and ends. ```json { "id": 152, "site_id": 78, "subscription_id": 6, "starts_at": "2016-03-13T12:52:32.123Z", "ends_at": "2016-03-13T12:52:32.123Z" } ``` -------------------------------- ### Basic Authentication Example Source: https://developers.maxio.com/http/getting-started/how-to-get-started Demonstrates how to use Basic Authentication with your client credentials. The credentials are concatenated with a colon, base64-encoded, and sent in the Authorization header. ```bash curl {BASEURI} -u '{BASIC_AUTH_USER_NAME}:{BASIC_AUTH_PASSWORD}' ``` -------------------------------- ### Create Payment Profile Example Source: https://developers.maxio.com/http/advanced-billing-api/models/structures/create-payment-profile Example of creating a payment profile with basic credit card details. ```json { "chargify_token": "tok_9g6hw85pnpt6knmskpwp4ttt", "full_number": "5424000000000015", "id": 76, "payment_type": "credit_card", "first_name": "first_name8", "last_name": "last_name6" } ``` -------------------------------- ### Read Site Endpoint - cURL Example Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/sites/read-site This cURL command demonstrates how to make a GET request to the Read Site endpoint. Ensure you replace 'subdomain' with your actual site's subdomain. ```curl curl -X GET \ --url 'https://subdomain.chargify.com/site.json' \ -H 'Accept: application/json' ``` -------------------------------- ### Subscription Migration Preview Request Example Source: https://developers.maxio.com/http/advanced-billing-api/models/structures/subscription-migration-preview-request This JSON object represents a sample request body for previewing a subscription migration. It specifies migration options such as including coupons and the target product and price point. ```json { "migration": { "include_trial": false, "include_initial_charge": false, "include_coupons": true, "preserve_period": false, "product_id": 158, "product_price_point_id": 82 } } ``` -------------------------------- ### Curl Request to Read Product Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/products/read-product This example demonstrates how to make a GET request to the product endpoint using curl. Ensure you replace `subdomain.chargify.com` with your actual subdomain and `202` with the product ID. ```curl curl -X GET \ --url 'https://subdomain.chargify.com/products/202.json' \ -H 'Accept: application/json' ``` -------------------------------- ### Subscription Response Example Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/subscriptions/update-subscription This is an example of a successful subscription response (200 OK) after an update operation. It includes detailed information about the subscription's current state and associated customer and product data. ```json { "subscription": { "id": 18220670, "state": "active", "trial_started_at": null, "trial_ended_at": null, "activated_at": "2017-06-27T13:45:15-05:00", "created_at": "2017-06-27T13:45:13-05:00", "updated_at": "2017-06-30T09:26:50-05:00", "expires_at": null, "balance_in_cents": 10000, "current_period_ends_at": "2017-06-30T12:00:00-05:00", "next_assessment_at": "2017-06-30T12:00:00-05:00", "canceled_at": null, "cancellation_message": null, "next_product_id": null, "cancel_at_end_of_period": false, "payment_collection_method": "automatic", "snap_day": "end", "cancellation_method": null, "current_period_started_at": "2017-06-27T13:45:13-05:00", "previous_state": "active", "signup_payment_id": 191819284, "signup_revenue": "0.00", "delayed_cancel_at": null, "coupon_code": null, "total_revenue_in_cents": 0, "product_price_in_cents": 0, "product_version_number": 1, "payment_type": null, "referral_code": "d3pw7f", "coupon_use_count": null, "coupon_uses_allowed": null, "reason_code": null, "automatically_resume_at": null, "current_billing_amount_in_cents": 10000, "receives_invoice_emails": false, "customer": { "id": 17780587, "first_name": "Catie", "last_name": "Test", "organization": "Acme, Inc.", "email": "catie@example.com", "created_at": "2017-06-27T13:01:05-05:00", "updated_at": "2017-06-30T09:23:10-05:00", "reference": "123ABC", "address": "123 Anywhere Street", "address_2": "Apartment #10", "city": "Los Angeles", "state": "CA", "zip": "90210", "country": "US", "phone": "555-555-5555", "portal_invite_last_sent_at": "2017-06-27T13:45:16-05:00", "portal_invite_last_accepted_at": null, "verified": true, "portal_customer_created_at": "2017-06-27T13:01:08-05:00", "cc_emails": "support@example.com", "tax_exempt": true }, "product": { "id": 4470347, "name": "Zero Dollar Product", "handle": "zero-dollar-product", "description": "", "accounting_code": "", "request_credit_card": true, "expiration_interval": null, "expiration_interval_unit": "never", "created_at": "2017-03-23T10:54:12-05:00", "updated_at": "2017-04-20T15:18:46-05:00", "price_in_cents": 0, "interval": 1, "interval_unit": "month", "initial_charge_in_cents": null, "trial_price_in_cents": null, "trial_interval": null, "trial_interval_unit": "month", "archived_at": null, "require_credit_card": false, "return_params": "", "taxable": false, "update_return_url": "", "tax_code": "", "initial_charge_after_trial": false, "version_number": 1, "update_return_params": "", "product_family": { "id": 997233, "name": "Acme Products", "description": "", "handle": "acme-products", "accounting_code": null }, "public_signup_pages": [ { "id": 316810, "return_url": "", "return_params": "", "url": "https://general-goods.chargify.com/subscribe/69x825m78v3d/zero-dollar-product" } ] } } } ``` -------------------------------- ### Example Request with Currency Prices Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/coupons/read-coupon This `curl` command demonstrates how to make a GET request to retrieve a coupon, including the `currency_prices=true` query parameter to include currency price data in the response. ```curl curl -X GET -G \ --url 'https://subdomain.chargify.com/product_families/140/coupons/162.json' \ -H 'Accept: application/json' \ -d 'currency_prices=true' ``` -------------------------------- ### Override Subscription JSON Example Source: https://developers.maxio.com/http/advanced-billing-api/models/structures/override-subscription This JSON structure can be used to override subscription fields such as activation, cancellation, expiration, and current period start dates. Ensure dates are in ISO8601 format. ```json { "activated_at": "2016-03-13T12:52:32.123Z", "canceled_at": "2016-03-13T12:52:32.123Z", "cancellation_message": "cancellation_message4", "expires_at": "2016-03-13T12:52:32.123Z", "current_period_starts_at": "2016-03-13T12:52:32.123Z" } ``` -------------------------------- ### Subscription Product Migration Example Source: https://developers.maxio.com/http/advanced-billing-api/models/structures/subscription-product-migration This JSON object represents the parameters for migrating a subscription to a new product. It specifies the target product ID and price point ID, along with options for including trial periods, initial charges, and coupons, and whether to preserve the current billing period. ```json { "include_trial": false, "include_initial_charge": false, "include_coupons": true, "preserve_period": false, "product_id": 8, "product_price_point_id": 172 } ``` -------------------------------- ### Curl Request to List Product Families Source: https://developers.maxio.com/http/advanced-billing-api/api-endpoints/product-families/list-product-families This example demonstrates how to make a GET request to the product families endpoint using curl, including setting the Accept header and a query parameter for filtering by date. ```curl curl -X GET -G \ --url 'https://subdomain.chargify.com/product_families.json' \ -H 'Accept: application/json' \ -d 'date_field=updated_at' ```