问题
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?
回答1:
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.
Example:
<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>
回答2:
2Checkout Answers
- If you are not completing your test sales, or you are not clearing your cookies in between each test, you will observe inconsistent results when testing.
- You will need to make sure that your browser's cookies are cleared after every test to avoid these issues.
- If the user is sent to the 2Checkout payment page, then it should be reviewed to identify any missing or empty fields that are marked "required" - this will indicate that you did not pass in all the required details, and your site's form must then be updated to pass in the missing details.
Note: State & Zip code are also required for some countries, I do not know what is the list so I let the users fill them anyway before I open the 2Checkout popup.
来源:https://stackoverflow.com/questions/22808388/2checkout-inline-checkout-redirects-to-the-full-checkout-page-for-some-countries