0

I'm trying to implement coupon discounts.

The problem I run at is, that, although Paypal recognizes that a discount is requested, it ignores it. The interesting part is, that Paypal displays one amount to the buyer, but charges another. How is that possible?

Please check out the screenshots below:

enter image description here

You can clearly observe, that the coupon is being applied, and the amount to be charged is 3,20 GBP.

However, when user proceeds, he is charged 4,00 GBP, the full amount:

enter image description here


Here are the values of the corresponding NVP string (just before curl_exec() is called) sent to Paypal:

METHOD=SetExpressCheckout
VERSION=76.0
PWD=*something*
USER=e-shop_api1.somesite.com
SIGNATURE=somesignature

ReturnUrl=http%3A%2F%2Fwww.example.com%2Fcheckout.php%3Faction%3Dnotify
CANCELURL=http%3A%2F%2Fwww.example.com%2Fshopping-bag%2F
PAYMENTACTION=Sale
CURRENCYCODE=GBP
PAYMENTREQUEST_0_CURRENCYCODE=GBP
ALLOWNOTE=1
PAYMENTREQUEST_0_SHIPPINGAMT=0.00
PAYMENTREQUEST_0_AMT=3.20
PAYMENTREQUEST_0_ITEMAMT=3.20

// Product
L_PAYMENTREQUEST_0_QTY0=1
L_PAYMENTREQUEST_0_AMT0=4
L_PAYMENTREQUEST_0_NAME0=Some+Item+-+SIZE+%2F+1+size
L_PAYMENTREQUEST_0_NUMBER0=THE+PRODUCT+02355

// Coupon
L_PAYMENTREQUEST_0_QTY1=1
L_PAYMENTREQUEST_0_AMT1=-0.80
L_PAYMENTREQUEST_0_NAME1=Coupon

TL;DR

Why does Paypal display one amount, and charge another, and how to fix this?

Alex Lomia
  • 6,705
  • 12
  • 53
  • 87

1 Answers1

0

It's likely that the total amount in the DoExpressCheckoutPayment API request was set to 4 like this PAYMENTREQUEST_0_AMT=4, so user was charged as the value passed. Maybe you can post the request of DoExpressCheckoutPayment API so I can take a look?

yihui
  • 236
  • 1
  • 1
  • I've updated the NVP string's data. Please check it out. Also, please bear in mind, that the values are extracted **right before** `curl_exec(..)` is called. – Alex Lomia Feb 21 '17 at 08:58
  • The NVP string in your post shows the request of SetExpressCheckout API `METHOD=SetExpressCheckout`, which will return you a token and payer will be redirected to PayPal to authenticate the payment, then redirect back to the ReturnUrl that you set in the Set call. The payer is NOT charged at this point until you call DoExpressCheckoutPayment API, in which the amount is probably set to "4". PayPal charges the amount value passed in DoExpressCheckoutPayment regardless of the amount in SetExpressCheckout. – yihui Feb 23 '17 at 08:53
  • Yeah, that was my mistake that I found out the hard way. I think you really should include that information into the answer for future users – Alex Lomia Feb 24 '17 at 09:22