> For the complete documentation index, see [llms.txt](https://docs.copperx.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.copperx.io/integrate-payments/accept-crypto-subscriptions.md).

# Accept Crypto Subscriptions

**🚀 How It Works**

✅ **Step 1: Create a Product**

Every subscription plan is associated with a product. Create the product first using the following API request:

```bash
curl --request POST \
  --url https://api.copperx.dev/api/v1/products \
  --header 'Authorization: Bearer {API_KEY}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "name": "Pro Membership",
    "description": "Monthly plan for premium users",
    "isActive": true,
    "unitLabel": "month",
    "url": "https://example.com/product",
    "metadata": {
      "category": "SaaS"
    },
    "visibility": 10,
    "defaultPriceData": {
      "currency": "usdc",
      "unitAmount": 50000000,
      "interval": "month",
      "intervalCount": 1,
      "type": "recurring"
    }
  }'
```

The response will include a unique `productId`. Save this for the next step.

***

✅ **Step 2: Create a Subscription Checkout Session**

Using the created product’s ID, generate a checkout session to enable the user to subscribe:

```bash
curl --request POST \
  --url https://api.copperx.dev/api/v1/checkout/sessions \
  --header 'Authorization: Bearer {API_KEY}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "mode": "subscription",
    "lineItems": {
      "data": [
        {
          "priceData": {
            "currency": "usdc",
            "unitAmount": "50000000",
            "interval": "month",
            "productId": "{PRODUCT_ID}"
          }
        }
      ]
    },
    "successUrl": "https://yourapp.com/success?session_id={CHECKOUT_SESSION_ID}",
    "cancelUrl": "https://yourapp.com/cancel"
  }'
```

The API response will provide a hosted **checkout session URL**. Redirect your user to this URL to complete the subscription.

***

✅ **Step 3: Automate Recurring Billing**

Copperx’s smart contracts **automatically handle** the recurring charges based on the interval (`monthly`, `yearly`, etc.) and send blockchain-verified payment confirmations.

***

✅ **Step 4: Stay Updated with Webhooks**

Copperx sends **webhook events** for key actions:

* `customer.subscription.created`
* `customer.subscription.started`
* `customer.subscription.unpaid`

Use these events to manage access and provide real-time updates to your users.
