Skip to main content
knowledgecenter.2checkout.com

ConvertPlus Buy-Links Signature for Dynamic Products

Generate custom links

You can generate links for dynamic products outside the cPanel, using the ConvertPlus parameters explained in this article. Some of the ConvertPlus buy-link parameters require a signature, to prevent any interference in the ordering process. Optional parameters also require a signature if they are included in the generated buy-link.

ConvertPlus parameters that require a signature:

Parameter Description
return-url URL to which customers are redirected after their finalized purchase. Learn more about Redirect URL on this article.

return-type

The return method used for redirecting your customers after a successful sale. Possible values:

  • Link in the Thank You page
  • Header Redirect
expiration

Buy link expiry date. The link becomes invalid after the date from this parameter. Send as a UTC timestamp.

Example: 

1537549421 

order-ext-ref Use this parameter to set an external reference to the order.
item-ext-ref Set product identifier for your dynamic products. You can send multiple values separated by semicolon ;. 
customer-ref The 2Checkout system generates default customer numerical (integer) IDs automatically for all orders of products that feature subscriptions. Can be used for new acquisitions aggregating new subscriptions under an existing Customer account.
customer-ext-ref The external customer reference.
currency Preselected billing currency 2Checkout uses to charge your customers.
prod

The name of the dynamic product. For multiple products, send them separated by a semicolon.

Example: name1;name2;name3.

price

For dynamic products, enter the product price.

For multiple dynamic items, send the values separated by a semicolon.

Example: price1;price2;price3.

qty

The number of units (quantity) for each product in checkout, separated by a semicolon;. Do not use spaces or blanks. Example: qty=2;1.

qty works in conjunction with prod, based on their respective order. The first value of the qty parameter controls the number of units for the products whose identifier is in the first position of the prod parameter. 

Example: https://secure.2checkout.com/checkou...rchant=2COLNC&prod=6FD08E61B5;E2932D0DE2&qty=4;3

tangible

Boolean.

Send TRUE or 1 for products that require physical delivery.

type

The type of dynamic product. Possible values:

  • product
  • shipping
  • tax

If type is empty or not send, the default line item is considered product.

For multiple dynamic items, send the values separated by a semicolon.

opt Defines the product pricing options.

 

URL formating rules:

 

":" is considered a pair separator

  • 1 product with 1 price option with 1 value (includes scale option type)
    • prod=code1&opt=gr1:val1
  • 1 product with 1 price option with multiple values
    • prod=code1&opt=gr1:val1:val2

 

"," is considered a value separator

  • 1 product with 2 price options with 1 value each
    • prod=code1&opt=gr1:val1,gr2:val2
  • 1 product with 2 price options with multiple values each
    • prod=code1&opt=gr1:val1:val2,gr2:val3:val4

 

";" is considered a parameter separator between products

  • 2 products with 1 price option containing 1 value
    • prod=code1;code2&opt=gr1:val1;gr2:val2
  • 2 products with 1 price option containing multiple values
    • prod=code1;code2&opt=gr1:val1:val2;gr2:val3:val4
  • 2 products with 2 price options containing 1 value each
    • prod=code1;code2&opt=gr1:val1,gr2:val2;gr3:val3,gr4:val4
  • 2 products with 2 price options containing multiple values each
    • prod=code1;code2&opt=gr1:val1:val2,gr2:val3:val4;gr3:val5:val6,gr4:val7:val8
description For dynamic products, set a description that is displayed in the checkout page. The description field is displayed only for the 'One column with payment buttons' template. The description will not be visible in the default template.
recurrence

For dynamic products, set product recurring options.

Send multiple dynamic items separated by a semicolon.

Example: period1:unit1;period2:unit2;

 

Possible values for units:

  • DAY
  • WEEK
  • MONTH
  • YEAR
  • FOREVER

*This parameter is conditioned by two other parameters: duration and renewal-price.

duration For dynamic products, set the duration of the recurrence.
renewal-price For dynamic products, set the price that should be applied to the renewal order.
lock

You can define customized packages or products for your shoppers and increase consistency and reconciliation between internal reporting, considering the details available at checkout and the ones valid when placing the order.

 

This action can be done by using the 'lock' buy-link parameter which must be included in the signature along with other parameters that could impact the price: coupon, currency, lock, prod, qty, opt.

When the cart is locked, the coupon field will not be visible anymore and the shoppers will not be able to add coupons to the cart.

 

