paypal integration issue

前端 未结 2 690
别跟我提以往
别跟我提以往 2021-01-14 03:38

I cannot figure out what I am doing wrong with my code, I get the error

\"We have detected a problem with this shopping cart. If the problem persists, please contac

相关标签:
2条回答
  • 2021-01-14 04:00

    I had the same Problem, but when I have added a line it solved

    <input type="hidden" name="add" value="1">
    

    you can try it. I am not sure is this is the correct solution or not.

    0 讨论(0)
  • 2021-01-14 04:16

    I see quite a few problems:

    1. You are using 'undefined_quantity' which is only used with buy now buttons.
    2. You are trying to do a cart upload button but doing the variables incorrectly (you enumerate with '_x', not just 'x' appended to the var name. I will post code below.
    3. You are missing a required '_cart' button parameter. Cart buttons always have either 'add=1' (add to cart), 'display=1' (view cart, overrides add), and 'upload=1' (upload, for sending multiple items at once).
    4. Your cancel return URL does not have 'http://' which is required with PayPal.
    5. PayPal only accepts 'floats' or amounts in two decimal place precision.
    6. Along with #5, I'm guessing your 'tax' value is supposed to be a percentage, and not the actual amount. For this, you would use 'tax_rate' for percents. Use 'tax_cart' if you know the exact tax for the total of all items in the cart.

    See button code for a cart upload button below:

    <form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_cart">
    <input type="hidden" name="upload" value="1">
    <input type="hidden" name="business" value="example@example.com">
            <!-- Begin First Item -->
    <input type="hidden" name="quantity_1" value="1">
    <input type="hidden" name="item_name_1" value="Item A">
    <input type="hidden" name="item_number_1" value="Test SKU A">
    <input type="hidden" name="amount_1" value="0.01">
    <!--<input type="hidden" name="shipping_1" value="0.01">
    <input type="hidden" name="tax_1" value="0.02">-->
            <!-- End First Item -->
            <!-- Begin Second Item -->
    <input type="hidden" name="quantity_2" value="1">
    <input type="hidden" name="item_name_2" value="Test Item B">
    <input type="hidden" name="item_number_2" value="Test SKU B">
    <input type="hidden" name="amount_2" value="0.02">
    <!--<input type="hidden" name="shipping_2" value="0.02">
    <input type="hidden" name="tax_2" value="0.02">-->
            <!-- End Second Item -->
            <!-- Begin Third Item -->
    <input type="hidden" name="quantity_3" value="1">
    <input type="hidden" name="item_name_3" value="Test Item C">
    <input type="hidden" name="item_number_3" value="Test SKU C">
    <input type="hidden" name="amount_3" value="0.03">
    <!--<input type="hidden" name="shipping_3" value="0.03">
    <input type="hidden" name="tax_3" value="0.03"> -->
            <!-- End Third Item -->
    <input type="hidden" name="currency_code" value="USD">
    <!--<input type="hidden" name="tax_cart" value="5.13"> -->
    Upload <br>
    <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_cart_SM.gif" border="0" name="upload" alt="Make payments with PayPal - it's fast, free and secure!" width="87" height="23">
    </form>
    

    You should check for the variables PayPal supports for Website Payments Standard (buttons) here.

    0 讨论(0)
提交回复
热议问题