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

2Checkout Documentation

Submit

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

Method

Submit

Use to automatically pass the buyer and sale to 2Checkout.

Arguments

  • Dictionary parameters
    • Dictionary composed of sale parameters.  Parameters -> Parameter Sets

Returns

Returns an HTML form from the parameters passed in and submits it automatically using a line of JavaScript.

Example Usage:

var dictionary = new Dictionary();
dictionary.Add("sid", "1817037");
dictionary.Add("mode", "2CO");
dictionary.Add("li_0_type", "product");
dictionary.Add("li_0_name", "Example Product");
dictionary.Add("li_0_price", "1.00");

String PaymentForm = ChargeService.Submit(dictionary);

Example Response:

<form id="2checkout" action="https://www.2checkout.com/checkout/spurchase" method="post">
<input type="hidden" name="sid" value="1817037" />
<input type="hidden" name="mode" value="2CO" />
<input type="hidden" name="li_0_type" value="product" />
<input type="hidden" name="li_0_name" value="Example Product" />
<input type="hidden" name="li_0_price" value="1.00" />
</form>
<script type="text/javascript">document.getElementById('2checkout').submit();</script>