ConvertPlus Buy-Link signature for catalog products
Overview
Use signed buy-links to override the configured price of a catalog product at checkout. The signature prevents tampering with the price and other parameters passed as query strings.
The buy link signature is an HMAC-SHA256 hash computed from a subset of URL parameters using your **Buy Link Secret Word** (you can find this in the Merchant Control Panel) as the key. Any parameter listed as *signed* below must be included in the hash if it is present in the URL.
The merchant parameter is never signed.
Buy-link URL format
The buy-link URL should have the following format:
https://secure.2checkout.com/checkout/buy?merchant=MERCHANT_CODE&prod=PRODUCT_CODE&qty=QTY&price=CURRENCY:AMOUNT¤cy=CURRENCY&signature=SIGNATUREParameters
merchant
Required
No
Your merchant code.
prod
Required
Yes
Catalog product code. Multiple products: semicolon-separated (`prod=CODE1;CODE2`).
qty
Required
Yes
Quantity. Multiple products: semicolon-separated (`qty=1;2`).
currency
Required
Yes
ISO 4217 currency code (e.g. `USD`, `EUR`).
opt
Optional
Yes
Pricing option codes, semicolon-separated.
coupon
Optional
Yes
Coupon code.
lock
Optional
Yes
Set to `1` to prevent the customer from modifying the cart.
return-url
Optional
Yes
Redirect URL after a successful purchase. Use the unencoded URL when computing the signature.
return-type
Optional
Yes
Redirect method: `redirect` (header redirect) or `link` (link on thank-you page).
expiration
Optional
Yes
UTC Unix timestamp after which the link is no longer valid.
order-ext-ref
Optional
Yes
External order reference.
customer-ref
Optional
Yes
Numeric customer ID.
customer-ext-ref
Optional
Yes
External customer reference (e.g. email).
customer-lock
Optional
Yes
Set to "1" to lock all pre-filled billing/delivery information and route shoppers directly to the order review page. When set to "1", the following parameters need to also be included in the signature:
customer-ref
or
customer-ext-ref
or
billing fields
email
name
phone
country
state
city
address
address2
zip
company-name
fiscal-code
tax-office
delivery fields
ship-email
ship-name
ship-phone
ship-country
ship-state
ship-city
ship-address
ship-address2
Price format
For catalog products, the `price` parameter must embed the currency code as a prefix: price=USD:100
For multiple currencies on the same product, separate pairs with a comma: price=USD:100,EUR:90,GBP:80.
For multiple products, separate per-product price definitions with a semicolon: price=USD:100,EUR:90;USD:50,EUR:45.
Using a plain numeric value (e.g. `price=100`) without the currency prefix will result in an Empty cart error.
renewal-price is not a valid parameter for catalog products. It is only available for dynamic products (dynamic=1). To set a renewal price for a subscription catalog product, you must configure it in the product settings in the Merchant Control Panel.
Signature algorithm
Follow these steps to generate the signature:
Collect signed parameters - Take only the parameters marked as *Signed* that are present in your URL. Skip any that you are not using.
Sort alphabetically by parameter name: currency, expiration, lock, opt, order-ext-ref, price, prod, qty, return-type, return-url, etc.
Serialize each value by prepending the character length of the value to the value itself:
ValueSerializedUSD
3USD
USD:100
7USD:100
VQHKBLQNXW
10VQHKBLQNXW
1
11
Concatenate all serialized values by joining them into a single string (no separator).
Compute HMAC-SHA256 by using your Buy Link Secret Word as the key.
Append to URL - Add the resulting 64-character hex string as the `signature` parameter.
Example
Parameters
merchant
2COLRNC
No
prod
E2932D0DE2
Yes
qty
1
Yes
price
USD:100
Yes
currency
USD
Yes
Step-by-step
Signed parameters, sorted alphabetically: currency = USD price = USD:100 prod = E2932D0DE2 qty = 1
Serialized values: USD → 3USD USD:100 → 7USD:100 E2932D0DE2 → 10E2932D0DE2 1 → 11
Concatenated string: 3USD7USD:10010E2932D0DE211
HMAC-SHA256 (with secret word `secret_word`): <64-character hex signature>.
Final URL:
Example with general parameters
merchant
2COLRNC
No
prod
E2932D0DE2
Yes
qty
1
Yes
price
USD:100
Yes
currency
USD
Yes
return-type
redirect
Yes
expiration
1893456000
Yes
Sorted signed parameters: currency, expiration, price, prod, qty, return-type, return-url.
Concatenated serialized string: 3USD101893456000 7USD:10010E2932D0DE2118redirect22https://www.example.com.
For `return-url`, use the raw, unencoded URL in the signature even if it is percent-encoded in the final URL.
Code sample
Python
Javascript - (Browser — Web Crypto API)
Validating your signature
Use the Signature Generation API endpoint to generate a signature server-side and compare it against your own implementation. The API uses the Buy Link Secret Word configured in your merchant account.
Troubleshooting
Empty cart
Invalid signature
Verify serialized string.
Empty cart
Wrong price format (`price=100`)
Use `price=USD:100`.
Empty cart
`renewal-price` used with a catalog product
Remove it; set it in the Merchant Control Panel
Empty cart
Wrong secret key
Use Buy Link Secret Word, not API/INS key.
Wrong price displayed
Currency mismatch
Match `currency` param with prefix in `price`.
Last updated
Was this helpful?