Skip to main content
This example shows how to perform the same flow using raw HTTP requests with cURL. This is useful for testing or for languages without an official SDK.

1. Create Customer

curl https://api.credibill.tech/v1/customers \
  -u sk_test_...: \
  -d email="[email protected]" \
  -d name="Startup Inc" \
  -d paymentMethod="pm_card_visa"
Response:
{
  "id": "cus_12345",
  "email": "[email protected]",
  "name": "Startup Inc",
  "created": 1678900000
}

2. Create Subscription

Take the id from the previous response (e.g., cus_12345) and use it to create a subscription.
curl https://api.credibill.tech/v1/subscriptions \
  -u sk_test_...: \
  -d customerId="cus_12345" \
  -d planId="plan_starter_monthly"
Response:
{
  "id": "sub_67890",
  "status": "active",
  "current_period_end": 1681578400,
  "customer": "cus_12345",
  "plan": {
    "id": "plan_starter_monthly",
    "amount": 2900
  }
}