biterp

Create customer subscription

POST
/customer-subscriptions
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://api.biterp.ai/customer-subscriptions" \  -H "Content-Type: application/json" \  -d '{    "customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e",    "financial_account_id": "12004dd2-b67b-4561-b5c8-278b86c292fd",    "billing_interval": "day",    "start_date": "2019-08-24",    "items": [      {        "item_description": "string",        "unit_price": "string"      }    ]  }'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "record_number": 0,
  "customer_id": "160c0c4b-9966-4dc1-a916-8407eb10d74e",
  "financial_account_id": "12004dd2-b67b-4561-b5c8-278b86c292fd",
  "financial_category_id": "a6b66ee2-6cb9-4e40-8c14-5161236f36c0",
  "reference_code": "string",
  "status": "string",
  "billing_mode": "string",
  "billing_interval": "day",
  "billing_interval_count": 0,
  "billing_cycle_anchor": "2019-08-24",
  "current_period_start": "2019-08-24",
  "current_period_end": "2019-08-24",
  "next_billing_date": "2019-08-24",
  "trial_end": "2019-08-24",
  "start_date": "2019-08-24",
  "payment_terms_days": 0,
  "cancel_at_period_end": true,
  "canceled_at": "2019-08-24T14:15:22Z",
  "paused_at": "2019-08-24T14:15:22Z",
  "ended_at": "2019-08-24T14:15:22Z",
  "description": "string",
  "notes": "string",
  "metadata": {},
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "items": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "subscription_id": "aa11a4c2-a467-43db-b413-c4ab0f5cf627",
      "subscription_plan_id": "0fcb3216-bef6-4343-b483-7a77bff76ad5",
      "product_id": "0d012afa-f885-4e65-aeca-37e27701e2d1",
      "item_description": "string",
      "quantity": "string",
      "unit_price": "string",
      "discount_rate": "string",
      "position": 0,
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "deleted_at": "2019-08-24T14:15:22Z"
    }
  ],
  "latest_billing_cycle": {
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "subscription_id": "aa11a4c2-a467-43db-b413-c4ab0f5cf627",
    "sequence": 0,
    "period_start": "2019-08-24",
    "period_end": "2019-08-24",
    "status": "string",
    "amount": "string",
    "sales_order_id": "5e95a238-d0d8-4280-92bc-08d83c9c12a6",
    "receivable_id": "c5fdbd77-089d-4f8e-bf49-b02b6e7fc04a",
    "external_invoice_id": "string",
    "external_idempotency_key": "string",
    "external_event_id": "string",
    "billed_at": "2019-08-24T14:15:22Z",
    "error_detail": "string",
    "metadata": {},
    "created_at": "2019-08-24T14:15:22Z",
    "updated_at": "2019-08-24T14:15:22Z"
  }
}
{
  "status_code": 422,
  "message": "Could not resolve provided geography fields",
  "error": "Unprocessable Entity",
  "details": {
    "fields": {
      "country_code": [
        "Could not resolve country from '1112' (tried ISO2, ISO3, numeric code and names)"
      ],
      "city": [
        "Could not resolve city from 'CidadeQueNaoExiste' in country 'BR'"
      ]
    }
  }
}
{
  "status_code": 404,
  "message": "Customer not found",
  "error": "Not Found",
  "code": "CUSTOMER_NOT_FOUND"
}
{
  "status_code": 404,
  "message": "Customer not found",
  "error": "Not Found",
  "code": "CUSTOMER_NOT_FOUND"
}
{
  "status_code": 404,
  "message": "Customer not found",
  "error": "Not Found",
  "code": "CUSTOMER_NOT_FOUND"
}
{
  "status_code": 422,
  "message": "Could not resolve provided geography fields",
  "error": "Unprocessable Entity",
  "details": {
    "fields": {
      "country_code": [
        "Could not resolve country from '1112' (tried ISO2, ISO3, numeric code and names)"
      ],
      "city": [
        "Could not resolve city from 'CidadeQueNaoExiste' in country 'BR'"
      ]
    }
  }
}
{
  "status_code": 404,
  "message": "Customer not found",
  "error": "Not Found",
  "code": "CUSTOMER_NOT_FOUND"
}