TrueGate Integration

Connect Truegate's embedded checkout (card, Apple Pay, Google Pay, PayPal), import product plans as web2wave prices, and track subscriptions from Truegate webhooks.

Why Truegate

Truegate is a payment system with its own subscription billing engine and an embedded browser SDK. Buyers pay on your paywall and stay in the funnel. Card fields, Apple Pay, Google Pay and PayPal show inline. Truegate charges renewals. web2wave keeps the status of each subscription in sync from Truegate webhooks.


Before you start

  • A Truegate merchant account with a live project. For tests, also a sandbox project.
  • Subscription product plans in the Truegate dashboard for each plan that you sell (period, price, currencies, trial).
  • Reference: Truegate API docs.

Integration guide

Part 1 – Get credentials in Truegate

1: In the Truegate dashboard, open your project. Copy these values for the live project and for the sandbox project:

  • Project ID (projectId, a UUID)
  • Project Key (projectKey): the secret that web2wave uses to sign each API request
  • Tenant slug: the part of your Truegate API host between public-api. and .truegate.tech. For example, for public-api.acme.truegate.tech, the tenant slug is acme. The sandbox host has the form public-api.<tenant>.test.truegate.tech.

Part 2 – Connect Truegate to web2wave

2: In web2wave, open Projects → [your project] → Payments. Enable Truegate.

3: Complete Production Keys and Sandbox Keys with the values from Part 1: Project ID, Project Key (HMAC secret) and Tenant slug. During tests, you can complete only the sandbox column.

Truegate keys in web2wave project settings

4 (optional): In Properties to send to Metadata, list the user properties to send with each payment as Truegate metadata. Write one property on each line:

LineWhat is sent
zip_codethe user property zip_code, under the same name
utm_source=sourcethe user property utm_source, renamed to source
tier==premiumthe static value premium under the key tier

Truegate returns the metadata in payment webhooks. web2wave always adds its own web2wave_* keys (user, project, price, paywall, quiz). You do not need to list them.

Properties to send to Truegate metadata

5: Copy the Webhook URL. It has the form https://<your-project>.web2wave.com/truegate/webhook. You need it in Part 3.

Webhook URL and the event types web2wave handles

6: Click Save.


Part 3 – Set up the webhook in Truegate

7: In the Truegate dashboard, add the Webhook URL from step 5 to both your live and sandbox projects. One URL works for both environments. web2wave finds the environment from the projectId in each delivery.

web2wave handles these events automatically:

Truegate eventSubscription in web2wave
PAYMENT_SUCCESSone-time or first subscription payment recorded
SUBSCRIPTION_ACTIVATED, SUBSCRIPTION_RECURRENT_PAYMENT, SUBSCRIPTION_REACTIVATEDactive (or trialing)
SUBSCRIPTION_DUNNING_PERIODpast due
SUBSCRIPTION_CANCELEDcancellation scheduled; access lasts until the end of the paid period
SUBSCRIPTION_DEACTIVATED, SUBSCRIPTION_DEACTIVATED_BY_REFUND, SUBSCRIPTION_REFUNDEDcanceled
REFUNDrefund recorded (failed refunds are only logged)
📘

Truegate does not sign webhooks. web2wave accepts a delivery only if its projectId matches the live or sandbox Project ID in your project settings.


Part 4 – Plans and prices

8: In web2wave, open Plans & Prices. Click Import Plans & Prices. Select Truegate as the payment system. Start the import. web2wave imports active product plans from your live and sandbox Truegate projects:

  • Amount and currency: the All countries price of the plan (country ALL) becomes the primary currency and amount. If the plan has no such row, web2wave uses the first price. web2wave adds the other prices of the plan to Additional Currencies with their countries. web2wave also reads the paid-trial amount from the All countries trial row.
  • Billing period from the plan.
  • Trial: a free trial becomes trial days; a paid trial becomes an intro phase.

You can also create a price manually. Put the Truegate plan UUID into the External code of the price. Then the amount, currency and period must match the plan in Truegate.

⚠️

You manage trials in Truegate. In web2wave, you cannot edit the trial of a Truegate price. Change the trial in the Truegate product plan. Then import again.

9: One-time (lifetime) prices do not need a Truegate plan. web2wave starts a one-time payment with the amount and currency of the price.


Part 5 – Build the paywall

10: In the paywall Settings, set Main Payment system to Truegate.

11: Add the Truegate Form block. It shows the payment methods that are enabled in your Truegate project. First it shows the Apple Pay, Google Pay and PayPal buttons. Then it shows the card form (cardholder name, card number, expiry date, CVC) with a pay button. If a method is not available on the buyer's device or in your project, the form hides it automatically.

Block settings:

  • Submit Button Text: the label of the card pay button (default Pay).
  • Hint Text: optional small text under the form.
  • Email field (show / hide): adds an email input to the form. If the email is known (from the quiz or the customer_email link parameter), the form fills it as read-only.
  • ZIP / postal code field (show / hide): adds a ZIP input. If the ZIP is known, the form fills it. To show the field only for some countries, use Conditional Logic on this setting. For example: user_location.country_code in US, CA → show.
  • Payment Failed Actions: what happens when a payment fails: open a popup (for example, a discount offer) or run a JS callback. To react to all errors, keep Error code empty. You can also list codes:
Error codeWhen
PAYMENT_CANCELthe buyer closed the Apple Pay, Google Pay or PayPal window
PAYMENT_ERROR, FAILEDthe payment was declined or failed
INIT_ERRORthe checkout did not load
SUBMIT_ERRORthe card form was not submitted
CARDHOLDER_REQUIREDthe buyer clicked pay without a cardholder name

After a declined payment, the form reloads automatically. The buyer can try again or select another method.

