开发者

PayPal discount can't make it work

I'm trying to setup a discount for a the whole cart using PayPal + Codeigniter, I got this working withouth the discounts.

As far as I've read the only thing that I would need to do is set a hidden field discount_amount_cart as I saw here

Here is my form:

<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr" name="paypal_form">
     <input type="hidden" name="rm" value="2" />
     <input type="hidden" name="cmd" value="_cart" />
     <input type="hidden" name="upload" value="1" />
     <input type="hidden" name="currency_code" value="EUR" />
     <input type="hidden" name="business" value="biz_1271300483_biz@xxxx.xx" />
     <input type="hidden" name="return" value="http://xxxxxx.com/website/pt/paypal/success/8/4c237a03897e0" />
     <input type="hidden" name="cancel_return" value="http://xxxxxxx.com/website/pt/paypal/cancel/8/4c237a03897e0" />
     <input type="hidden" name="notify_url" value="http://xxxxxx.com/website/pt/paypal/ipn" />
     <input type="hidden" name="custom" value="" />
     <input type="hidden" name="no_shipping" value="1" />
     <input type="hidden" name="cpp_header_image" value="http://xxxxxxxxx.com/images/logo.png" />
     <input type="hidden" name="image_url" value="http://xxxxxxxxx.com/images/logo.png" />
     <input type="hidden" name="invoice" value="4c237a03897e0" />
     <input type="hidden" name="no_note" value="1" />
     <input type="hidden" name="discount_rate_cart" value="10.00" />
     <input type="hidden" name="first_name" value="Foo Bar" />
     <i开发者_开发知识库nput type="hidden" name="city" value="xxxx" />
     <input type="hidden" name="address1" value="xxxxxx" />
     <input type="hidden" name="zip" value="xxxxxx" />
     <input type="hidden" name="lc" value="pt" />
     <input type="hidden" name="email" value="xxxxx@xxx.pt" />
     <input type="hidden" name="country" value="PT" />
     <input type="hidden" name="item_name_1" value="Cloud Hosting WIN Business 25GB" />
     <input type="hidden" name="item_number_1" value="200.00000003" />
     <input type="hidden" name="amount_1" value="156" />
     <input type="hidden" name="quantity_1" value="1" />
     <input type="hidden" name="tax_rate_1" value="20" />
     <p><input type="submit" name="pp_submit" value="Pagar" class="submit" /></p>
    </form>

But when I "post" the fields the discount line won't appear, do I need to activate something in the merchant account, am I doing something wrong?

Cheers


Got it,

From the PayPal documentation:

When you use consolidated discount amounts, you should specify a consolidated tax value in tax_cart. If you do not specify a tax value and your profile specifies a tax rate, your profile tax rate is applied after the consolidated discount value is applied.

So I need to define my "global" tax amount for the cart with tax_cart.


The name of your discount input appears to be wrong:

<input type="hidden" name="discount_rate_cart" value="10.00" />

should be:

<input type="hidden" name="discount_amount_cart" value="10" />

Use discount_amount_cart to charge a single discount amount for the entire cart.

Use discount_amount_x to set a discount amount associated with item x

Use discount_rate_cart to charge a single discount percentage for the entire cart.

discount_rate_cart - Applies to entire cart however, this variable will only work with the "Upload" Method. Not the standard Add to Cart variables.

This variable will be ignored if you are including any individual sales tax amount or rate in your upload method code. This is because the sales tax needs to be calculated after the discount is applied to your items therefore, the discount is applied to the item Subtotal, not the Total.

Note, If you just using the standard Add to Cart buttons, there no Discount variables for the entire cart. as they "only" apply a Discount to an individual item.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