" dynamic="no"} Language Libraries | Developer Documentation | 2Checkout
Language

2Checkout Documentation

Form

The checkout function provides you with several methods to pass the sale and the buyer to 2Checkout.

Method

form

Description

Use to create pass a sale to your custom checkout page.

Arguments

Returns

Returns an HTML form from the parameters passed in with your defined button text.

Example Usage:

var tco = new Twocheckout({
    sellerId: "1817037"
});

var params = {
    'mode': '2CO',
    'li_0_name': 'Test Product',
    'li_0_price': '0.01',
    'card_holder_name': 'Testing Tester',
    'email': 'no-reply@2co.com',
    'street_address': '123 test st',
    'city': 'Columbus',
    'state': 'Ohio',
    'zip': '43123',
    'country': 'USA'
};

var form = tco.checkout.form(params, 'Checkout');

Example Response:

<form id="2checkout" action="https://www.2checkout.com/checkout/purchase" method="post">
<input type="hidden" name="sid" value="1817037"/>
<input type="hidden" name="mode" value="2CO"/>
<input type="hidden" name="li_0_name" value="Test Product"/>
<input type="hidden" name="li_0_price" value="0.01"/>
<input type="hidden" name="card_holder_name" value="Testing Tester"/>
<input type="hidden" name="email" value="no-reply@2co.com"/>
<input type="hidden" name="street_address" value="123 test st"/>
<input type="hidden" name="city" value="Columbus"/>
<input type="hidden" name="state" value="Ohio"/>
<input type="hidden" name="zip" value="43123"/>
<input type="hidden" name="country" value="USA"/>
<input type="submit" value="Checkout" />
</form>