Skip to content

Charge_Submit

Jacob McConnell edited this page Jun 9, 2014 · 2 revisions

To pass a sale to your custom checkout page, you can use one of the methods provided in the Charge class. This class provides you you with several methods to pass the sale and the buyer to 2Checkout.

##Method

###submit

Use automatically pass the buyer and sale to 2Checkout.

####Arguments

####Returns

Returns an HTML form from the parameters passed in and submits it automatically using Javascript.

####Example Usage:

params = {
    'sid': 1817037,
    'mode': '2CO',
    'li_0_name': 'Test Product',
    'li_0_price': 0.01
}

form = twocheckout.Charge.submit(params)

####Example Response:

<form id='2checkout' action='https://www.2checkout.com/checkout/spurchase' method='post'>
<input type='hidden' name='li_0_name' value='Test Product' />
<input type='hidden' name='li_0_price' value='0.01' />
<input type='hidden' name='mode' value='2CO' />
<input type='hidden' name='sid' value='1817037' />
<input type='submit' value='Proceed to Checkout' />
</form>
<script type='text/javascript'>document.getElementById('2checkout').submit();</script>
Clone this wiki locally