How to Integrate PayPal CodeIgniter Library
Learn to integrate PayPal’s Classic APIs into any CodeIgniter application using this PayPal CodeIgniter class library.
Setup the PayPal CodeIgniter Library
- First, Download the PHP PayPal CodeIgniter class library for PayPal and upload the contents of the /application directory to the /application directory in your CodeIgniter install.
- Second, open /application/config/payal-sample.php and adjust the values with your own Sandbox and Production API credentials. Then save-as paypal.php.
- In addition, detailed comments are inside the config file to help you fill it out correctly.
How to Make PayPal API Calls
- Open /application/controllers/paypal/templates/Controller_name.php depending on which PayPal API you’re going to be using.
- Example: If we want to make a call to the RefundTransaction API we open Payments_pro.php and then seek out the Refund_transaction() function.
- You can build directly into the template functions if you want to, however, I recommend you setup your own controller and copy the functions there. This keeps the templates clean for future reference.
- Just remember to load the PayPal config file and library in your constructor the same way the samples and templates do.
- Each template controller file includes functions with PHP arrays for every parameter available to that particular API. Simply fill in the array parameters with your own dynamic (or static) data. This data may come from…
- Session Variables
- PHP Variables
- Database Recordsets
- Static Values
- Etc.
- When you run the function you will get a $PayPalResult array that consists of all the response parameters from PayPal, original request parameters sent to PayPal, and raw request/response info for troubleshooting.
- You may refer to the PayPal API Reference Guide for details about what response parameters you can expect to get back from any successful API request.
- Example: When working with RefundTransaction, I can see that PayPal will return a REFUNDTRANSACTIONID, FEEREFUNDAMT, etc.
- As such, I know that those values are available in $PayPalResult[‘REFUNDTRANSACTIONID’] and $PayPalResult[‘FEEREFUNDAMT’] respectively.
- You may refer to the PayPal API Reference Guide for details about what response parameters you can expect to get back from any successful API request.
- If errors occur they will be available in $PayPalResult[‘ERRORS’].
Samples
- After installing the PayPal library into CodeIgniter, the demo can be loaded at {base_url}/paypal/samples/demo/.
- This allows you to run the fully functional samples that are included with the library.
- The samples that the demo loads can be found at /application/controllers/paypal/samples/.
- The Payments Pro sample controller has two methods ready for demo purposes after you update your config file.
- Do_direct_payment()
- Get_balance()
- The Adaptive Payments controller has one sample ready for demo.
- Convert_currency()
- The PayFlow controller has one sample ready for demo.
- Process_transaction()
NOTE: Check out our fully functional CodeIgniter PayPal Integration demo kits!
General PayPal CodeIgniter Tips
- The result of the API call will come back in $PayPalResult[‘ACK’].
- Remember when checking the value that it could be Success, Failure, SuccessWithWarning, or FailureWithWarning. Simply checking for Success isn’t enough.
- You may use $PayPal->APICallSuccessful($Ack) to do this for you.
Tips for Testing in the PayPal Sandbox
- Firstly, create an account at http://developer.paypal.com
- Secondly, create at least one sandbox Seller account and one sandbox Buyer account from within your developer account.
- Use these accounts to go through the entire process of buying items within your application.
- You can review what each party involved will see in their PayPal account when transactions are complete.
- Learn how to create PayPal sandbox accounts.
- Use these accounts to go through the entire process of buying items within your application.
Tips for Going Live
Download the FREE PayPal Express Checkout Demo Kit
Our CodeIgniter PayPal Library comes with basic API call samples for free. However, this kit provides a fully functional shopping experience with the Express Checkout calls integrated directly into it.
Featured PayPal Products and Services
-
PayPal Support
$100.00 -
PayPal for WooCommerce
FREE! -
WooCommerce Multiple PayPal Accounts Plugin
FREE! -
PayPal Shipment Tracking for WooCommerce
$49.99 -
Offers for WooCommerce
$59.99 -
WordPress PayPal Invoice Plugin
$20.00 -
PayPal Webhooks for WordPress
$79.99 -
Sale!
PayPal IPN for WordPress
Original price was: $59.99.$49.99Current price is: $49.99.
Man I tried ALL day for the life of me to get calls working to the Paypal RESTful API. I went that direction, because it’s newer and should be easier and more supported I thought. Wasn’t an easy start.
So then I tried your CodeIgniter library. Paypal required Classic API keys and a username. So then I had to go back and register AGAIN for classic API, and they want me to project business income and explain what my business is about. I’m just a freelance coder not the site owner- so I bailed on it.
I’m using shared hosting, so I couldn’t get composer installed on Hostgator to use the Paypal PHP SDK. I was ready to tell my client to jump ship for Stripe, which has a BOMB javascript library to handle their API.
Anyway, I finally resorted to shell_exec cURL calls, and it works great. If I find the time, or you wanna do it- I’d make a new CodeIgniter library using curl on the RESTful API because it’s so easy, and already json encoded. Either that, or checkout Stripe. Well Paypal did just by BrainTree, and they know how to treat a developer.
You wouldn’t have needed to submit business info just to get setup as a developer or get API credentials. You can do that from within your profile no problem, and it doesn’t require any approval or anything unless you’re trying to work with Payments Pro, which it sounds like maybe you were. Still, though, you can get running with that on the test servers for development purposes without any delays.
I do have plans of adding the REST API into my libraries, but at the moment there’s really no need to rush because they don’t provide anything that the Classic API’s don’t provide. The way my library works is simply filling out array data, which is essentially the same thing you’d be doing with REST, too, but then running the array through json_encode() or json_decode().
Stripe does make things a little bit more simple to get up and running, but part of the reason for that is they just put 7 – 10 day holds on everybody’s funds from day 1. PayPal vets you up front so you can have immediate access to your funds (in most cases…there are still various holds for individual transactions at times.) Also, PayPal gives you breaks on the fees (1.9% – 2.9%) where-as Stripe doesn’t seem to do that from my experience. I’m pretty sure they stick you at 2.9%, but I could be wrong about that.
Anyway, again, my CodeIgniter library is very simple to use, it’s just that it sounds like you didn’t have Pro activated. I also have a standard PHP class library that isn’t CodeIgniter specific. It works exactly the same way, though, and is in the same state.
My next release will indeed have the REST stuff included, but it’ll actually function within my library exactly the same way, and again, there’s nothing available in REST right now that isn’t available in Classic.
Hey thanks a ton for that information, very much appreciated. I wrote the REST API library for CodeIgniter today, and I didn’t use the shell_exec but the native PHP cURL functions. I was having trouble with it yesterday and resorted to shell_exec, but that’s too much work with form validation to protect the server from crazies injecting the code.
I’m gonna post it on a landing page, to share with others and yourself. Whereas your API is all encompassing, I want to put something out there that just is for a one time credit card/paypal payment.
It essentially builds a PHP object in the class constructor, which you can manipulate with methods in the class to request funds.
The object gets json encoded and passed through cURL to the API. Then you have methods to receive your responses. I think it’s ready to go, I’ll let you know when I release it hopefully this weekend.
Thanks again for your response!
Yeah, let me know, I’d love to see it.
Hello;Before doning on server i am trying on localhost and also for dummy project.I downloaded your library files for paypal payments.Its my first time to use paypal.So,can you guide me what i have to do with step by step.
Still,i downloaded your files and save in folder.Now what i have to do.
Email me through the contact page on my site and I can help you more directly.
I have an issue in my site.I have 200 vendors in my site and customers might purchase from these 200 vendors at a time.I heard that Paypal parallel and paypal Adaptive chained API has limitation of 5-10 vendors( supports only 5 emails at a time).
So I am not able to use these 2 paypal methods.So I planned to use Paypal MassPay this can be usefull for above 250 vendors but here also I am facing an issues such as I am not able to make a single call for both Paypal Pro and Masspay.I mean I am not able to do both paypal pro and Masspay In single call.First I have to do paypal pro (Customer fills credit card and getting succes from payapl.If its suceess ,I will have to again call MassPay API).
As You are a certfied Paypal developer.I hope you can help me on this two scenarios.
Unfortunately, everything you’re saying here is correct. You are indeed limited with the Pay call and MassPay has to be done in a separate call. That said, you could tie the calls directly into checkout, or better yet, use IPN to automate it based on the status of the payments. Are you familiar with IPN?
This seems awfully easy –
Can you explain how secure this is when using CodeIgniter.
What are the security risks, and what should be considered before using this library.
Here I’m thinking that your not using any iFrame from PayPal, but accept the CC info directly on our own hosted website, which we then send to the Library for processing.
thanks.
You are correct that you’ll be posting data to your own processing scripts, so you’ll need to make sure you’ve got an SSL configured on your site. Also, you’ll need to make sure you’re not saving any credit card details in your database. If you want to save the last 4 digits of the card that’s fine, but don’t save anything else. You can use reference transactions to process future payments with a saved credit card on PayPal’s system so you don’t have to save it yourself.
As long as you follow those basic standard procedures you’ll be just fine.
Hi Andrew,
I’m going throw your lib for 3 days now.
I need to setup Paypal Express Checkout at registration step (controller). I fill the set_express_checkout method with data from $_POST, which comes when I submit my form.
Thart works fine..
With get_express_checkout_details i get the data. BUT…
do_express_checkout_payment requires a “payerid” which i dont get from the get_express_checkout_details!!
Where to get that from?
I’ll be glad if you can post a step by step guide for express checkout
Thanks
GECD does return the Payer ID, so you should double check that, but if you’ve got the SKIPDETAILS option set to 1 (true) in the SEC request then it would also be available as a URL parameter on the redirect URL when PayPal sends the user back to your site.
Hi, I want use the adaptive payment for simple scenario: the client pay me. Why i can’t do it? If I set only one receiver, i get an error. Is necessary set 2 or more receivers?
If you’re only sending a single receiver make sure you don’t have it set as primary. Outside of that, let me know what error you’re getting and I can help.
Thank you man… You saved my mental health! The error was:
id: 579008
Message: You must specify only one primary receiver and at least one secondary receiver
I resolved it setting the receiver “Primary” field to false:
$Receiver = array(
‘Amount’ => ‘20.00’,
‘Email’ => ‘XXX@XXX.it’,
‘InvoiceID’ => ‘123-ABCDEF’,
‘PaymentType’ => ‘SERVICE’,
‘PaymentSubType’ => ”,
‘Phone’ => array(‘CountryCode’ => ”, ‘PhoneNumber’ => ”, ‘Extension’ => ”),
‘Primary’ => ‘false’ //<- this
);
Thank you so much.
HI,
i am using the pay chained demo for codeigniter paypal, can you tell me how to get the return success parameter with return url , when user completed the payment as i am new to paypal..
You won’t get those in the Return URL. You’ll need to focus on the actual API response for the results. You can store them in session variables if you need access to them on the return URL.
Thanks for the quick response, ok i will try..
As you said i am using session to store the response , it’s ok.. but when in return url if i checked session data, the added response to session is lost.
Why the response data added to session lost ,when the redirection happening to paypal? Any idea..
finally i got the session data now.. Thank you for your help
Hello,
I am looking for paypal recurring payment mode
I downloaded your demo but as I am new on paypal API I don’t know how to proceed
Please help me…
Are you looking to integrate the PayPal recurring payments option (Express Checkout) or are you wanting to process credit cards directly on the site without any redirect through PayPal?
sir can you please tell me how to convert paypal pro sandbox test account live account.
You don’t convert a sandbox account to a live account. You need to create a live account (if you haven’t already) and then obtain API credentials for the account. Then when you add those credentials into the correct place in the config file and set the $sandbox flag to false, it’ll hit the live site and use your live credentials, so the money would fall into your live account.
Sir i have given the live api credentials in paypal.php config file and i also given $config[‘Sandbox’] = FALSE. but it is giving me an error like this wheredid i went wrong please suggest me sir.
Array
(
[0] => Array
(
[L_ERRORCODE] => 10501
[L_SHORTMESSAGE] => Invalid Configuration
[L_LONGMESSAGE] => This transaction cannot be processed due to an invalid merchant configuration.
[L_SEVERITYCODE] => Error
)
)
One thing i tested with test credit card.
That means you don’t have Payments Pro enabled on the account you’re working with. When you create a new sandbox account through http://developer.paypal.com you can specify that you want it to be a Pro account.
For test account it is working fine sir but for live account it is showing me an error as “This transaction cannot be processed due to an invalid merchant configuration”….
Ok, then that means Pro isn’t active on your live account. Have you applied for it?
no sir..Thanks for quick reply sir….
hello sir,
I want to integrate paypal for my website, so i have bit confusion about which method to use paypal to integrate on ‘fund now’ button on my website..
Can you please elaborate on that? I’m not sure I understand what you’re trying to accomplish.
hello sir !! Is your work with I can make a direct payment with my visa card, mastercard …. without creating an account on paypal?
Yes. You’ll need Payments Pro active on the PayPal account and then you’ll use the DoDirectPayment or PayFlow API depending on which version of Pro you end up getting (which depends on what version of PayPal you have). The first step is applying for Pro so you know which version you need. The library handles both.
Thank you sir! I really would like you to guide me step by step to realized that part of my website. Thank you in advance.
The library includes a payments_pro.php controller that has all of the API calls setup for you. There’s a method called Do_direct_payment_demo() that is functional so you can see how it works. Then you could just use the Do_direct_payment() method to fill in your own data for processing.
Is the information on the card input from our WebSite?
If not, how to redirect customer on the paypal platform for him to capture his informations?
I just tested Do_direct_payment_demo (), but it returns me this error:
A PHP Error Encountered WAS
Severity: Notice
Message: Undefined index: ACK
Filename: controllers / payments_pro.php
Line Number: 479
This would leave me to believe the PayPal result must have been blank. Is this still happening to you? Can you confirm that cURL is enabled on your server?
Hello Mr Andrew Angell. First of all I congratulate you for the excellent work that helps us a lot.
What library ??? I need your help because during use I meet some problem.
I use the controller and method Adaptive_payments Pay(). Before explaining my problem I have a question for you.
Why there are up to three variable $Receivers? I do not really understand this part.
My problem is that after paying the seller’s account is not increased.
And also that the buyer is not decremented.
I really want you to help me.
Thank you in advance !!!!
The sample has 3 $Receivers just to show how you would include more than 1 receiver on a payment. You don’t have to use 3. You can just load the $Receivers array with a single $Receiver and that would be just fine.
As for why the money isn’t getting moved, I would need to see the result that you’re getting, which should include error details from the PayPal response. Can you log the $PayPalResult in some way so we can see it?
this’s an error if i specifiy one $receveir
Array
(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 579008
[ExceptionID] =>
[Message] => You must specify only one primary receiver and at least one secondary receiver
[Parameter] => 1
[Severity] => Error
[Subdomain] => Application
)
)
In the $Receiver arrays there is a parameter for “primary” that would be set to true/false. You can only have 1 primary receiver. Sounds like you must have multiple receivers with this set to true, or it could be that you have only a single receiver with primary set to true, in which case it’s expecting a secondary receiver.
If you’re trying to submit a single payment to a single receiver, just clear out the value for $Receiver[‘Primary’] and that should solve the problem.
Hi !!
On your demo Adaptive Payments Pay (Chained) It can put our logo,
But I can not find the variable that transmits the logo.
Please guide me step by step.
For Adaptive Payments there is no a parameter to set the logo in the API request, unfortunately. You’ll need to set it up under Custom Payment Pages within your PayPal account profile. Anything you set there will act as a default logo for any PayPal checkout flow you have setup, but then if you do run an API request that provides that parameter and you include it the default would be overridden.
Array
(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 520003
[ExceptionID] =>
[Message] => Authentication failed. API credentials are incorrect.
[Parameter] =>
[Severity] => Error
[Subdomain] => Application
)
)
I always get this error. I don’t know. Every details I provided is correct though.
Sounds like you’re probably sending sandbox credentials to the live PayPal server or vice-verse. You need to check your /config/paypal.php file and make sure $sandbox is evaluating the way you expect it to, and also make sure you have API credentials filled into the correct placeholders based on the value of $sandbox. It’s using shorthand if/else statements for that.
$config[‘Sandbox’] = TRUE;
/*
* PayPal API Version
* ——————
* The library is currently using PayPal API version 98.0.
* You may adjust this value here and then pass it into the PayPal object when you create it within your scripts to override if necessary.
*/
$config[‘APIVersion’] = ‘98.0’;
/*
* PayPal Gateway API Credentials
* ——————————
* These are your PayPal API credentials for working with the PayPal gateway directly.
* These are used any time you’re using the parent PayPal class within the library.
*
* We’re using shorthand if/else statements here to set both Sandbox and Production values.
* Your sandbox values go on the left and your live values go on the right.
*
* You may obtain these credentials by logging into the following with your PayPal account: https://www.paypal.com/us/cgi-bin/webscr?cmd=_login-api-run
*/
$config[‘APIUsername’] = $config[‘Sandbox’] ? ‘myusername’ : ‘PRODUCTION_USERNAME_GOES_HERE’;
$config[‘APIPassword’] = $config[‘Sandbox’] ? ‘mypassword’ : ‘PRODUCTION_PASSWORD_GOES_HERE’;
$config[‘APISignature’] = $config[‘Sandbox’] ? ‘mysignature’ : ‘PRODUCTION_SIGNATURE_GOES_HERE’;
This is my paypal.php in config. Am i doing anything wrong here?
Seems ok from the initial look. Can you provide a sample of the full $PayPalResult you’re getting? Would probably be best to create a ticket here for that.
Array
(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 520003
[ExceptionID] =>
[Message] => Authentication failed. API credentials are incorrect.
[Parameter] =>
[Severity] => Error
[Subdomain] => Application
)
)
I don’t get anything else. When i run convert_currency method. This is what I get always.
Seems you’re missing something. The result should also include an XMLRequest and XMLResponse. Looks like you’re only providing the error portion of the result here..??
Array
(
[Errors] => Array
(
)
[Ack] => Success
[Build] => 15743565
[CorrelationID] => 0cfde776f8ebf
[Timestamp] => 2015-05-12T04:22:41.280-07:00
[CurrencyConversionList] => Array
(
[0] => Array
(
[BaseAmount] => Array
(
[Code] => USD
[Amount] => 100.00
)
[CurrencyList] => Array
(
[0] => Array
(
[Code] => BRL
[Amount] => 222.52
)
[1] => Array
(
[Code] => AUD
[Amount] => 105.41
)
[2] => Array
(
[Code] => CAD
[Amount] => 100.76
)
)
)
)
[XMLRequest] => ReturnAllen_USUSD100.00BRLAUDCAD
[XMLResponse] => 2015-05-12T04:22:41.280-07:00Success0cfde776f8ebf15743565USD100.00BRL222.52AUD105.41CAD100.76
)
this is what i got for $paypalresult when i echoed it out.
So based on that it looks like it worked just fine. 🙂
Hi. When i migrated my website I started getting invalid token id error. Why is it happening? Do you have any idea about it?
This is the error when i try to update an existing recurring profile
Array
(
[0] => Array
(
[L_ERRORCODE] => 11552
[L_SHORTMESSAGE] => Invalid profile ID
[L_LONGMESSAGE] => The profile ID is invalid
[L_SEVERITYCODE] => Error
)
)
and When i try to create a new profile I get invalid token error. I am using the token returned from paypal. It was working perfectly until i migrated my website.
That error that you are showing here is “Invalid Profile ID” which is different than “Invalid Token”. In this case it looks like you must be attempting to update an existing profile in some way but the value you’re passing in is not valid. I would need to get a look at your API request to see what might be causing that.
If you are finding actual Invalid Token errors at times, that could be something to do with session data on your server getting lost for some reason. One thing that can cause this is if you begin the process from an https:// URL but are then returned to an http:// URL. Check for that sort of thing.
In any case I would need to see samples of the API requests to be able to help more. If you can provide that feel free to submit a ticket here and I can help you more directly.
But the thing is I got this error all of a sudden. I haven’t changed a single line of code and it was working perfectly before. But shows error now. Have you ever had that kind of problem before?
When migrating to a new server, yes, quirky things can happen. Again, the first step is to get a look at the API requests to see what exactly is getting sent for these values that it’s telling us are invalid. If the values getting included in the request are empty then we know something about how those values are getting set is not working the same on this server as it did on the other server.
It could be, though, that some weird characters are getting included in the value and it’s not actually empty, but simply invalid. So we need to see that request. That’s always the first step to troubleshoot something like this.
Everything is working perfectly in my localhost but not in the web service. I am getting token id from paypal. But it says invalid. Quite weird.
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=continue&token=EC-94640253NG694601D this is the url and you can see the token there.
yearlysubscription/Create_recurring_payments_profile/EC-94640253NG694601D this is how i am using the token after i get it from paypal. And it says invalid token.
Seems like maybe your token is getting setup on the live PayPal server but then here you’re using the sandbox PayPal link (or vice-verse).
Dear Andrew,
I want integration website I have with paypal.
Sorry I am a bit confused as to his explanation, please info for my first step should be for what.
thank you
Have you looked in to how Express Checkout works? That’s the first thing you’ll need to be familiar with, and then the library will make each of the calls (SetExpressCheckout, GetExpressCheckoutDetails, and DoExpressCheckoutPayment) very simple for you.
Dear Andrew,
what difference it adaptive, Payflow, and payments pro.
Where can I take to transactions that could use a credit card for the customer.
Thanks for response.
Dear Andrew,
The online website, I want to use adaptive paypal.
I use a web framework codeiginiter. Please give me light, php file what should I prepare. (I’ve downloaded from github https://github.com/angelleye/paypal-codeigniter)
I was a bit confused for preparation.
Thank you very much.
For Adaptive Payments you would us the Pay API. So within the controller that comes with the library you can find the Pay() method and just populate the parameters accordingly. It will handle the rest for you.
Hello Andrew,
I have contacted you before but i think the comment wasnot submitted so again.
Thanks for your great effort.
We are developing new script that we will use pay with Paypal and Paypal Pro(Credit Card), our simple idea is that the client will ask for some service and will choose payment method (Paypal Or CreditCard(Paypal pro))then he will be redirected to Paypal to finish payment then return back to success page, it is so simple. I think your classes do more functionality than simplicity we have.
so please can you guide us how to use your libraries to help us to do that as we are missed in the all functions you did.
waiting for your early reply…
we will send you test URL on special email when you reply
Thanks
Hamada
You would use Express Checkout for the PayPal payments, which consists of SetExpressCheckout, GetExpressCheckoutDetails, and DoExpressCheckoutPayment. For Payments Pro you would use either DoDirectPayment or PayFlow depending on which version of Pro you end up with. If you need more direct help please submit a ticket here.
Hi, I want to integrate your library with website. can you please help me I want, when buyer checkout button he goes on paypal login page and he can’t see item detail on that page and says on paypal page you can see order detail on website. and I want get his email address. and after finalize remaining order i want to call DOExpressCheckout.
Please submit a ticket here with your questions and I can help you more easily.
hello sir,
i have to integrate the mass payment of paypal. So how can i used your library. please help me out.
All you would need to do is make sure the config file is setup correctly with your own credentials, and then open up the /templates/MassPay.php file, save it where you want it to actually run from, and adjust it accordingly. Within that template you’ll see the parameters that are necessary, and you can include multiple “items” as shown in that template. The template/sample shows how you add multiple items/receivers manually in code, but you could also loop through some record set and create $MPItems accordingly.
I am just trying to go live – I made changes configureation (paypal.php) file. Sandbox to false and made changes on APIUserName, APIPassword, APISignature and finally for ApplicationID for adaptive Paypal. But, I am getting following error message. can you please help me what I am doing wrong?
“A PHP Error was encountered
Severity: Notice
Message: Undefined property: PayPal_Adaptive::$BetaSandbox”
You should not be using the BetaSandbox. You need to make sure you’re using either live or the regular sandbox. BetaSandbox needs to be stripped, and I actually thought I had done that already. Are you using an old version of the library?
I am using the free Paypal Express checkout demo with Codeigniter. I got invalid token error after the payment is done. I have checked the token should be stored in session in SetExpressCheckout and it was actually store successfully. After the payment and got back to GetExpressCheckoutDetails, the token should be found in session but it lost. May I know is there anything wrong here? Thanks.
I’m sorry for the delay getting back to you on this. If you’re still having trouble please create a ticket here.
Hi,
When I create my controller with a few functions from Payments_pro an error occurred:
Warning: include(/var/www/html/CodeIgniter/application/views/errors/html/error_php.php): failed to open stream: No such file or directory in /var/www/html/CodeIgniter/system/core/Exceptions.php on line 269
It’s a problem with the CodeIgniter version?
I’ve only extracted files in my CI directory and edited the config file.
Thank you
Did you try working directly in the controller that’s provided with the library? It has a couple of demo functions setup in it. Do those run for you out of the box?
I tried, I’ve to do paypal transaction from business a/c to buyers a/c, but buyers a/c don’t have signature parameter which gives following error:
Array
(
[Errors] => Array
(
[0] => Array
(
[L_ERRORCODE] => 10002
[L_SHORTMESSAGE] => Authentication/Authorization Failed
[L_LONGMESSAGE] => You do not have permissions to make this API call
[L_SEVERITYCODE] => Error
)
)
)
I’m not sure I understand what you’re trying to do. The “signature” would be yours, the app owner, in any situation. Depending on who the sender and receiver are you may need to setup Preapprovals if you want to send payments on their behalf through your app without the need for them to login and approve it.
The old PayPal webform integration seems to have this problem every now and then. I believe there is nothing you can do other than hope that your customers are not concerned.
Array
(
[0] => Array
(
[L_ERRORCODE] => 10548
[L_SHORTMESSAGE] => Invalid Configuration
[L_LONGMESSAGE] => This transaction cannot be processed. The merchant’s account is not able to process transactions.
[L_SEVERITYCODE] => Error
)
)
trying sandbox mode.
Which API call are you working with?
I’m getting the same error despite of setting all the required information. please guide me through the process as I’m using direct payment method. Furthermore, I have business pro account for the merchant in sandbox.
This error means the DoDirectPayment API is not configured on your account. You need to make sure you have Website Payments Pro 3.0 active on your account before you can use DoDirectPayment.
How can I use this library for recurring payments means if someone chooses trial than after trial period automatically payment has been made else the payment is done after a certain period of time can this be achieved through do direct payment?
Hi Sadia,
I’m sorry for the delay getting back to you. If you want the trial to be a free trial then you would need to set the start date of the profile to the date you want the first payment to be made. So if you want a 1 week free trial you would set the start date to “today + one week”. You would use the CreateRecurringPaymentsProfile API to set this up with PayPal Pro (DoDirectPayment).
Aha! You did an excellent work here on “How to Integrate PayPal CodeIgniter Library” in very easiest way. Thanks for sharing! I know that it’s too late to comment here but this post still gonna rocks! It is is very easy if you a hiring a Codeigniter developer, your work will be done in short time of span.
Glad the library is working well for you!
I Want credit card payment on my site. which method is suitable ?
Payflow showing resposnse as below:-
Array
(
[RESULT] => 12
[PNREF] => A10AA7FDA7E2
[RESPMSG] => Declined
[HOSTCODE] => D
[TRANSTIME] => 2017-11-15 22:01:38
[BILLTOFIRSTNAME] => Tester
[BILLTOLASTNAME] => Testerson
[AMT] => 70.00
[ACCT] => 9932
[EXPDATE] => 1022
[CARDTYPE] => 0
[PREFPSMSG] => Review: More than one rule was triggered for Review
[FPS_PREXMLDATA] => Array
(
[844] => 22CeilingAmountTotal Purchase Price CeilingRThe purchase amount of 70.00 is greater than the ceiling value set of 0.-1CeilingValue0.-166HighOrderNumberTotal Item CeilingR0 items were ordered, which is over the maximum allowed quantity of -1Value-1
)
So it looks like the PayFlow request is working just fine, but you have Fraud Filters setup based on a price ceiling which seems to be set very low right now. You need to fix that in your PayFlow account and then the transaction would go through fine.
Dear Andrew,
I have used Paypal_pro >> SetExpressCheckout method for redirecting to the live site
but when i am going live
it is saying me that portal is unavailable from December 1 2017 ?
Is there any way to get Live Credentials ?
Alternatively which way i should implement if this didnot work.
Please Help
I’m not sure what you’re referring to when you say it’s telling you that “portal is unavailable from December 1 2017”..?? Can you provide a screenshot of what you’re seeing?
Hey,
I want to implement ‘parallel payment’ because i want to send money to two different accounts, so can u please provide me function code for that, actually u already prepare a function of Pay_chained but Not for parallel…
one a/c for 25% and another one for 75%…
my web link: http://elh.khasrabrothers.in/paypal/samples/Adaptive_payments
So please reply me and help me as soon as possible actually i Stuck in it since 3 days.
Parallel would be exactly the same as chained except that you would eliminate the primary => true value. Without a primary receiver it becomes a parallel payment.
Where we can fined ApplicationID in paypal developer account ?
If you’re referring to Adaptive Payments you should know they are no longer issuing live App IDs for this. You should use Express Checkout instead, which does not require any App ID. Are you trying to do a Parallel or Chained payment? If so, which one specifically? Both can be done with Express Checkout but the procedure is a little different.
Hi andrew angell
Thanks for the reply.
I m using this sdk for Get_verified_status of paypal emaiID.
It works properly for sendbox account but gives an error for live.
here is my error response for this Get_verified_status function ,
[Errors] => Array
(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 560029
[ExceptionID] =>
[Message] => The required X-PAYPAL-APPLICATION-ID header is missing from the HTTP request
[Parameter] => X-PAYPAL-APPLICATION-ID
[Severity] => Error
[Subdomain] => Application
)
)
I m not passing application id for both sandbox and live in config file still sandbox works fine but live throws error.
Thanks
GetVerifiedStatus uses the Adaptive Payments API, which is now officially deprecated and will not work on live servers. 🙁
Ohh than is it possible with alternate way ?
Hi Andrew,
First of all thank you for all the efforts you put into this, really appreciate it.
I have used the Do_direct_payment() method and it all went like charm, now i am trying to use the same function for PayPal instead of CC and couldn’t figure out which function is more alike Do_direct_payment()for PayPal.
Thank You!
For PayPal you would use the Express Checkout APIs, which consist of the following order: SetExpressCheckout, GetExpressCheckoutDetails, DoExpressCheckoutPayment. If you need some detailed guidance on exactly how to work with those APIs to get PayPal integrated you can submit an order for consulting to schedule a call with me and get your questions answered. Thanks!
Thank you for sharing this blog with us.Please explain me about how paypal actually works for two different accounts.
Hi Alex,
I’m not sure I understand your question. Please clarify and I’ll be happy to help.
Drew
Hi Andrew,
Thanks for sharing your codeigniter paypal library.
This help a lot for a developer to integrated the paypal payment.
But can i have a favor ?
I have try to use the adaptive_payment in function Pay();
When trying to implemented i got an error :
Undefined property: Adaptive_payments::$paypal_adaptive
I can not figure what wrong with this error. Would help me what this is error about ?
Thank You
Sounds like you may not have the config files or the classes added correctly. Might best to submit a ticket to our help desk and we try to help with more details.
Hello Andrew,
Thanks for sharing codeigniter paypal library.
One question for you using this library recurring payments possible?
Thank you
Yes, but I actually recommend that you use our standard library and install it into CI using Composer. It’s more up-to-date and includes all of PayPal’s new REST APIs.
If you want to stick with this one, though, you would use SetExpressCheckout, GetExpressCheckoutDetails, and CreateRecurringPaymentsProfile.
Thank you for reply,
One more question about where i can find your standard library?
i see your controllers, i unable find how get token if any document reference,if possible so share its would be great for me.
Thank you
Hey Andrew, that was really helpful!
In fact i was looking for this since a long time now.