Paypal

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Paypal

Post by tecktalkcm0391 »

I am so confused on how to do a PayPal checkout with PHP. With the Standard version, can I (or can I not) set it up so that there is no need to have a page just to go click here to pay with a bunch of hidden fields of info to pass to PayPal? Also, can I send a user to there site to the page that they just enter their credit card, not the page where it advertises "Make or login to Paypal!" with the little "Continue" for not making an account. Finally, can I send a gift certificate number (one made through paypal) to paypal, and do they really need an account to do so?
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

No. Users don't need any account to make order in your site.
In your site you just put the form:

Code: Select all

<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" value="_xclick" name="cmd"/>
<input type="hidden" value="your@business.name" name="business"/>
<input type="hidden" value="1" name="no_shipping"/>
<input type="hidden" value="0" name="tax"/>
<input type="hidden" value="25.00" name="amount"/>
<input type="hidden" value="USD" name="currency_code"/>
<input type="hidden" value="US" name="lc"/>
<input type="hidden" value="Gift Certificate" name="item_name"/>
<input type="hidden" value="CHCAL" name="item_number"/>
<input type="hidden" value="http://www.yoursite.com/return.php" name="return"/>
<input type="hidden" value="http://www.yoursite.com/cancel.php" name="cancel_return"/>
<input type="hidden" value="http://www.yoursite.com/notify.php" name="notify_url"/>
<input type="hidden" value="1" name="custom"/>
<input type="submit" value="Pay"/>
</form>
After user submit this form he will go to paypal site where he just have to fill his billing information and credit card.
As I remember it's possible to create paypal account if you (customer) use paypal very often, but it isn't required.

Also you can try to use PayPal API
https://www.paypal.com/IntegrationCente ... ource.html
User avatar
Technocrat
Forum Contributor
Posts: 127
Joined: Thu Oct 20, 2005 7:01 pm

Post by Technocrat »

If you want to experiment you can go to http://www.sandbox.paypal.com and signup

Then change:
https://www.paypal.com/cgi-bin/webscr
to:
https://www.sandbox.paypal.com/cgi-bin/webscr

Now you can test all you want without using real accounts.

The only way to verify that a purchase sent through 100% is by using IPN, which is sort of a pain.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Thanks! But when I sent the form to the paypal website, it shows really big "Login to paypal" on the left. and only a small link to continue with a credit card.
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

Try to click 'buy' on this site for example.
http://www.markelsoft.com/html/buy_using_paypal.html
Do you see the same page?
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Gente wrote:Try to click 'buy' on this site for example.
http://www.markelsoft.com/html/buy_using_paypal.html
Do you see the same page?
Nope. :( I need it the way I have it because its a shopping cart, and all of the items are being forwarded to Paypal

I am using "_cart" for the "cmd" value, should I be using something else?
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

tecktalkcm0391 wrote:I am using "_cart" for the "cmd" value, should I be using something else?
So you didn't ever try my example...
Try to use it and find out what is the difference.
For example I propose '_xclick' as value of 'cmd'.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

Gente wrote:
tecktalkcm0391 wrote:I am using "_cart" for the "cmd" value, should I be using something else?
So you didn't ever try my example...
Try to use it and find out what is the difference.
For example I propose '_xclick' as value of 'cmd'.
I didn't try it, because it was using a buy button. I didn't think it was going to do the shopping cart. I'm trying it now... :oops:

EDIT: It didn't work, it gave me "Please provide an amount and click Update Totals." on paypal's site..
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

Oh... And in my example you sure couldn't find it... :evil:
Post Reply