I'm using 2Checkout's inline checkout option for one of our applications. It's working fine most of the time, but for some reason it redirects to the full checkout page instead of showing the popup when certain countries are selected.
Here is an example form which should display the popup, but redirects instead:
<form accept-charset="UTF-8" action="https://www.2checkout.com/checkout/purchase" id="2checkout" method="post">
<input id="sid" name="sid" type="hidden" value="<our 2CO SID>" />
<input id="mode" name="mode" type="hidden" value="2CO" />
<input id="merchant_order_id" name="merchant_order_id" type="hidden" value="<some order ID>" />
<input id="li_0_product_id" name="li_0_product_id" type="hidden" value="1" />
<input id="li_0_name" name="li_0_name" type="hidden" value="Test Product" />
<input id="li_0_price" name="li_0_price" type="hidden" value="5" />
<input id="li_0_recurrence" name="li_0_recurrence" type="hidden" value="1 Month" />
<input id="li_0_duration" name="li_0_duration" type="hidden" value="Forever" />
<input id="card_holder_name" name="card_holder_name" type="hidden" value="Attila Horvath" />
<input id="street_address" name="street_address" type="hidden" value="Test Line 1" />
<input id="street_address2" name="street_address2" type="hidden" value="Test Line 2" />
<input id="city" name="city" type="hidden" value="Test City" />
<input id="state" name="state" type="hidden" value="Test State" />
<input id="zip" name="zip" type="hidden" value="1234" />
<input id="country" name="country" type="hidden" value="Virgin Islands, British" />
<input id="email" name="email" type="hidden" value="test@example.com" />
<input id="phone" name="phone" type="hidden" value="123456" />
<input type="submit" />
</form>
<script src="https://www.2checkout.com/static/checkout/javascript/direct.min.js"></script>
If I change the country to e.g. Germany, it works as expected. I double checked and we're passing the country names exactly as they appear in the 2CO country list (so we're using "Virgin Islands, British" instead of "British Virgin Islands").
So why are certain countries handled differently?
Direct Checkout is not coming up because the country is not recognized. If you use the 3 digit country code "VGB", it will work properly.
<form accept-charset="UTF-8" action="https://www.2checkout.com/checkout/purchase" id="2checkout" method="post">
<input id="sid" name="sid" type="hidden" value="532001" />
<input id="mode" name="mode" type="hidden" value="2CO" />
<input id="merchant_order_id" name="merchant_order_id" type="hidden" value="<some order ID>" />
<input id="li_0_product_id" name="li_0_product_id" type="hidden" value="1" />
<input id="li_0_name" name="li_0_name" type="hidden" value="Test Product" />
<input id="li_0_price" name="li_0_price" type="hidden" value="5" />
<input id="li_0_recurrence" name="li_0_recurrence" type="hidden" value="1 Month" />
<input id="li_0_duration" name="li_0_duration" type="hidden" value="Forever" />
<input id="card_holder_name" name="card_holder_name" type="hidden" value="Attila Horvath" />
<input id="street_address" name="street_address" type="hidden" value="Test Line 1" />
<input id="street_address2" name="street_address2" type="hidden" value="Test Line 2" />
<input id="city" name="city" type="hidden" value="Test City" />
<input id="state" name="state" type="hidden" value="Test State" />
<input id="zip" name="zip" type="hidden" value="1234" />
<input id="country" name="country" type="hidden" value="VGB" />
<input id="email" name="email" type="hidden" value="test@example.com" />
<input id="phone" name="phone" type="hidden" value="123456" />
<input type="submit" />
</form>