2Checkout Integration

rss

Posted by [email protected] - Nov 17 ’16 at 07:24

I'd like to trigger a payment collection after the completion of a form.

2Checkout Inline Checkout seems like a good canidate for this. They provide a hosted checkout which is triggered in an iframe as modal-style popup above an existing page.

As per their documentation (https://www.2checkout.com/documentation/checkout/inline-checkout), integration should be as simple as loading their js library, then loading the correct parameters into this block:

<form action='https://www.2checkout.com/checkout/purchase' 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='invoice123' />|
<input type='hidden' name='li_0_price' value='25.99' />
<input type='hidden' name='card_holder_name' value='Checkout Shopper' />
<input type='hidden' name='street_address' value='123 Test Address' />
<input type='hidden' name='street_address2' value='Suite 200' />
<input type='hidden' name='city' value='Columbus' />
<input type='hidden' name='state' value='OH' />
<input type='hidden' name='zip' value='43228' />
<input type='hidden' name='country' value='USA' />
<input type='hidden' name='email' value='[email protected]' />
<input type='hidden' name='phone' value='614-921-2450' />
<input name='submit' type='submit' value='Checkout' />
</form>

Assuming that all the required parameters can be queried from the new Sharepoint entry, how can I passthrough values and trigger this function upon submission of a new item in SPForm?

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 2 months 10 days
    #1 by Dmitry Kozlov Nov 18 ’16 at 02:16

    Hello,

    As I can see there is an option to pass parameters to 2CO via query string: https://www.2checkout.com/documentation/seller-area/plug-and-play-cart/integration/

    So, what you can do. Insert the following code into the new form:

    fd.onsubmit(function(){
    	fd.sourceFormParam("/Redirect.aspx?sid=" + fd.field('SID').value() + "&mode=" + fd.field('Mode').value());
    	return true;
    });
    

    Next, insert JS-code into Redirect.aspx that redirects to https://www.2checkout.com/checkout/purchase with query params:

    window.location = "https://www.2checkout.com/checkout/purchase" + window.location.search;
  • Member
    Member for: 5 years 13 days
    #2 by [email protected] Dec 1 ’16 at 02:31

    Thanks so much for the reply.

    Using a redirect would work if that was the only feasible way to accomplish this, but I'd really like to use the inline checkout if at all possible (see https://www.2checkout.com/demo?method=inline). That way the entire transaction can be completed without leaving the sharepoint site.

    Any ideas for how to accomplish this?

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 8 years 2 months 10 days
    #3 by Dmitry Kozlov Dec 2 ’16 at 04:20

    [#2]: Well, then you can redirect users from a SharePoint form to another SharePoint page and pass all the required parameters in the quesry string. In that page, put a checkout form and populate it automatically with values from the query string. You can even submit it with code.

  • Goldyy6
    Member
    Member for: 2 months 19 days
    #4 by Goldyy6 Nov 11 ’21 at 03:48

    When you order your paper with us, we will ensure you receive top-quality work from a native English speaking paper writer ( https://grademiners.com/ ) who has been hand-picked and trained by our award-winning managing editor.

Displaying 1 to 4 of 4 messages