12: Buyer's email. When the checkout loads, web2wave sends the buyer's email to Truegate. web2wave takes the email from the customer_email parameter of the paywall link. If it is not there, web2wave uses the email user property, for example from the email screen of your quiz. Collect the email before the paywall. Then web2wave has it when the checkout loads.

13: Local currency. To show prices in the visitor's currency, enable Auto Currency Switching in the paywall settings. See Multicurrency and Auto Currency Switching.

Truegate charges the buyer in the currency that the paywall shows. For subscriptions, web2wave can also send the visitor's country to Truegate. It does this if the plan has a price row for that country in the shown currency. Then Truegate uses that row, not the All countries row. If the price has no amount in the visitor's currency, Truegate uses the primary currency.


Collecting email or ZIP on the paywall

The simplest way is the Email field / ZIP / postal code field settings of the Truegate Form (see Part 5). When they are on, the checkout starts only when all shown fields are valid. It starts again when the buyer edits the fields. Until then, the card fields and wallet buttons are hidden. web2wave saves the values as the email and zip user properties. It sends the ZIP to Truegate metadata as web2wave_zip.

If you collect email or ZIP on a separate screen, read the next section.

web2wave creates the Truegate checkout when the paywall loads, also if the checkout is in a popup. It creates it again when the buyer selects another price. At that moment, the email and metadata become fixed. Your paywall can collect email or ZIP on its first screen and show the Truegate Form in a popup. In this case, add this script to the custom JS of the paywall. The script starts the checkout again when the popup opens, after web2wave saves the entered values:

(function () {
  var EMAIL_PROPERTY = 'email';
  var ZIP_PROPERTY = 'zip_code'; // must be listed in "Properties to send to Metadata"
  var ALWAYS_RESTART = false;    // true = new checkout on every popup open

  var SAVE_URLS = ['/api/analytic/user/property_set', '/api/analytic/user/properties_set_bulk'];
  var pendingSaves = 0;
  var waiters = [];
  var lastUsed = null;

  function isPropertySave(settings) {
    var url = String((settings && settings.url) || '');
    return SAVE_URLS.some(function (u) { return url.indexOf(u) !== -1; });
  }

  $(document).ajaxSend(function (e, xhr, settings) {
    if (isPropertySave(settings)) pendingSaves++;
  });
  $(document).ajaxComplete(function (e, xhr, settings) {
    if (!isPropertySave(settings)) return;
    pendingSaves = Math.max(0, pendingSaves - 1);
    if (pendingSaves === 0) waiters.splice(0).forEach(function (fn) { fn(); });
  });

  function savesSettled(timeoutMs) {
    return new Promise(function (resolve) {
      if (pendingSaves === 0) return resolve();
      waiters.push(resolve);
      setTimeout(resolve, timeoutMs);
    });
  }

  function currentKey() {
    var p = window.user_properties || {};
    return String(p[EMAIL_PROPERTY] || '').trim().toLowerCase() + '|' + String(p[ZIP_PROPERTY] || '').trim();
  }

  w2w.onEvent('Paywall Popup open', async function (props) {
    var selector = props && props.value;
    if (!selector || !$(selector).find('#truegate-form').length) return;

    await new Promise(function (r) { setTimeout(r, 0); });
    await savesSettled(5000);

    var key = currentKey();
    if (!ALWAYS_RESTART && key === lastUsed) return;
    lastUsed = key;

    var priceId = localStorage.getItem('price_id');
    if (priceId && typeof window.selectPriceId === 'function') {
      window.selectPriceId(priceId);
    }
  });
})();
  • Before the popup opens, the fields on the first screen must be saved as user properties (email and, for example, zip_code).
  • Truegate gets the ZIP as metadata, not as a billing address.
  • A customer_email parameter in the paywall link has priority over the entered email.

Upsells

web2wave charges after-pay upsells in one click to the card of the subscription. The buyer does not enter card details again. Truegate has no API to start a new subscription on a saved card. Thus web2wave charges each upsell as a one-time payment of the upsell price amount, also if that price is a subscription. If the upsell price has an amount in the currency of the original subscription, web2wave charges in that currency. If not, it charges in the primary currency of the price. One-time purchases, such as token packs, work without changes.


Cancellations and refunds

  • From web2wave (cabinet or the Subscription cancel API): web2wave cancels the subscription in Truegate, immediately or at the end of the period. Then it updates the status.
  • From Truegate (dashboard or Truegate API): Truegate sends a webhook. web2wave updates the status automatically.
  • If your app changes the status only in its own database, Truegate and web2wave do not know about it. Billing continues.
  • You cannot undo a cancellation at the end of the period from web2wave. Undo it in the Truegate dashboard.
  • Refunds from web2wave are full refunds only.

Notifying your backend

Truegate webhooks go to web2wave. To get purchases, renewals and cancellations in your backend, add a web2wave webhook with the Subscription updated type. Add it in Project settings → API & Webhooks. web2wave sends it for subscriptions and one-time purchases, including upsells. The webhook contains the web2wave user_id. It can also contain all user properties. See Webhook Documentation.


Testing

  1. Complete Sandbox Keys. Import plans. web2wave imports sandbox plans as test prices.
  2. Attach test prices to the paywall. Open the paywall. The checkout runs in the Truegate test environment.
  3. To check another currency or country, add ?currency=eur or ?w2w_country_code=DE to the paywall link.
  4. After a test payment, check that the subscription shows in Subscriptions.

Limitations

  • Webhooks are not signed. web2wave accepts them by projectId.
  • Only full refunds.
  • You cannot reactivate a scheduled cancellation from web2wave.
  • web2wave always charges upsells as one-time payments.
  • The Truegate Form has no billing address field. You can send extra data only as metadata.