v1

latestOpenAPI 3.0.32026-07-248519153.1 KB

Charge existing user with saved payment method

Charges a user based on the selected web2wave price ID. Can initiate subscriptions and do one-time upsells. Can be requested for existing user with Stripe payment.

post/subscription/user/charge

Request body

user_idstring required

GUID of the user to be charged

price_idinteger required

Internal Web2Wave price ID to be charged

subscription_idinteger

Internal Web2Wave subscription ID. This subscription ID will be used to find the specific subscription from which the payment data will be received. If not filled in, the data will be retrieved from the user's last active subscription.

wait_subscriptioninteger

Sometimes, Stripe delays sending webhooks, which may result in the subscription field being empty in the API response. To increase the likelihood of receiving a response with the subscription field populated, set this field to 1. When enabled, the system will wait up to 20–25 seconds for a response from Stripe before returning the result.

Important: Enabling this option may increase the total API response time to up to 30 seconds.

Example request

{
  "user_id": "ab503db9-80f5-4bdb-9cc4-5ed882f8642a",
  "price_id": 22057
}

Response

Success or failure response

successboolean
messagestring
subscription_idstring
is_onetime_paymentboolean
link_for_user_subscriptionstring
already_existedboolean

If true, the subscription already existed for this user and price. If false or absent, the subscription was just created.

Example response

{
  "success": true,
  "message": "One-time payment processed successfully",
  "subscription_id": "ch_3RAIHkAg4LBBeMre1AOgNtoL",
  "subscription": {
    "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"
      }
    }
  },
  "is_onetime_payment": true,
  "link_for_user_subscription": "https://stage.app.web2wave.com/api/user/subscriptions?user=ab503db9-80f5-4bdb-9cc4-5ed882f8642a"
}