PDA

JOIN THE FORUM LOUNGE!

By Joining The Forum Lounge you will be able to see the pictures in this thread and post a reply. Also, after 25 posts you'll be able to see the hidden forums as well!

It's free and all of your information is confidential.

Click here to begin interacting!
Click here to register

Join in on this Discussion and see the pictures. Click here-> : PayPal coupon code


Manntis
05-16-2006, 12:09 PM
The paypal forum is close to useless - all I get is "paypal doesn't support that right now" but what I'm looking for is not something on PayPal's end but to develop a php script that'll send the appropriate info to paypal.

I built a website with retail prices on products in a catalogue generated by php and a MySQL database. The regular price, $price1, is what the site owner is contractually obligated to advertise.

The site wants to offer coupon discounts for group buys, wholesale transactions, etc. giving a second price, $price2.

What I want to do is have an entry form near the 'add to cart' button that would allow people to enter an alphanumeric coupon code. The code would be checked against the dbase of valid codes and, if it's good, $price is assigned the discounted value of $price2 before being sent to the PayPal shopping cart. If it's an invalid code, or no coupon code is entered, $price is assigned the higher retail value of $price1.

Global is off for security reasons, but I can use GET to recapture the value.

Cosby
05-16-2006, 12:57 PM
That's pretty simple to do. I wouldn't have expected much help from paypal's forums though. It sounds pretty straight forward. Create a DB with customer info, coupon code and value of the coupon. Then check coupons against the db with some sort of antibrute function in there. If it matches, subtract the coupon value from price1 and submit to paypal via api.

Manntis
05-16-2006, 03:17 PM
It's in the coupon code entry and variable value passing that I'm hitting a snag. Once the code is obtained, checking against the dBase and assigning the value to $price is relatively easy.

I can't get the coupon code to pass through as a temporary global without having the user enter the code then reload the page, which is cumbersome and inelegant. And even when that occurs, the variable doesn't reliably pass through - it shows up as a blank value (even though 2 other variables reliably pass through using the GET function)

Cosby
05-17-2006, 12:26 PM
I must totally misunderstand what you're doing. Why does it need to be a global? Why can't it just submit on the way to the next page in the checkout?

Manntis
05-17-2006, 11:51 PM
because there is no 'next page' - the user enters the code, the page refreshes and checks the code against the dBase. If the code is valid, it assigns $price2 to $price, then sends the value of $price to PayPal. If not, it assigns $price1 to $price, then sends the value of $price to paypal

JOIN THE FORUM LOUNGE!

By Joining The Forum Lounge you will be able to see the pictures in this thread and post a reply. Also, after 25 posts you'll be able to see the hidden forums as well!

It's free and all of your information is confidential.

Click here to begin interacting!
Click here to register