Coupon Code For Paypal Express Checkout

Eray picture Eray · Feb 27, 2011 · Viewed 23.5k times · Source

I'm using Paypal Express Checkout system on my website. But I want to put a coupon (discount) code area. It will make a reduction if code is true. (Like GoDaddy.com's cart system)

Have you any idea, where should I start for this?

(I'm not using any eCommerce framework)

Answer

Tlacaelel Ramon Luis picture Tlacaelel Ramon Luis · Feb 14, 2013

I know this is an old thread but wanted to put here my experience for others looking for the same thing, and maybe this did not apply then but it does apply now, at least on the sandbox meaning I have not tested this in a real transaction

When adding items that you send to paypal you basically send this

L_PAYMENTREQUEST_0_QTY0 = 1

L_PAYMENTREQUEST_0_AMT0 = 1.00

L_PAYMENTREQUEST_0_NAME0 = my item 0 name

L_PAYMENTREQUEST_0_NUMBER0 = myitem0id

Then we add another item

L_PAYMENTREQUEST_0_QTY1 = 1

L_PAYMENTREQUEST_0_AMT1 = 1.00

L_PAYMENTREQUEST_0_NAME1 = my item 1 name

L_PAYMENTREQUEST_0_NUMBER1 = myitem1id

And now we add the coupon

L_PAYMENTREQUEST_0_QTY2 = 1

L_PAYMENTREQUEST_0_AMT2 = -0.50

L_PAYMENTREQUEST_0_NAME2 = my coupon name

L_PAYMENTREQUEST_0_NUMBER2 = mycouponcode

And then we add the subtotal and total values

PAYMENTREQUEST_0_AMT = 1.50

AMT = 1.50

What I think paypal does is ads up all item totals so it would do for this order something like

1.00+1.00-0.50 = 1.50

Then compares it to your total amounts

if they match then it is a go, the customer sees this as an extra item, but obviously with the minus sign, this picture below is from a paypal sandbox express checkout transaction

Paypal express checkout transaction with coupon code