CodeIgniter Forums

Full Version: paypal discount amount
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I wonder if anyone can shed some light on a problem Im having,
paypal seems not to want to take a discount amount when Im passing the variables over,
takes the discount_rate_cart variable but I cant seem to get it to accept the discount_amount_cart and I cant see any problem.

$config['discount_amount_cart'] = 2.99; //Discount amount [2.99]
        $config["discount_rate_cart"]     = 5; //Discount percentage [5]

percentage rate works fine but the cart amount discount wont pass over, anyone know wat Im missing?

any help would be great Wink

[edit to add]
Im using this paypal library for codeigniter
* Paypal Class
* @package CodeIgniter
* @subpackage Libraries
* @category Payment process
* @author Romaldy Minaya
if anyone else is using a paypal library with codeigniter and can use the discount_amount_cart I'd quite like to know which paypal library works ok and if there have been any issues with passing a discount amount (not a percentage as that seems fine)
I was reading on paypals deleloper site that tax_cart might cause the discount to be dismissed, but even with the tax_cart set to 0 it makes no difference.
As for as I can see, there are no issues with my code, paypal seems to just ignore the discount_amount_cart and I cant see why, Im stumped to be honest, there doesnt seem to be any reason why it isnt being passed over to payal, or not one I can see.
I've been using codeigniter for years now, it isnt a codeigniter problem as such, either Im missing something or the library has a problem or paypal are ignoring the variable, I can figure out where the problem is.

I've found the same issue with open cart and oscommerce when searching for a solution, nothing relevant to CI or the library Im using, anyone else able to pass a discount amount to paypal without problems?
no one has came across this problem before, no? and no one has connected their cart to paypal, no?

ok a wee bit more info,

I've written a CMS / shopping cart system with CI 2.1.x (cant quite remember the version I started on) upgraded to 2.2.0 without any problems, using the paypal library by Romaldy Minaya
its a bit old but its nice and simple and has been fine in the past.

I decided to write a discount module for it, quantity discounts, discount vouchers etc,
I've been using the same paypal library for a while, the only problem Im getting is passing the set discount amount to paypal, percentages are working perfectly, a set amount gets ignored, eg a £2.99 discount off the whole cart gets ignored where a 10% discount will pass over perfectly.
I probably could just convert the amount into a percentage `to get round the problem, would be a lot easier if it would just take the variable via discount_amount_cart
My code is fine, even hard coding a value in for testing purposes doesnt do anything, Im getting no errors any where, the value just isnt being used.

No reason for it that I can see (I've written a perfectly working CMS using codeigniter, Im not new to this Wink )

I have seen the same problem on the prestashop forums, but it wasnt relevant to my code, so their fix wasnt any use. Open cart has had the same proble too so it could be a problem at paypals end, some one else must have had this issue using CI, and if not, some one here must be using paypal without problems, no?

A pointer to a paypal library that does work would be great Wink
it would save me time chasing a problem that doesnt seem to exist and give others a pointer to a paypal library that is bug free Smile
Maybe you should check with the author of the library, or see if the version hosted on GitHub has any updates compared to the version you are currently using.
that was the first thing I did, along with a fair bit of research to see if the same problem had popped up anywhere else which it has, but their fix isnt right for my code, posting here is the very last resort Wink
after a fair bit of poking about,
wpcommerce had this issue, so have ebay merchants, magento, prestashop, open cart, cube cart and others.

here is a quote

Quote: If you are trying to use discount_rate_cart or discount_amount_cart and are also passing an individual tax amount for each line item (e.g. tax_1), then the discounts are ignored by PayPal.

To get the cart wide discount applied you need to either pass no tax information at all or only pass the tax_cart parameter.

If you want to pass individual tax amounts then you have to use the discount_amount_x or discount_rate_x parameters for each line item.

Not particularly intuitive, and also not mentioned in the PayPal Payments Standard HTML variable reference....

best to strip out all extra variables, tax, discount_rate_cart and anything else your cart isnt using
DO NOT set values to zero or leave blank, they will cause any discounts to be ignored, regardless if they have nothing to do with the discounts.

given the amount of carts this problem has been reported on, Im seriously surprised that no one here has came across this problem

anyway, there's the fix (sort of)

I'm glad you were at least able to find a work-around, even if it doesn't look like a good long-term solution.

Honestly, it's one feature on one API for PayPal (out of at least 10 possible PayPal APIs). Even if there are a lot of other people using that API and that feature, the chances of one of those people not only noticing the issue, but also browsing this forum and reading this thread in the ~24 hours since you posted it are pretty slim.
a slim chance on a forum for a framework that quite alot of people use to build shopping carts with?

ok, fair enough.

Thanks for your input Wink