### Supported Pricing Currencies Source: https://pay-docs.crypto.com/index Lists the supported fiat and cryptocurrency currencies for pricing, including their smallest unit and example amounts. ```APIDOC ## Supported Pricing Currencies ### Fiat Currencies | ISO Currency Code | Smallest Unit | Example Pricing Amount | Payment Object's `amount` Value | |---|---|---|---| | USD | 0.01 | 100 USD | 10000 | | EUR | 0.01 | 100 EUR | 10000 | | AUD | 0.01 | 100 AUD | 10000 | | CAD | 0.01 | 100 CAD | 10000 | | GBP | 0.01 | 100 USD | 10000 | | BGN | 0.01 | 100 BGN | 10000 | | BRL | 0.01 | 100 BRL | 10000 | | CHF | 0.01 | 100 CHF | 10000 | | CLP | 1 | 100 CLP | 100 | | CNY | 0.01 | 100 CNY | 10000 | | COP | 0.01 | 100 COP | 10000 | | DKK | 0.01 | 100 DKK | 10000 | | HKD | 0.01 | 100 HKD | 10000 | | IDR | 0.01 | 100 IDR | 10000 | | INR | 0.01 | 100 INR | 10000 | | JPY | 1 | 100 JPY | 100 | | KRW | 1 | 100 KRW | 100 | | MDL | 0.01 | 100 MDL | 10000 | | MOP | 0.01 | 100 MOP | 10000 | | MXN | 0.01 | 100 MXN | 10000 | | MYR | 0.01 | 100 MYR | 10000 | | NOK | 0.01 | 100 NOK | 10000 | | PHP | 0.01 | 100 PHP | 10000 | | RON | 0.01 | 100 RON | 10000 | | RUB | 0.01 | 100 RUB | 10000 | | SAR | 0.01 | 100 SAR | 10000 | | SEK | 0.01 | 100 SEK | 10000 | | SGD | 0.01 | 100 SGD | 10000 | | THB | 0.01 | 100 THB | 10000 | | TRY | 0.01 | 100 TRY | 10000 | | TWD | 0.01 | 100 TWD | 10000 | | UAH | 0.01 | 100 UAH | 10000 | | ZAR | 0.01 | 100 ZAR | 10000 | ### Cryptocurrency Currencies | Currency Code | Smallest Unit | Example Pricing Amount | Payment Object's `amount` Value | |---|---|---|---| | BTC | satoshi (1 × 10-8) | 1 BTC | 100000000 | | ETH | wei (1 × 10-18) | 0.5 ETH | 500000000000000000 | | CRO | (1 × 10-18) | 10 CRO | 10000000000000000000 | ``` -------------------------------- ### GET /products/:id Source: https://pay-docs.crypto.com/index Retrieves the details of a specific product using its unique product ID. ```APIDOC ## GET /products/:id ### Description Retrieves the details of a product by the unique product ID. This is useful for fetching information about an existing product that was previously created. ### Method GET ### Endpoint /products/:id ### Parameters #### Path Parameters - **id** (string) - Required - The identifier of the product to be retrieved. ### Response #### Success Response (200) - **id** (string) - Unique identifier for the product. - **account_id** (string) - The ID of the account associated with the product. - **active** (boolean) - Whether the product is active. - **description** (string) - Description of the product. - **name** (string) - Name of the product. - **sub_merchant_id** (string) - The sub-merchant ID associated with the product. - **metadata** (object) - Metadata associated with the product. - **created_at** (timestamp) - Time at which the object was created. - **updated_at** (timestamp) - Time at which the object was last updated. - **pricing_plans** (array) - Array of pricing plans for the product. #### Response Example ```json { "id": "89630fd4-e900-40c9-a072-758f16d9dbdd", "account_id": "a5b1e789-fc2b-478b-a0be-3fbbc2607563", "active": true, "description": "Newsletter monthly subscription", "name": "Newsletter monthly subscription", "sub_merchant_id": "merchant_001", "metadata": { "ref_id": "6936acde-1697-456d-95c1-0afcce047b29" }, "created_at": 1628000625, "updated_at": 1628000625, "pricing_plans": [ { "id": "2506cad4-fed6-49c0-98f5-34b0bedd6891", "active": true, "amount": 1000, "amount_in_unit": "10.00", "currency": "USD", "interval": "month", "interval_count": 1, "purchase_type": "recurring", "description": "Newsletter monthly subscription pricing", "metadata": { "ref_id": "99213a90807b" }, "created_at": 1628000625, "updated_at": 1628000625 } ] } ``` ``` -------------------------------- ### API Authentication using cURL (Bearer Token) Source: https://pay-docs.crypto.com/index Example of how to authenticate API requests using cURL with Bearer token authentication. This is useful for cross-origin requests. ```bash curl https://pay.crypto.com/api/payments \ -H "Authorization: Bearer sk_test_7ETNLmgFVsmmdiEhfqwjHPeJ" ``` -------------------------------- ### Retrieve Product by ID using cURL Source: https://pay-docs.crypto.com/index This snippet shows how to fetch the details of a specific product using its unique ID via a GET request with cURL. Authentication is required for this operation. ```bash curl https://pay.crypto.com/api/products/89630fd4-e900-40c9-a072-758f16d9dbdd \ -u sk_test_7ETNLmgFVsmmdiEhfqwjHPeJ: ``` -------------------------------- ### API Authentication using cURL (Basic Auth) Source: https://pay-docs.crypto.com/index Example of how to authenticate API requests using cURL with HTTP Basic Authentication. This method uses your secret key as the username. ```bash curl https://pay.crypto.com/api/payments \ -u sk_test_7ETNLmgFVsmmdiEhfqwjHPeJ: ``` -------------------------------- ### Crypto.com Pay API Payment Creation Response Source: https://pay-docs.crypto.com/index Example response from the Crypto.com Pay API after successfully creating a payment. It includes the payment ID, amount, currency, status, and crucially, the `payment_url` that customers will be redirected to for completing the transaction. Other URLs like `return_url` and `cancel_url` are also confirmed. ```json { // Showing selected fields only "id": "PAYMENT_UNIQUE_ID", "amount": 10000, "currency": "USD", "description": "Product Name", "status": "pending", "payment_url": "https://js.crypto.com/sdk/payments/checkout/set_wallet?publishableKey=XXX&sdkMeta=YYY", "return_url": "http://YOUR_WEBSITE.com/orders/123/complete", "cancel_url": "http://YOUR_WEBSITE.com/orders/123/fail" } ``` -------------------------------- ### GET /api/refunds/:id Source: https://pay-docs.crypto.com/index Retrieves a specific refund by its ID. ```APIDOC ## GET /api/refunds/:id ### Description Retrieves the details of a specific refund using its unique identifier. ### Method GET ### Endpoint /api/refunds/:id ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the refund to retrieve. #### Query Parameters None #### Request Body None ### Response #### Success Response (200) Returns the refund object matching the provided ID. - **id** (string) - Unique identifier for the refund object. - **payment_id** (string) - Unique identifier for the payment object. - **currency** (currency) - Three-letter currency code for the payment amount. - **amount** (positive integer) - Amount refunded in the smallest currency unit. - **reason** (string) - Reason for the refund. - **description** (string) - An arbitrary string attached to the object. - **created** (timestamp) - Time at which the object was created. - **status** (string) - The status of the refund. - **live_mode** (boolean) - Indicates if the refund was created in live mode. - **refund_currency** (string) - The cryptocurrency that was refunded. - **refund_amount** (positive integer) - The amount of cryptocurrency that was refunded. - **refund_destination** (string) - Destination of the refund. #### Response Example ```json { "id": "53c6ac55-2008-487f-a1c7-65b120b4e922", "payment_id": "1d065c74-1162-41b2-baf0-de90742e9f28", "currency": "USD", "amount": 2500, "reason": "requested_by_customer", "description": "Refund for Order#32", "created": 1555098162, "status": "succeeded", "live_mode": true, "refund_currency": "CRO", "refund_amount": "121.09117681", "refund_destination": "Crypto.com Wallet App" } ``` ``` -------------------------------- ### Create Product and Pricing Plan with cURL Source: https://pay-docs.crypto.com/index This cURL command illustrates how to create a product and its associated pricing plan for recurring subscriptions. It requires your secret key and specifies details like name, currency, and interval. The response includes IDs for the created product and pricing plan. ```shell curl https://pay.crypto.com/api/products \ -u YOUR_SECRET_KEY_PLACEHOLDER: \ -H "Content-Type: application/json" \ -d '{ \ "name": "Newsletter monthly subscription", \ "active": true, \ "description": "Newsletter monthly subscription", \ "metadata": { \ "ref_id": "6936acde-1697-456d-95c1-0afcce047b29" \ }, \ "pricing_plans": [ \ { \ "amount": 1000, \ "currency": "USD", \ "active": true, \ "description": "Newsletter monthly subscription pricing", \ "interval": "month", \ "interval_count": 1, \ "metadata": { \ "ref_id": "99213a90807b" \ }, \ "purchase_type": "recurring" \ } \ ] \ }' ``` -------------------------------- ### GET /sub_merchants/:id Source: https://pay-docs.crypto.com/index Retrieves the details of a specific sub-merchant by their unique ID. ```APIDOC ## GET /sub_merchants/:id ### Description Retrieves the details of a sub-merchant by the unique sub-merchant ID (NOT the `external_id`), which was returned from your creation request. ### Method GET ### Endpoint /sub_merchants/:id ### Parameters #### Path Parameters - **id** (string) - Required - The identifier of the sub-merchant to be retrieved. ### Request Example ```bash curl https://pay.crypto.com/api/sub_merchants/e884e700-e3c7-47e3-85c4-3baf114ddacd \ -u sk_test_7ETNLmgFVsmmdiEhfqwjHPeJ: ``` ### Response #### Success Response (200) Returns a sub-merchant object if a valid identifier was provided. - **id** (string) - The unique identifier of the sub-merchant. - **external_id** (string) - Acquirer's reference identifier of the sub-merchant. - **name** (string) - Name of the sub-merchant. - **business_settings** (object) - Business settings of the sub-merchant. - **support_email** (string) - Support email address of the sub-merchant. - **active** (boolean) - Indicates if the sub-merchant is active. - **cashback_rate** (string) - The cashback rate for the sub-merchant. - **created_at** (integer) - Timestamp when the sub-merchant was created. - **updated_at** (integer) - Timestamp when the sub-merchant was last updated. - **avatar** (string) - URL of the sub-merchant logo. - **live_account_enabled** (boolean) - Indicates if the live account is enabled for the sub-merchant. #### Response Example ```json { "id": "e884e700-e3c7-47e3-85c4-3baf114ddacd", "external_id": "Sub merchant123", "name": "Sub merchant 123", "business_settings": { "website": "https://example.com", "legal_entity_name": "Sub merchant One Two Three", "country": "US", "business_category": "corporation", "business_industry": "5691", "registration_number": "123456", "business_address": "Unit A, 12/F, Street ABC", "business_address2": "Building XYZ", "province": "Los Angeles", "region": "California", "zip_code": "90003", "incorporation_country": "US", "service_region": "Global", "service_country": "" }, "support_email": "support_email@example.com", "active": true, "cashback_rate": "0.01", "created_at": 1657090466, "updated_at": 1657090466, "avatar": "https://pay.crypto.com/rails/active_storage/blobs/easdJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaEpJaWsxWTJWbU9XWmhNQUxUUmlNVEV0T0RFeE9DMWxZak0yTUdGbFpUTTNNVFVHT2daRlZBPInB1ciI6ImJsb2JfaWQifX0=--fd31711455894547f085asdsad14ceb56af1f2f/logo_1.png", "live_account_enabled": true } ``` ``` -------------------------------- ### Create Product using cURL Source: https://pay-docs.crypto.com/index This snippet demonstrates how to create a new product with a recurring monthly subscription plan using the cURL command-line tool. It requires authentication and sends product details in JSON format. ```bash curl https://pay.crypto.com/api/products \ -u sk_test_7ETNLmgFVsmmdiEhfqwjHPeJ: \ -H "Content-Type: application/json" \ -d '{ "name": "Newsletter monthly subscription", "active": true, "description": "Newsletter monthly subscription", "metadata": { "ref_id": "6936acde-1697-456d-95c1-0afcce047b29" }, "pricing_plans": [ { "amount": 1000, "currency": "USD", "active": true, "description": "Newsletter monthly subscription pricing", "interval": "month", "interval_count": 1, "metadata": { "ref_id": "99213a90807b" }, "purchase_type": "recurring" } ] }' ``` -------------------------------- ### Create Product and Pricing Plan Source: https://pay-docs.crypto.com/index Create a new product and its associated pricing plan for recurring subscriptions. This involves defining the product's name, description, and pricing details like amount, currency, and interval. The response provides IDs for the product and pricing plan, which are needed for subsequent operations. ```APIDOC ## POST /api/products ### Description Creates a new product with one or more pricing plans. This is used to define items or services that can be purchased, including subscription-based offerings. ### Method POST ### Endpoint /api/products ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **name** (string) - Required - The name of the product. - **active** (boolean) - Required - Whether the product is currently active. - **description** (string) - Optional - A description of the product. - **metadata** (object) - Optional - Custom key-value pairs for additional information. - **pricing_plans** (array) - Required - A list of pricing plan objects. - **amount** (integer) - Required - The price of the plan in the smallest currency unit (e.g., cents for USD). - **currency** (string) - Required - The currency code (e.g., 'USD'). - **active** (boolean) - Required - Whether the pricing plan is active. - **description** (string) - Optional - A description of the pricing plan. - **interval** (string) - Required - The billing interval ('day', 'week', 'month', 'year'). - **interval_count** (integer) - Required - The number of intervals between payments. - **purchase_type** (string) - Required - Type of purchase ('one_time', 'recurring'). - **metadata** (object) - Optional - Custom key-value pairs for additional information. ### Request Example ```bash curl https://pay.crypto.com/api/products \ -u YOUR_SECRET_KEY_PLACEHOLDER: \ -H "Content-Type: application/json" \ -d '{ \ "name": "Newsletter monthly subscription", \ "active": true, \ "description": "Newsletter monthly subscription", \ "metadata": { \ "ref_id": "6936acde-1697-456d-95c1-0afcce047b29" \ }, \ "pricing_plans": [ \ { \ "amount": 1000, \ "currency": "USD", \ "active": true, \ "description": "Newsletter monthly subscription pricing", \ "interval": "month", \ "interval_count": 1, \ "metadata": { \ "ref_id": "99213a90807b" \ }, \ "purchase_type": "recurring" \ } \ ] \ }' ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the created product. - **pricing_plans** (array) - A list of created pricing plans, each with an 'id'. #### Response Example ```json { "id": "89630fd4-e900-40c9-a072-758f16d9dbdd", "account_id": "a5b1e789-fc2b-478b-a0be-3fbbc2607563", "active": true, "description": "Newsletter monthly subscription", "name": "Newsletter monthly subscription", "metadata": { "ref_id": "6936acde-1697-456d-95c1-0afcce047b29" }, "created_at": 1628000625, "updated_at": 1628000625, "pricing_plans": [ { "id": "2506cad4-fed6-49c0-98f5-34b0bedd6891", "active": true, "amount": 1000, "currency": "USD", "interval": "month", "interval_count": 1, "purchase_type": "recurring", "description": "Newsletter monthly subscription pricing", "metadata": { "ref_id": "99213a90807b" }, "created_at": 1628000625, "updated_at": 1628000625 } ] } ``` ``` -------------------------------- ### Get Customer by ID Source: https://pay-docs.crypto.com/index Retrieves the details of a customer using their unique ID. ```APIDOC ## GET /customers/:id ### Description Retrieves the details of a customer by the unique customer ID, which was returned from your creation request. ### Method GET ### Endpoint /customers/:id #### Path Parameters - **id** (string) - Required - The identifier of the customer to be retrieved. ### Request Example ```bash curl https://pay.crypto.com/api/customers/8e384561-d781-4868-9b66-3fb2d7a83ba5 \ -u sk_test_7ETNLmgFVsmmdiEhfqwjHPeJ: ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the customer. - **email** (string) - The email address of the customer. - **ref_from** (string) - Source of the reference. - **ref_id** (string) - Identifier from the reference source. - **name** (string) - The name of the customer. - **customer_details** (object) - Additional details about the customer. - **sub_merchant_id** (string) - The ID of the sub-merchant. - **created_at** (integer) - Timestamp of when the customer was created. - **updated_at** (integer) - Timestamp of when the customer was last updated. #### Response Example ```json { "id": "8e384561-d781-4868-9b66-3fb2d7a83ba5", "email": null, "ref_from": null, "ref_id": "6ded84e75449", "name": "John Doe", "customer_details": null, "sub_merchant_id": null, "created_at": 1627917897, "updated_at": 1627917897 } ``` ``` -------------------------------- ### Create Product and Pricing Plan Source: https://pay-docs.crypto.com/index This snippet demonstrates how to create a new product and its associated pricing plan using the Crypto.com Pay API. It requires your secret key and a JSON payload defining the product and plan details. The response includes the created product and plan IDs. ```curl curl https://pay.crypto.com/api/products \ -u YOUR_SECRET_KEY_PLACEHOLDER: \ -H "Content-Type: application/json" \ -d '{ "name": "Newsletter monthly subscription", "active": true, "description": "Newsletter monthly subscription", "metadata": { "ref_id": "6936acde-1697-456d-95c1-0afcce047b29" }, "pricing_plans": [ { "amount": 1000, "currency": "USD", "active": true, "description": "Newsletter monthly subscription pricing", "interval": "month", "interval_count": 1, "metadata": { "ref_id": "99213a90807b" }, "purchase_type": "recurring" } ] }' ``` -------------------------------- ### GET /payments/:payment_id/refunds Source: https://pay-docs.crypto.com/index Retrieves a list of all refunds associated with a specific payment. ```APIDOC ## GET /payments/:payment_id/refunds ### Description Retrieves a list of all refunds that have been issued for a specific payment. ### Method GET ### Endpoint /payments/:payment_id/refunds ### Parameters #### Path Parameters - **payment_id** (string) - Required - The unique identifier of the payment for which to retrieve refunds. #### Query Parameters None #### Request Body None ### Response #### Success Response (200) Returns a list of refund objects associated with the specified payment. - **data** (array) - A list of refund objects. - Each object contains the same attributes as described in the Refund Object section. #### Response Example ```json { "data": [ { "id": "4639e9bb-f85c-4f62-9d52-56dc0a8eb51b", "status": "succeeded", "payment_id": "8ddee625-d175-4c55-a5e0-5ed8c68e3cd1", "currency": "USD", "amount": 100, "reason": "requested_by_customer", "description": "Refund for Order#33", "created": 1555098162 }, { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "status": "succeeded", "payment_id": "8ddee625-d175-4c55-a5e0-5ed8c68e3cd1", "currency": "USD", "amount": 50, "reason": "duplicate", "description": "Partial refund for Order#33", "created": 1555098200 } ] } ``` ``` -------------------------------- ### POST /products Source: https://pay-docs.crypto.com/index Creates a new product object, which can be used for subscription services. It includes details like name, description, and pricing plans. ```APIDOC ## POST /products ### Description Creates a product object for subscription. This endpoint allows you to define a product with its name, active status, description, metadata, and associated pricing plans. ### Method POST ### Endpoint /products ### Parameters #### Request Body - **name** (string) - Required - Name of the product. - **active** (boolean) - Optional - Whether the product is active. - **description** (string) - Optional - An arbitrary string attached to the object. - **metadata** (object) - Optional - Set of key-value pairs that you can attach to an object. - **pricing_plans** (array) - Required - Array of pricing plans for the product. - **amount** (integer) - Required - A positive integer representing how much to collect in the smallest currency unit. - **currency** (string) - Required - Three-letter currency code for the payment amount. - **active** (boolean) - Optional - Whether the pricing plan is active. - **description** (string) - Optional - An arbitrary string attached to the object. - **interval** (string) - Optional - Interval period of recurring pricing plan (e.g., `month`). - **interval_count** (integer) - Optional - Count of the period for each interval. - **metadata** (object) - Optional - Set of key-value pairs that you can attach to an object. - **purchase_type** (string) - Optional - Whether the pricing is `recurring` or `one_time`. ### Request Example ```json { "name": "Newsletter monthly subscription", "active": true, "description": "Newsletter monthly subscription", "metadata": { "ref_id": "6936acde-1697-456d-95c1-0afcce047b29" }, "pricing_plans": [ { "amount": 1000, "currency": "USD", "active": true, "description": "Newsletter monthly subscription pricing", "interval": "month", "interval_count": 1, "metadata": { "ref_id": "99213a90807b" }, "purchase_type": "recurring" } ] } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the product. - **account_id** (string) - The ID of the account associated with the product. - **active** (boolean) - Whether the product is active. - **description** (string) - Description of the product. - **name** (string) - Name of the product. - **sub_merchant_id** (string) - The sub-merchant ID associated with the product. - **metadata** (object) - Metadata associated with the product. - **created_at** (timestamp) - Time at which the object was created. - **updated_at** (timestamp) - Time at which the object was last updated. - **pricing_plans** (array) - Array of pricing plans for the product. #### Response Example ```json { "id": "89630fd4-e900-40c9-a072-758f16d9dbdd", "account_id": "a5b1e789-fc2b-478b-a0be-3fbbc2607563", "active": true, "description": "Newsletter monthly subscription", "name": "Newsletter monthly subscription", "sub_merchant_id": "merchant_001", "metadata": { "ref_id": "6936acde-1697-456d-95c1-0afcce047b29" }, "created_at": 1628000625, "updated_at": 1628000625, "pricing_plans": [ { "id": "2506cad4-fed6-49c0-98f5-34b0bedd6891", "active": true, "amount": 1000, "amount_in_unit": "10.00", "currency": "USD", "interval": "month", "interval_count": 1, "purchase_type": "recurring", "description": "Newsletter monthly subscription pricing", "metadata": { "ref_id": "99213a90807b" }, "created_at": 1628000625, "updated_at": 1628000625 } ] } ``` ``` -------------------------------- ### GET /api/subscriptions/{id} Source: https://pay-docs.crypto.com/index Retrieves a specific subscription by its unique ID. Requires authentication with your secret key. ```APIDOC ## GET /api/subscriptions/{id} ### Description Retrieves a specific subscription by its unique ID. Requires authentication with your secret key. ### Method GET ### Endpoint https://pay.crypto.com/api/subscriptions/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique ID of the subscription to retrieve. #### Headers - **Authorization** (string) - Required - Basic authentication with your secret key. ### Response #### Success Response (200) - **id** (string) - The unique ID of the subscription. - **created_at** (integer) - Unix timestamp of when the subscription was created. - **currency** (string) - The currency of the subscription amount. - **amount** (integer) - The total amount of the subscription. - **current_period_end** (integer) - Unix timestamp when the current billing period ends. - **current_period_start** (integer) - Unix timestamp when the current billing period starts. - **auto_end_at** (integer|null) - Unix timestamp when the subscription will automatically end, if applicable. - **ended_at** (integer|null) - Unix timestamp when the subscription ended, if applicable. - **cancelled_at** (integer|null) - Unix timestamp when the subscription was cancelled, if applicable. - **interval** (string) - The billing interval of the subscription. - **interval_count** (integer) - The number of intervals between payments. - **live_mode** (boolean) - Indicates if the subscription is in live mode. - **metadata** (object) - Key-value pairs associated with the subscription. - **note** (string|null) - An optional note for the subscription. - **recipient** (string) - The recipient of the payment. - **reference** (string|null) - A reference identifier for the subscription. - **status** (string) - The current status of the subscription (e.g., "pending", "active"). - **updated_at** (integer) - Unix timestamp of when the subscription was last updated. #### Response Example ```json { "id": "SUBSCRIPTION_UNIQUE_ID", "created_at": 1625943925, "currency": "USD", "amount": 1000, "current_period_end": 1628622325, "current_period_start": 1625943925, "auto_end_at": null, "ended_at": null, "cancelled_at": null, "interval": "month", "interval_count": 1, "live_mode": true, "metadata": { "ref_id": "34196851011b" }, "note": null, "recipient": "Crypto.com Shop", "reference": null, "status": "pending", "updated_at": 1625943925 } ``` ``` -------------------------------- ### Create Product and Pricing Plan Source: https://pay-docs.crypto.com/index Creates a new product and its associated pricing plan. This is a prerequisite for creating subscriptions. ```APIDOC ## POST /api/products ### Description Creates a new product and its associated pricing plan. This is a prerequisite for creating subscriptions. ### Method POST ### Endpoint https://pay.crypto.com/api/products ### Parameters #### Request Body - **name** (string) - Required - The name of the product. - **active** (boolean) - Required - Whether the product is active. - **description** (string) - Optional - A description of the product. - **metadata** (object) - Optional - Arbitrary keys and values for storing additional information. - **ref_id** (string) - Required - A unique reference ID for the product. - **pricing_plans** (array) - Required - A list of pricing plans for the product. - **amount** (integer) - Required - The amount in the smallest currency unit (e.g., cents). - **currency** (string) - Required - The currency code (e.g., USD). - **active** (boolean) - Required - Whether the pricing plan is active. - **description** (string) - Optional - A description of the pricing plan. - **interval** (string) - Required - The billing interval (e.g., "month", "year"). - **interval_count** (integer) - Required - The number of intervals between payments. - **metadata** (object) - Optional - Arbitrary keys and values for storing additional information. - **ref_id** (string) - Required - A unique reference ID for the pricing plan. - **purchase_type** (string) - Required - The type of purchase (e.g., "recurring"). ### Request Example ```json { "name": "Newsletter monthly subscription", "active": true, "description": "Newsletter monthly subscription", "metadata": { "ref_id": "6936acde-1697-456d-95c1-0afcce047b29" }, "pricing_plans": [ { "amount": 1000, "currency": "USD", "active": true, "description": "Newsletter monthly subscription pricing", "interval": "month", "interval_count": 1, "metadata": { "ref_id": "99213a90807b" }, "purchase_type": "recurring" } ] } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier for the product. - **account_id** (string) - The ID of the account associated with the product. - **active** (boolean) - Whether the product is active. - **description** (string) - The description of the product. - **name** (string) - The name of the product. - **metadata** (object) - Metadata associated with the product. - **created_at** (integer) - Timestamp of creation. - **updated_at** (integer) - Timestamp of last update. - **pricing_plans** (array) - List of pricing plans associated with the product. - **id** (string) - The unique identifier for the pricing plan. - **active** (boolean) - Whether the pricing plan is active. - **amount** (integer) - The amount in the smallest currency unit. - **currency** (string) - The currency code. - **interval** (string) - The billing interval. - **interval_count** (integer) - The number of intervals between payments. - **purchase_type** (string) - The type of purchase. - **description** (string) - The description of the pricing plan. - **metadata** (object) - Metadata associated with the pricing plan. - **created_at** (integer) - Timestamp of creation. - **updated_at** (integer) - Timestamp of last update. #### Response Example ```json { "id": "89630fd4-e900-40c9-a072-758f16d9dbdd", "account_id": "a5b1e789-fc2b-478b-a0be-3fbbc2607563", "active": true, "description": "Newsletter monthly subscription", "name": "Newsletter monthly subscription", "metadata": { "ref_id": "6936acde-1697-456d-95c1-0afcce047b29" }, "created_at": 1628000625, "updated_at": 1628000625, "pricing_plans": [ { "id": "2506cad4-fed6-49c0-98f5-34b0bedd6891", "active": true, "amount": 1000, "currency": "USD", "interval": "month", "interval_count": 1, "purchase_type": "recurring", "description": "Newsletter monthly subscription pricing", "metadata": { "ref_id": "99213a90807b" }, "created_at": 1628000625, "updated_at": 1628000625 } ] } ``` ``` -------------------------------- ### API Base URL Source: https://pay-docs.crypto.com/index The base URL for all Crypto.com Pay API requests. This is the starting point for all API interactions. ```text https://pay.crypto.com/api ``` -------------------------------- ### Create Subscription using cURL Source: https://pay-docs.crypto.com/index This snippet demonstrates how to create a subscription using a cURL command. It sends a POST request to the /subscriptions endpoint with a JSON payload containing customer and item details. Ensure you replace placeholder values with your actual test keys and IDs. ```bash curl https://pay.crypto.com/api/subscriptions \ -u sk_test_7ETNLmgFVsmmdiEhfqwjHPeJ: \ -H "Content-Type: application/json" \ -d '{ "customer_id": "8e384561-d781-4868-9b66-3fb2d7a83ba5", "billing_cycle_anchor": 1625943925, "metadata": { "ref_id": "34196851011b" }, "items": [ { "plan_id": "2506cad4-fed6-49c0-98f5-34b0bedd6891", "quantity": 1 } ] }' ``` -------------------------------- ### Create Customer with cURL Source: https://pay-docs.crypto.com/index This cURL command shows how to create a customer profile for payment processing. It requires your secret key and includes customer details like a reference ID and name. The response provides the unique ID for the newly created customer. ```shell curl https://pay.crypto.com/api/customers \ -u sk_test_7ETNLmgFVsmmdiEhfqwjHPeJ: \ -H "Content-Type: application/json" \ -d '{ \ "ref_id": "6ded84e75449", \ "name": "John Doe" \ }' \ ```