2Checkout sales are placed by the buyer through our secure checkout. You can pass the buyer to our Standard Checkout or for a more seamless integration, you can display the payment form on your website using our Inline Checkout. You can easily customize the look and feel of the Standard Checkout page or Inline Checkout form using our Custom Checkout feature. By integrating with either checkout option, you automatically become PCI compliant as all sensitive card details are handled by us on our Level 1 PCI compliant servers. (Please Note: Our Inline Checkout option is presented in an iframe so we recommend that you use an SSL certificate on your checkout page. This way the buyer will be able to see that they are on a secure connection.) Integration can be completed by using our Pass Through Products parameters (Supports Inline or Standard Checkout) or our Plug and Play cart solution (Standard Checkout Only). Our Pass Through Products parameter set provides the highest level of flexibility and thus is recommended as it allows you to dynamically pass in both recurring and non recurring product, shipping, tax and coupon lineitems. When using our Plug and Play cart, you must create your products, coupons and shipping methods (if applicable) in the seller area before a sale can be passed in. This solution is best suited if you prefer to manage all of your products on our end and would like to utilize our generated buy buttons/links for each product to copy and paste into the HTML on your website./

Creating a Sale

You can initiate a new sale from your website or application by creating an HTML form or link to pass the buyer and sale parameters from your website to our checkout URL.

Example Form

<form action='' method='post'>
  <input type='hidden' name='sid' value='1303908' />
  <input type='hidden' name='mode' value='2CO' />
  <input type='hidden' name='li_0_type' value='product' />
  <input type='hidden' name='li_0_name' value='Monthly Subscription' />
  <input type='hidden' name='li_0_price' value='1.00' />
  <input type='hidden' name='li_0_recurrence' value='1 Month' />
  <input name='submit' type='submit' value='Checkout' />

The buyer will then be able to enter their billing information and complete the checkout process using their preferred currency and payment method. Please review our Pass Through Products documentation for more information and in depth examples.

Handle the Passback

When the sale is completed, we will return the buyer and sale parameters back to the approved URL that you defined. The approved URL can be defined at the account level (under the Site Management tab), at the product level (Plug and Play products only) or at the sale level (by passing in the x_receipt_link_url parameter). This way you can validate the passback and display your confirmation to the buyer. If no approved URL is defined, the buyer will be presented with a default order confirmation page providing an order summary, as well as a confirmation indicating that the payment is being processed.

Example Passback Validation

$hashSecretWord = 'tango'; //2Checkout Secret Word
$hashSid = 1303908; //2Checkout account number
$hashTotal = '1.00'; //Sale total to validate against
$hashOrder = $_REQUEST['order_number']; //2Checkout Order Number
$StringToHash = strtoupper(md5($hashSecretWord . $hashSid . $hashOrder . $hashTotal));
if ($StringToHash != $_REQUEST['key']) {
  $result = 'Fail - Hash Mismatch';
} else {
  $result = 'Success - Hash Matched';
echo $result;

Each of our community supported libraries provides a binding to validate the hash on the passback to your approved URL.