Award Winning eCommerce Specialist
Posted by Andrew Angell on Nov 4, 2011 in Blog, PayPal, PayPal, PHP, Videos | 46 comments
This video is a quick demonstration of how to use the Angell EYE PHP Class Library for PayPal.
Is it possible to integrate to a Zend framework project?
Sure. It’s an object-oriented class library, so you can use it within any other framework you want. For example, I have a version specific to CodeIgniter. I’ve been meaning to make one specific to Zend but just haven’t had the time. I’m sure you can do it without much effort, though, or even just use it as-is within a Zend project.
have u shared the codeigniter one?
I don’t have a video for it specifically, but I have shared the CodeIgniter version of the PayPal library.
Hey Thanks for this Its really helping me out. Your the Best!
No problem. Glad it’s working for ya!
this is a great lib!
but i have one problem with ‘setExpressCheckout’ and parallel payments.
testing only in sandbox.
it always show the error : “Instant Update API callback is not supported for parallel payments.”
but i dont set callback
There must be something in your request data that’s causing it to include those in the call to PayPal. If you want to send me a sample of the page you’re working with I’ll take a look and let you know what the problem is.
I have sent you the link to the code per contact form.
I really want to use your class in drupal CMS. For this i have to make a custom module for the same.
Can you give me an idea about how i use this script for PayPal adaptive payments…means which exact files i have to call for the same to process chained based payment. I have downloaded your script from php classes.org but there are so many files. I want to use process PayPal adaptive payments so please mentioned the required files which i need to integrate.
Please help me
Thanks in advance
For Adaptive Payments you’ll just the Pay API, so the Pay.php file is really all you’ll need to work with other than filling in your credentials in the config.php file.
Let me know if you have troubles and I’m happy to help further.
Thanks for the class!
Is this project somewhere on github?
I just have some optimalization that you might want.
No problem, glad you like it. It’s not Github yet. I’ve been meaning to get it up there but I just haven’t learned enough to Git yet to make it work well for me. If you want to send me your adjustments I’ll take a look and maybe add them to my original stuff. Eventually I will indeed get it on Github.
I have been trying to figure out the GetBasicPersonalData.php file, but all it ever returns is
[Errors] => Array
 => Array
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 500000
[Message] => Internal Error
[Severity] => Error
[Subdomain] => Application
This is in sandbox, could you tell me how to use this one
I think I may have missed a step in the headers being sent for these Permissions API calls. Unfortunately, the documentation links for Permissions at x.com are returning 404 not found right now, so I can’t look to see what it might be.
I’ll update here again once I get more info on what could be going on here. You might also want to submit a ticket to MTS at http://www.paypal.com/mts. You can provide the XML request and response (which the library makes available to you) and they can help us figure out what’s going wrong with it.
Please delete my last message, now I know how to work with your class aleady My I ask you how we solve those problem below:
- Credit card doesn’t have enough money to pay for orders
- Credit card has an invalid account number
- Credit card has been expired date
- Credit card has an invalid security digits
In any of those situations the API would simply return an error that the payment failed. Address verification and CVV data can be adjusted in your Fraud Management Filters within your PayPal account.
Hope that helps.
Hi, my compliments for your great Job with this class. It helped me a lot to setup my mind about how to integrate paypal in ecommerce solutions.
I have a point of discussion. Using your class for a setExpress Checkout action Method. I’ve found that on the very first call on setExpressCheckOut a Notice will be displayed on line 1481. Saying thet “TOKEN” index is not defined in the HASH used to set up the redirect URL:
Here’s my changes to manage the notice.
if(isset($NVPResponse['TOKEN']) && $NVPResponse['TOKEN'] != ”)
$NVPResponseArray['REDIRECTURL'] = ‘https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&’ . $SkipDetailsOption . ((isset($NVPResponseArray['TOKEN']) && $NVPResponseArray['TOKEN'] != ”)?’&token=’ . $NVPResponseArray['TOKEN']:”);
$NVPResponseArray['REDIRECTURL'] = ‘https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&’ . $SkipDetailsOption . ((isset($NVPResponseArray['TOKEN']) && $NVPResponseArray['TOKEN'] != ”)?’&token=’ . $NVPResponseArray['TOKEN']:”);
Please let me know if this helps, or if I’ve misunderstood the intended usage of your class.
(In my opinion the Token isn’t set in the first call of setExpressCheckout, it will be populated after the first response by Paypal, so I can’t pass a token value at first API call)
I noticed that myself and it’s actually fixed in this next version I’ll be releasing before too much longer. It only happens if your SEC call fails for some reason and no TOKEN is available, and it’s only a warning so it wouldn’t cause the app to halt at all. Again, though, I have fixed it so this warning doesn’t occur. I just need to tie up some more loose ends and then I’ll get this new version released.
Thanks for the feedback, though! Always appreciated. I’m sure I have other little mistakes in there, too, so if you find them please let me know.
This php library will support paypal payments advanced ?
Not right now, no. It’s for API’s only. Payments Advanced is just a basic form post directly to PayPal so you don’t have to put together request strings and parse response strings, etc. I may include it in the library at some point, but it’s not something I’ve focused on yet. Sorry.
First off thanks a lot for your library of code its awesome!
So my overall goal for using your library of code is to embed a paypal iframe in my site for users to make payments through paypal. I’m currently following this tutorial https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_APIntro.
If you ctrl+f “Setting Up Web Pages to Invoke the Embedded Payment Flow Using a Lightbox”, you will see the step by step instructions I’m following.
So I’ve successfully used your library’s pay.php file to get an api pay key. But when I try to use this key in the form
“action” link. I receive the error in paypal” Your payment session has expired. Please return to the participating website and try again.”
Any idea what’s going on? I’m lost.
Thanks in advance for your help and once again thanks for the awesome library of code. It really makes up for paypal’s poor documentation.
The first thing I would do is get it all setup and working outside of the lightbox. Make sure you can call the Pay API which will give you back your PayKey and a ReturnURL generated for you by the library. See if you can load this RedirectURL without any problems or if you get the same problem there.
Could you please help me how to use your class files in yii framework.
Actually I want creating recurring payment profiles for each user while registration.
Thanks in advance.
I’m not familiar with the Yii framework, but upon quick review it looks like a standard MVC framework which means my library should plug into rather easily. It’s all object oriented so it should just be matter of extending the Yii classes to turn these into custom Yii libraries.
Great stuff no doubt and many thanks for building it and making it available.
I want to do chained payments and I have made it work perfectly in sandbox. Im just wondering, when I create the payment on a live server, do I need to send it on a secure line to prevent eavesdropping?
Because I see I need to put in the paypal password in the config file, is that something that is sent over to paypal when I create the payment before redirecting the user to the login. Or do I only need secure line if Im doing some of the more advanced stuff like preapproval or something?
The API endpoint is an https:// server so everything you post is encrypted. You only need SSL certs if you’re processing credit cards directly on your server. With the majority of PayPal’s services it’s optional because they’re handling the processing for you.
Thanks for the classes but i still seem to be confused with what i am trying to do. There is quite a lot of information there.
I am trying to process an Adaptive Payment on my site. I want buyers to be able to pay multiple sellers for multiple items all at one go from their shopping basket. I would like this to be a direct payment. I took a look at your classes but i am unable to see the the classes to use to process adaptive parallel payments.
Much appreciated, Thanks
You’ll be utilizing the Pay API with multiple receivers. If you want parallel (where the buyer will see the split) you don’t need to set a primary receiver. If you’d rather do chained payments (where the split will be hidden from the buyer) you’ll need to set one of the receivers as primary in your Pay request.
Thanks, Which of the classes do i start with?
I have setup a social network that just needs to accept a single payment that gets split between two paypal business accounts. How much would you charge me to program this for me. If you are interested in doing this can you call 817-773-7062 and if I can not answer please leave a message and a time when I can call you back.
I’ll give you a call today or tomorrow. Need to finish up some projects before discussing something new.
Hi Andrew. Thanks for your response to my paypal question earlier today. It looks like the only file I’ll end up using is Pay.php — but I’ll keep them all close at hand!
Ok, so Pay.php includes the config.php and the paypal.class.php (which includes the adaptive classes), so I just include the file Pay.php where I need access to your classes. This looks good.
I’m editing the config.php file now. I’m wondering about the $developer_account_email. It says this is needed only for Adaptive Payments. Is that my real developer/sandbox email? Or is that my sandbox fake business account email? I guess it just seems odd that paypal requires any sandbox info to work.
Am I mis-reading that?
Hmm. Wait.. I thought at first each file was its own class with associated functions. Am I supposed to include Pay.php in my code, or do I just include the paypal.class.php (and config)? It looks like the Pay.php file (and all the others are really samples of usage. Is that right?
If you’re simply going to use the library directly you’d just include config.php and the paypal.class.php. This would give you access to all of the methods included with the library.
All of the files included, like Pay.php, are simply empty template files prepared for that particular API request. It just gives you a real quick starting point for every call. You can either work directly from those files or from your own, but you’ll need all of those request arrays one way or another.
Let me know if you still have more questions about that.
$developer_account_email is the email address you use to login to http://developer.paypal.com. It gets passed into the header of Adaptive Payments requests, and I’m pretty sure it’s just used as a way for PayPal to track where things are coming from. Looks like you’ve got a follow-up comment here regarding which files to include so I’ll respond with more detail there.
Sandbox: recurring profile not start payment charge
I have several days trying to make it run the payment instruction
after you create the profile but this never happens.
I use your library for this propose:
There is an example of the way I am creating the profile:
2. Click here to continue.
3. In login form I use:
4. After login and confirm this redirect to:
5. The profile is created with start date today, but the payment is never charge.
Where I am wrong, why not start charging paypal,
if I do the same process with the buttons on subscriptions
payment is executed after creating the profile
I’m very sorry for the delay getting back with you. I would need to get a look at your actual requests/responses in order to help you troubleshoot this.
Please update me how to use it for PAYFLOW PRO.
You just need to add your credentials to the config.php file and then open up the PayFlowTransaction.php file and fill in the parameters accordingly.
HI, I just want to ask some help,how can i use this php class library for paypal, does this will work in sandbox,because i am just using sandbox and i want to try using IPN in my localhost,please help me i am newbie on this,please provide me how to start using this to achieve my goal to test IPN in localhost.
Yes, the library is designed to work easily with both the PayPal sandbox and production servers. You simply pass in a true/false value for sandbox when you create the class object. My library does not have IPN built in to it, though. Also, when using IPN you can’t use “localhost”. You’ll need to use your public IP or setup a domain name that points to it.
does these library support Paypal Standard?
Right now the library supports some of the Button Manager API calls, but it doesn’t handle Payments Standard any other way. I do have plans of adding it, but it will be a few weeks before I’m able to get that done and release an update.
hi ..i am new in phhp…i want devlope chain payment system of paypal …when sender send $100 then 1st primary reciver recive only $90 & 2nd rec Recive $10 … how i can do that plz help me
You would use the Adaptive Payments platform for that, specifically the Pay API. You can set it up as a Parallel or Chained payment, the difference being that with parallel payments the payer would see the split that will happen, but with a chained payment that would be hidden and they would only see a single receiver.
Basically, though, you would just create the Pay call with multiple receivers in the request. Each receiver would be set to the amount they should receive in the payment and the library will handle the rest.
There is a Pay.php file included in the samples folder. You might want to look at the PayWithOptions sample, too, as that allows you to provide more details with the request. It actually combines both Pay (CREATE) and SetPaymentOptions in a single method.
Your email address will not be published. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
© Copywrite 2013 Angell EYE