To enable, add the lock parameter to the generated buy-link, set it to 1 (lock = '1') and sign it.

ConvertPlus parameters to be included in the signature

  1. General parameters included in the signature, regardless of the type of checkout (catalog products, dynamic products, renewal, unfinished payment): return-url, return-type, expiration, order-ext-ref, item-ext-ref, customer-ref, customer-ext-ref, lock.
  2. Parameters to be included in the signature for dynamic products buy-links: currency, prod, price, qty, tangible, type, opt, description, recurrence, duration, renewal-price.
  3. Parameters to be included in the signature for manual renewal buy-links: prod, qty, opt.
  4. Parameters to be included for on-the-fly pricing for catalog products: prod, priceqty, opt, coupon.
  5. Parameters to be included when an approved URL is set: in this case, all parameters will be included in the signature, when redirected after successful completion of a sale.

Build the ConvertPlus signature

To sign a ConvertPlus buy-link, you need to follow these steps:

  1. Sort the parameters that require a signature alphabetically.
  2. Serialize the parameters append to them the length of their values.
  3. Concatenate the resulting values.
  4. The serialized value is then encrypted with your Buy Link Secret Word using the HMAC method (algorithm sha256).
  5. The resulting value is added to the buy link under the signature parameter

Example

Let's consider the following parameters:

  •     merchant = 'MCODE'
  •     dynamic = '1'
  •     prod = 'Software'
  •     price = 10
  •     currency = 'USD'
  •     qty = 1
  •     tangible = 0
  •     type = 'product'
  •     expiration = 1575676800

The regular buy-link will have the following structure:

https://www.2checkout.com/checkout/buy?merchant=2COLRNC&dynamic=1&prod=Software&price=10currency=USD&qty=1&tangible=0&type=&expiration=1537549421 

This link is missing one last parameter, a signature.

Let's take a look at the list of parameters that require a signature:

  •     merchant = '2COLRNC'
  •     dynamic = '1'
  •     prod = 'Software' <-- SIGNATURE REQUIRED
  •     price = 10        <-- SIGNATURE REQUIRED
  •     currency = 'USD'        <-- SIGNATURE REQUIRED
  •     qty = 1             <-- SIGNATURE REQUIRED
  •     tangible = 0         <-- SIGNATURE REQUIRED
  •     type = 'product'         <-- SIGNATURE REQUIRED
  •     expiration = '1575676800' <-- SIGNATURE REQUIRED

We extract only those parameters:

  •     prod = 'Software'
  •     price = 10
  •     currency = 'USD'
  •     qty = 1
  •     tangible = 0
  •     type = 'product'
  •     expiration = 1575676800

Sort the parameters alphabetically

  •     currency = 'USD'
  •     expiration = 1575676800
  •     price = 10
  •     prod = 'Software'
  •     qty = 1
  •     tangible = 0
  •     type = 'product'

Serialize the values

To serialize a value, you need to prepend to it the number of letters or digits a value has. For example, the currency parameter has the 'USD' value that will be serialized as '3USD', where 3 is the number of letters that make up the value. The value of the price parameter is '10', so the serialized value will be '210', where 2 is the number of digits that make up the value.

In case a value uses special characters, to serialize it, you need to prepend to it the number of bytes in the string, also known as the UTF-8 string length. To count the bytes in the string, you can use an online bytes counter. For example, if the prod parameter has the 'ελληνικά' value, this will be serialized as '16ελληνικά' and not as '8ελληνικά', due to the use of special characters, where '16' is the number of bytes in the string.

  •     currency = '3USD'
  •     expiration = 101575676800  
  •     price = 210
  •     prod = '8Software'
  •     qty = 11
  •     tangible = 10
  •     type = '7product'

Concatenate the values

    '3USD1015756768002108Software11107product'

Encrypt using your Secret Word

The serialized value is then encrypted using the HMAC method.
    - the algorithm used is sha256
    - the key used when encrypting is the merchant secret word (in this example, the secret word is 'secret_word')

This outputs a 64 character string:

d996084beebab4b7c95e6e484ea076789f26b89d415487b9c62a57babc158152

Add the string in the buy-link

https://secure.2checkout.com/checkout/buy?merchant=2COLRNC&dynamic=1&prod=Software&price=10&currency=USD&qty=1&tangible=0&type=product&expiration=1575676800&signature=d996084beebab4b7c95e6e484ea076789f26b89d415487b9c62a57babc158152
  • Was this article helpful?