v1

latestOpenAPI 3.0.32026-07-248519153.1 KB

Create a subscription

Create a subscription record in the current project. Unique constraint applies to the combination of (payment_system, pay_system_id, real_payment, project_id).

post/subscription

Request body

payment_systeminteger required

Payment system ID. Known values: 0 = Stripe, 1 = Paddle, 2 = CloudPayments, 3 = PayPal, 4 = Primer, 5 = Hubx, 6 = Solidgate, 7 = Unlimit, 8 = Custom. Use 8 (Custom) for subscriptions created outside integrated payment systems (e.g. manual or custom gateways).

real_paymentboolean

Production mode (true) or test mode (false).

pay_system_idstring required

ID of the subscription in external payment system.

quiz_idstring nullable
paywall_idstring nullable
plan_idstring required
amountnumber required

Amount in cents.

currencystring required
canceled_atstring date-time nullable
cancel_at_period_endboolean
customerstring required
statusstring required
user_idstring
user_emailstring email nullable
next_charge_datestring date-time nullable
last_charge_datestring date-time nullable
charges_countinteger
total_revenueinteger
price_idinteger nullable
user_visit_idstring nullable
projected_revenue_32dinteger nullable

Projected revenue over 32 days (e.g. in cents).

projected_revenue_62dinteger nullable

Projected revenue over 62 days (e.g. in cents).

projected_revenue_184dinteger nullable

Projected revenue over 184 days (e.g. in cents).

projected_revenue_367dinteger nullable

Projected revenue over 367 days (e.g. in cents).

created_atstring date-time nullable
updated_atstring date-time nullable

Response

Subscription created successfully.

successinteger

Example response

{
  "success": 1,
  "data": {
    "id": 3064,
    "user_id": "c1409762-d624-4a47-a330-2a21d108b681",
    "user_email": "xxxxxa@gmail.com",
    "user_visit": {
      "id": "cd6e3a40-fffe-4cf1-9432-124fcf8a4322",
      "ip": "2804:14d:7894:9a05:750d:93bb:91ee:6ce",
      "url": "https://quiz.example.com/learn-language",
      "user_id": "4f935f81-8620-4d6a-b3b7-4738e933e3f2",
      "created_at": "2025-04-21T17:37:04Z",
      "project_id": "589",
      "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 18_3_2 like Mac OS X) AppleWebKit/605.1.15",
      "visit_number": 1,
      "user_language": "en",
      "user_platform": "iOS",
      "is_first_visit": 1,
      "user_city_name": "Santo André",
      "user_state_code": "SP",
      "first_visit_date": "2025-04-21T17:37:04Z",
      "user_country_code": "BR",
      "previous_visit_date": "1970-01-01T00:00:00Z",
      "utm_source": "facebook_w2w",
      "utm_medium": "paid",
      "utm_campaign": "Wiser_Facebook_iOS_WW_PT_Web_ASC_w2w_Purchase_160425_Language_LearnEnglish_PT_Web2wave",
      "utm_content": "120219538872100620",
      "utm_term": "120219538872190620",
      "utm_ad_id": "120219538872100620",
      "utm_adset": "Wiser_Facebook_iOS_WW_PT_Web_ASC_w2w_Purchase_160425_Language_LearnEnglish_PT_Web2wave Ad set",
      "utm_adname": "873 v1 PT",
      "utm_adset_id": "120219538872190620",
      "utm_id": "120219538872090620",
      "fbclid": "PAZXh0bgNhZW0BMABhZGlkAasbCOfpPCwBp7Pjd0fj0I4Iq6wMoxpwfPY56ByjnwtDEdd_Akfl6UyZRpvJDsdjhQrDatOb_aem_X4VgON_xZ-6GXC2H3_NI6w"
    },
    "created_at": "2024-10-09 14:05:11",
    "updated_at": "2024-10-09 14:05:11",
    "payment_system_label": "Stripe",
    "real_payment": 1,
    "pay_system_id": "sub_1Q80ViCsRq5tBi2bvRlKAnIG",
    "project_domain": "quiz.xxxxx.ai",
    "quiz_id": "130",
    "quiz_name": "ADHD Adult - Paywall 2",
    "paywall_id": "170",
    "paywall_name": "ADHD Adult Paywall 2 - GBP",
    "price_id": "price_1Q7OS9CsRq5tBi2byY4Bhz3J",
    "amount_real": 29.99,
    "currency": "gbp",
    "customer": "cus_R00WzLF0qD7IF8",
    "status": "active",
    "next_charge_date": "2024-11-09 14:05:06",
    "last_charge_date": "2024-10-09 14:05:06",
    "charges_count": 1,
    "phases_num": 1,
    "total_revenue": 1799,
    "projected_revenue_32d": 2999,
    "projected_revenue_62d": 4999,
    "projected_revenue_184d": 9999,
    "projected_revenue_367d": 14999,
    "updated_by_api_date": "2026-02-05 12:30:45",
    "manage_link": "https://billing.stripe.com/p/login/xxx",
    "price": {
      "id": 708,
      "plan_id": 17,
      "external_id": "price_1Q7OS9CsRq5tBi2byY4Bhz3J",
      "currency": "gbp",
      "amount": "2999",
      "period": "month",
      "period_interval": 1,
      "trial_period_price": "1799",
      "discount_duration_in_billing_periods": "1",
      "amount_real": 29.99,
      "discount_percent": 40.01333777925976,
      "amount_real_with_discount": 12,
      "price_option_text": "17.99 gbp / 1 month => 29.99 gbp / 1 month",
      "plan": {
        "id": 17,
        "project_id": 5,
        "payment_system": "stripe",
        "external_id": "prod_PsKBa7ceF91lMm",
        "name": "xxxx Subscription",
        "livemode": true,
        "created_at": "2024-06-18T19:30:23.000000Z",
        "updated_at": "2024-10-07T22:25:31.000000Z"
      }
    }
  }
}