Skip to main content

Trial and regular products in the same shopping cart

Trial and regular products in the same shopping cart

Last updated: 29-Feb-2024
Rate this article:

Overview

2Checkout supports scenarios in which you sell one or more regular products and offer one or more free/paid trials (with payment details - mandatory) in the same shopping cart to your customers.

Availability

All 2Checkout accounts.

Requirements

Products for which you're offering evaluation versions must meet the following criteria:

  • They must be free or paid trials for which you're collecting payment details from customers by using the Request payment details and customize your trial option.
  • They must support electronic delivery as the shipping class.
  • They can only be standalone offerings, not bundles.
  • They cannot match any of the regular products added to cart (Note: Customers won't be able to access the trial and purchase the regular version of a product using the same shopping cart session).

Scenarios covered

  • One product and one paid/free trial (with payment details) in the same cart;
  • Multiple products and one paid/free trial (with payment details) in the same cart;
  • One product and multiple paid/free trials (with payment details) in the same cart;
  • Multiple products and multiple paid/free trials (with payment details) in the same cart.

Use checkout.php trial links

Using the Sales Links area of the 2Checkout Control Panel, you can generate trial links such as the one below, which points to the trial.php page:

https://secure.2checkout.com/order/trial.php?PRODS=5566778&PAY_TYPE=CCVISAMC&PRICES5566778[USD]=0&TPERIOD=30&PHASH=1f24f5c938adf4c125ddfe67242d958a

Important: Trial links using the trial.php page cannot be used to build mixt regular product and trial links.

You need to build your own trial links, pointing to the checkout.php page, instead of trial.php, and use them to create mixt regular product and trial links.

checkout.php trial links

trial.php trial links

Build links using checkout.php

Trial links generated automatically use trial.php

Trial period is defined in the link using theTPERIOD[Product ID] parameter as such:TPERIOD[Product ID]=30

Trial period is defined in the link using the TPERIOD parameter as such: TPERIOD=30

HASH signature needs to be generated manually

HASH signature is generated automatically along with the link

Parameters required

Parameter

Info

Mandatory

Secret Key

The secret key is communicated to you when your account with 2Checkout is opened. You can always retrieve the secret key information from the "Account settings" section in the Control Panel (https://secure.2checkout.com/cpanel/account_settings.php). The secret key is listed in the Instant Payment Notification area (scroll down toward the bottom of the page).

The secret key is required to calculate the HMAC_SHA signature. A HMAC_SHA signature is calculated and applied to the request, using a BASE STRING in tandem with the SECRET KEY generated by 2Checkout (View secret key).

YES

PRODS

Product IDs for which the order will be processed, separated by comma (,), with no blanks. Example: PRODS=1234567,1234568. Each product added / imported into the 2Checkout platform is automatically assigned a system generated unique numeric (int) identifier. Example: Product ID = 1234567.

In the Control Panel, click to edit a product, and select theInformation tab. The Product ID of the item you're editing is available at the top of the General area under Information.Note: Product IDs are different than Product Codes, also available in this area, but which you control.

YES

PRICES[Product ID][Currency]

Required parameter to set the price for product default currency. For example, for a product with the 2Checkout product ID: 123456, the currency EUR, and the price 99.99, this parameter would look like: PRICES123456[EUR]=99.99. If not sent for other billing currencies, 2Checkout will convert based on the submitted default price.

YES (only for trials)

TPERIOD[Product ID]

Trial period must be at least 7 days. For example enter TPERIOD[Product ID]=7 for a 7-day trial, or TPERIOD[Product ID]=30 for a 30-day evaluation period. Needs to be used as in the following example: TPERIOD1234567=7, with 1234567 representing the product ID.

YES

PHASH

Required HMAC_SHA signature in order to prevent the request from being exploited.

YES

Build a checkout.php trial Buy Link

For this example, let's assume that we need a trial link for the evaluation version of a product with the ID 5566778. The trial is free and the evaluation period is 30 days. We'll use the parameters listed above.

As already mentioned, system-generated trial links via the Sales Links area of the 2Checkout Control Panel work only for scenarios in which the trial is also the only item in the shopping cart, but not for mixt regular product and trial scenarios. This is why links as the one below should not be used.

https://secure.2checkout.com/order/trial.php?PRODS=5566778&PAY_TYPE=CCVISAMC&PRICES5566778[USD]=0&TPERIOD=30&PHASH=1f24f5c938adf4c125ddfe67242d958a

Instead, you need to build another type of trial link, pointing to checkout.php, and using the PRODS, PRICES[Product ID][Currency], TPERIOD[Product ID] and PHASH parameters. In this specific case:

  • PRODS=5566778
  • PRICES5566778[USD]=0
  • TPERIOD5566778=30
  1. Using the parameters above, you get the following sequence PRODS=5566778&PRICES5566778[USD]=0&TPERIOD5566778=30
  2. Next, you need to prefix (prepend) the length of the character sequence to calculate the hash, namely 52. The resulting BASE STRING is 52PRODS=5566778&PRICES5566778[USD]=0&TPERIOD5566778=30
  3. For the purpose of this demo, let's assume that your secret key is SECRET_KEY.
  4. Use the secret key and the base string to calculate the HMAC-SHA HASH. The result (valid exclusively for this example) should be:
  • 6dd3bd013ee2d19782f16b734a98703e4c71abbea0c4058e7248fd6268229d43 (SHA2)
  • 878519d71a697d4b8829d351e59d4f8d46cc60f0c2e9ccc827c9af7fcbc7aae9 (SHA3)

 5.  Build your complete link, adding the following elements together for:

As such:

https://secure.2checkout.com/order/checkout.php?PRODS=5566778&PRICES5566778[USD]=0&TPERIOD5566778=30&PHASH=6dd3bd013ee2d19782f16b734a98703e4c71abbea0c4058e7248fd6268229d43

As such:

https://secure.2checkout.com/order/checkout.php?PRODS=5566778&PRICES5566778[USD]=0&TPERIOD5566778=30&PHASH=878519d71a697d4b8829d351e59d4f8d46cc60f0c2e9ccc827c9af7fcbc7aae9

Use this link in the process described below, under the Alternative work flow section.

Build mixt regular products and trial Buy Links

Mixt Buy Links containing both regular products and trials have to be created manually, and need to paint users directly to Checkout. Note: You offer shoppers the trial and regular versions of the same product in the same shopping cart.

Let's assume that you generated two build links, one for a regular product with ID 1234567 and a trial for a different product with the ID 5566778, just as in the examples below:

https://secure.2checkout.com/order/checkout.php?PRODS=1234567&CART=1&CARD=2
https://secure.2checkout.com/order/trial.php?PRODS=5566778&PAY_TYPE=CCVISAMC&PRICES5566778[USD]=0&TPERIOD=30&PHASH=ae929a5009ca5737d50c5f929d34650c

The steps required to build a mixt regular product and trial Buy Link are detailed below:

  1. Make sure that the mandatory information necessary to build the link is available, namely, the secret key for your 2Checkout account (necessary for the hash calculation), and the following parameters: PRODS, PRICES[Product ID][Currency] (along with its corresponding value, in this case the price of the trial version, that can be zero (0)), and TPERIOD[Product ID] (along with its corresponding value, in this case the duration of the evaluation period in days).
  2. You'll build the link from the https://secure.2checkout.com/order/checkout.php?, or https://secure.YourStore.com/order/checkout.php? In case you're using a custom domain.
  3. In this particular example, here is the list of parameters with their respective values:
    • PRODS=1234567,5566778
    • PRICES5566778 [USD]=0
    • TPERIOD5566778=30
  4. Using the parameters above, you get the following sequence PRODS=1234567,5566778&PRICES5566778[USD]=0&TPERIOD5566778=30. Next, you need to prefix (prepend) the length of the character sequence to calculate the hash, namely 60. The resulting BASE STRING is 60PRODS=1234567,5566778&PRICES5566778[USD]=0&TPERIOD5566778=30
  5. For the purpose of this demo, let's assume that your secret key is SECRET_KEY.
  6. Use the secret key and the base string to calculate the HMAC-SHA HASH. The result (valid exclusively for this example) should be: 
  • 849c5a6ff5e453600225ee675bd27037f81383c24769a2152eb4bf8e1a4bc6a9 (SHA2)
  • a815a304725c54ea0eac2fd7214f654bb8b6cd1ce2245ee65769d765745f3f7a (SHA3)

  7.  Build your complete link, adding the following elements together for:

As such:

https://secure.2checkout.com/order/checkout.php?PRODS=1234567,5566778&PRICES5566778[USD]=0&TPERIOD5566778=30&PHASH=849c5a6ff5e453600225ee675bd27037f81383c24769a2152eb4bf8e1a4bc6a9

As such:

https://secure.2checkout.com/order/checkout.php?PRODS=1234567,5566778&PRICES5566778[USD]=0&TPERIOD5566778=30&PHASH=a815a304725c54ea0eac2fd7214f654bb8b6cd1ce2245ee65769d765745f3f7a

Alternative workflow

To allow your customers to buy one or multiple products while also accessing free/paid trials in the same shopping cart (during the same browser session) follow these steps:

  1. Generate the buy link for the regular product(s). Use the links on the purchase call to action on your online shop, such as the Buy buttons.
  2. Build the trial links as per the example above. Use the links on the call to actions designed to enable access to trials on your online shop, such as the Download trial buttons.  Important: make sure your trial links use checkout.php and NOT trial.php, otherwise this alternative workflow would fail. Use this link in the process described below, under the Build a checkout.php trial Buy Link section.
  3. Shoppers will click on the buy link for a regular product and add it to the cart.
  4. Shoppers continue the purchase process and click on the link to download a trial.
  5. The trial gets added to the same shopping cart as the regular product, provided that the browser session is still valid.
  6. Shoppers go through the steps of the purchase process to acquire the regular product as well as access the trial added to cart.

Important: Trial links using the trial.php page cannot be used to build mixt regular product and trial links. This is because trial.php links open a new browser session and generate a new cart for shoppers. As such, when adding a trial on top of a regular product already in the cart, the trial would simply replace the offering. Vice versa, when adding a regular product on top of a trial already in the cart, the regular product would replace the trial.

Limitations

Important: make sure your trial links use checkout.php and NOT trial.php, otherwise this alternative workflow would fail. Use this link in the process described below, under the Build a checkout.php trial Buy Link section.

The following scenario is not supported: both the regular and the trial versions of a product added to the same shopping cart. Customers can buy a product or access its evaluation version, but not both simultaneously in the same cart.

Scenarios:

  1. Product A and Trial for Product A in the same cart
    • Customers add Product A to cart;
    • Customers add Trial for Product A to cart during the same browser session;
    • Result: Trial for Product A replaces Product A in the cart. Customers can access Trial for Product A but will need to buy Product A in a different shopping cart / via a new browser session.
  2. Trial for Product A and Product A in the same cart
    • Customers add Trial for Product A to cart;
    • Customers add Product A to cart during the same browser session;
    • Result: Product A replaces Trial for Product A in the cart. Customers can buy Product A but will need to access Trial for Product A in a different shopping cart / via a new browser session.

Promotions/discounts

Discount coupons for Regular and Multi-product promotions used by shoppers acquiring a regular product and accessing a trial in the same shopping cart will only impact the trial when the evaluation period comes to an end and it's converted to a full product. Essentially, discounts are offered to shoppers for the first transaction marking the conversion of the trial to a regular product, equivalent to a new purchase, and not when the trial is first accessed. If, following the evaluation period the trial is not converted to a regular subscription, no discount is offered.

Order promotions will discount the total value of the initial order containing both regular products and trials. Order promotion discounts will no longer impact the transaction associated with the conversion of the trial to a full product.

Payment methods

Shoppers that access trials while concomitantly purchasing regular products will be able to use a number of payment methods supporting recurring billing such as credit/debit cards, PayPal and DirectDebit. Trials are set to auto-renew by default, and customers can opt out of a purchase during the evaluation period in order to not be billed for the trial conversion to a regular subscription.

Auto-renewal

The auto-renewal option doesn't impact trials, which are set to auto-renew by default. You can manually cancel new subscription purchases before trial ends.

Up-selling and cross-selling campaigns

Up-selling and Cross-selling campaigns will be triggered only for the regular products added to cart, but not for the trials of such offerings.

Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo