Charge existing user with saved payment method

Changed on

Charges a user based on the selected web2wave price ID. Can initiate subscriptions and do one-time upsells. Supported for existing users with a saved payment method on Stripe or Solidgate.

Solidgate 3-D Secure (3DS)

Solidgate 1-click upsells may require cardholder authentication. To support 3DS 2.0, pass the browser fingerprint fields below (header_accept, header_accept_language, browser_*, time_zone_offset) together with success_url / fail_url for post-authentication redirects.

The User-Agent header of the API request is forwarded automatically; you do not need to send it in the body.

If 3DS is required, the response returns success: true with a verify_url. Redirect the customer to that URL to complete payment verification. After authentication, Solidgate redirects the customer to success_url or fail_url, and the final order status is delivered via webhook.

post/subscription/user/charge

Request

  • Base URL
    https://api.web2wave.com/api
  • URL
    https://api.web2wave.com/api/subscription/user/charge
  • Auth
    API key in header api_key

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 the payment provider 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 or Solidgate before returning the result.

Important: Enabling this option may increase the total API response time to up to 30 seconds. Not applicable when the response includes verify_url (3DS required) — redirect the user first, then poll subscription status after authentication.

header_acceptstring

Solidgate only. Actual content of the browser Accept HTTP header. Required for Solidgate 3DS 2.0. Example source: window.w2w_accept_page or the request Accept header.

header_accept_languagestring

Solidgate only. Browser language from navigator.language (IETF BCP 47 recommended). Required for Solidgate 3DS 2.0.

browser_color_depthinteger

Solidgate only. Screen color depth from screen.colorDepth. Required for Solidgate 3DS 2.0.

browser_screen_heightinteger

Solidgate only. Screen height in pixels from screen.height. Required for Solidgate 3DS 2.0.

browser_screen_widthinteger

Solidgate only. Screen width in pixels from screen.width. Required for Solidgate 3DS 2.0.

browser_java_enabledboolean

Solidgate only. Whether the Java plugin is enabled (navigator.javaEnabled()). Required for Solidgate 3DS 2.0.

time_zone_offsetinteger

Solidgate only. Timezone offset in minutes relative to UTC, as -new Date().getTimezoneOffset(). Required for Solidgate 3DS 2.0.

success_urlstring uri

Solidgate only. URL where the customer is redirected after successful 3DS authentication / payment. Recommended when you expect a possible 3DS challenge.

fail_urlstring uri

Solidgate only. URL where the customer is redirected after failed 3DS authentication / payment. Recommended when you expect a possible 3DS challenge.

Example request

{
  "user_id": "ab503db9-80f5-4bdb-9cc4-5ed882f8642a",
  "price_id": 22057,
  "header_accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
  "header_accept_language": "en-US",
  "browser_color_depth": 24,
  "browser_screen_height": 900,
  "browser_screen_width": 1440,
  "time_zone_offset": -180,
  "success_url": "https://example.com/payment/success",
  "fail_url": "https://example.com/payment/fail"
}

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.

verify_urlstring uri nullable

Solidgate only. Present when 3-D Secure authentication is required. Redirect the customer to this URL to complete payment verification. After authentication, Solidgate redirects to success_url or fail_url. Final payment/subscription status arrives via webhook — do not treat the charge as completed until then.

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_92d": 6499,
    "projected_revenue_184d": 9999,
    "projected_revenue_279d": 12499,
    "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",
  "verify_url": "https://pay.solidgate.com/api/v1/secure/3ds/..."
}

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the optional property / to the response with the status

    • info

      added the optional property / to the response with the status

    • info

      added the optional property to the response with the status