We’ve migrated our documentation to a new site, which means some URLs have changed.
Subscriptions

How to start checkout without choosing a Term from the Offer template

Sometimes you might need to start checkout with a predetermined term ID, where there are no options presented to the customer and they go directly to the checkout page. This can be used in cases, where you would like to create your own custom HTML/CSS page where you want to simply call our function for checkout when some conditions are going to be met. For example, the checkout process can be initiated by clicking a custom image.

This simple snippet does exactly that:

tp.offer.show({
offerId: "OFJ3CX6P8GM3",
templateId: "OTW5K72ON43I",
termId: "TMF350BOQO5Q",
});

When you define only 1 term ID, our function will provide no other options for the user and therefore, the step where the user is going to select the term from the offer is going to be skipped. The user will be transferred immediately to the checkout page with the predefined term ID.

When you'll want to show the user a list of several terms, you can simply replace the term ID with multiple term IDs, as an array of terms. This would look like this:

["termId1","termId2","termId3"],

More information about showing offers using JavaScript, you can review the following documentation.

Last updated: