Download CodeIgniter PHP Library for PayPal Payments Pro

Download the Library

 

View Documentation

 

View Demo

269 Comments

  1. Hi
    i m trying to integrate this paypal pro code.. errors occuring. can plz tell which codeigniter version code it is. plz reply as soon as possible
    thanking you

    Reply
    • Hi Sona,

      It’s been tested in the current version of CI. What errors are you getting?

      If you want to contact me directly I’d be happy to help.

      Andrew

      Reply
      • how can i use this code with codeigniter 1.7.3?

        Reply
        • Should just be a matter of uploading all of the files to their corresponding place in your CI structure.

          Reply
  2. Hello,

    First off, thank you for the library. I have a feeling it will make integrating Adaptive Payments a lot easier. I’ve been having a problem though and I was hoping you might be able to help. I’m trying to do an implementation of delayed chain payments, so I am using the PAY_PRIMARY action with the Pay function. I have also set up the $Receivers array so there are multiple receivers. However, when I try executing the payment, it fails with the error being that PAY_PRIMARY can only be used in chain payments.

    What exactly do I need to do so that my request is recognized as a chain payment?

    Reply
    • Hi Cole,

      Are you making sure to set the value for Primary in your $Receiver array to true for one of the receivers? You need at least one primary receiver in the request in order for it to become a chained payment. Otherwise, it would treat is a parallel payment and you’d receive the error you’re getting.

      If that doesn’t seem to be the case send me your controller that you’re working with and I’ll figure it out for you.

      Andrew

      Reply
    • For anyone else that encountered this problem, make sure that when you set the value for Primary in your $Receiver array, that you use an actual boolean, not a string.

      Correct: ‘Primary’ => true
      Incorrect: ‘Primary’ => ‘TRUE’

      The incorrect version is what I tried first, and receive the same error as Cole. After changing it to the correct version, the operation worked perfectly.

      Reply
      • Yeah, I need to get that adjusted. It actually works this way, too…

        ‘Primary’=>’true’

        It just doesn’t like the uppercase value. Sorry if you wasted a bunch of time over that!

        Reply
  3. I have tried to set up delayed chained payment I have set actiontype Primary user it works fine .how to execute delayed chained payment for secondary receiver .

    Reply
    • Hi Jaiganesh,

      In order to do a delayed chained payment you need to set the original ActionType to CREATE and then you’ll make an additional call to ExecutePayment when you’re ready to process the actual payment. I’ve actually got a very small bug in my ExecutePayment function in my library, though, that I’ve fixed but I haven’t yet updated it online. Contact me directly and I’ll make sure yours is good to go.

      Andrew

      Reply
      • Can you please send me the download link for the updated adaptive payment code. I would like to use your code for the delayed chained payment. Please replay ASAP

        Reply
      • can you please tell us when u will update it as it is very badly needed by me….
        whenever i execute Pay-Chained.php in the samples for the chained payment its always returning “Success” in Ack and “INCOMPLETE” in PaymentExecStatus. after that i hit redirect url returned in it. then it shows following message
        “Your payment can’t be completed. Please return to the participating website and try again.”

        can you please help what is the issue…..
        i tried yor solution i.e. given ActionType “CREATE”
        but it did not worked…..
        please help me to solve the issue

        Reply
        • So you’re using my Pay-Chained.php sample without any changes? It sounds like there must be an issue with the sandbox account you’re using. If you want to send me a sample of your config file I’ll see if I can reproduce the problem or find what’s causing it.

          Reply
  4. Thanks for this great library

    Reply
  5. Is there a documentation page for this library?

    Reply
        • Thanks for pointing that out. I had the expiration of the demo card set to 022013 which is now expired, so that’s why it was returning that error. I got that fixed so my demo will work now. Just make sure you’re not doing something similar and you should be fine. Let me know otherwise.

          Reply
  6. Hello,

    Still getting that
    “Your payment can’t be completed. Please return to the participating website and try again.” after payment.

    I just duplicated your variable values to Pay() method in adaptive payment, and just changed the receiver and paypal config with my own details.

    //
    Array
    (
    [Errors] => Array
    (
    )

    [Ack] => Success
    [Build] => 2486531
    [CorrelationID] => a1eda2e87909c
    [Timestamp] => 2012-03-20T01:58:00.075-07:00
    [PayKey] => AP-0GG292857N352033X
    [PaymentExecStatus] => CREATED
    [RedirectURL] => https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=AP-0GG292857N352033X
    [XMLRequest] => ReturnAllen_USPAYhttp://fileserver/tal/paypal/index.php/paypal/adaptive_payments/pay_cancel10.0.1.52USDEACHRECEIVERECHECKBALANCECREDITCARD100.00seller_1332233540_biz@gmail.com123-ABCDEFSERVICEfalsehttp://fileserver/tal/paypal/index.php/paypal/adaptive_payments/pay_return
    [XMLResponse] => 2012-03-20T01:58:00.075-07:00Successa1eda2e87909c2486531AP-0GG292857N352033XCREATED
    )//
    Thanks!

    Reply
    • If you’re getting a successful response back from PayPal, which it looks like you area, but then you’re seeing that message when redirecting the user to the RedirectURL returned by the library, then you’ll need to contact PayPal and get them to fix your account accordingly.

      You can contact their technical support directly by creating a ticket at http://www.paypal.com/mts.

      Just make sure to include a copy of your request and response which is available in the library result as $PayPalResult[‘XMLRequest’] and $PayPalResult[‘XMLResponse’].

      Reply
      • Thanks Angel…

        I’ll forward this to PayPal then, though i’m not sure if i’m going to get a reply as fast as you did.

        cheers!

        Reply
        • just got it working… i just supplied the sandbox app id on the paypal config file. maybe you should include it in your next revision, just saying.

          The Adaptive APIs make use of an AppID value. The AppID value in the Sandbox remains constant, it is:
          APP-80W284485P519543T

          thanks for this great library, saves a lot of time.

          Reply
          • Hmmm…I do see the value included by default in the config file provided with the download. Not sure why you wouldn’t have had it there already. Glad you got it figured out, though.

  7. Is it possible to have “pay now” button (instead of “continue”) with “Set_express_checkout”?

    Reply
    • Yes. In the payments_pro.php controller, the Set_express_checkout function has a request parameter in the $SECFields array called “skipdetails”. If you set this to the boolean value, TRUE, the library will send the request to PayPal in a way that assumes you’ll use PayPal’s pages for your customer review and the button will say “Pay Now” instead of “Continue”.

      You will still need to make the final DoExpressCheckoutPayment call from your application, but the PayerID will be included as a URL parameter on your return URL supplied so you don’t have to call GetExpressCheckoutDetails unless you want/need to for some other reason.

      Reply
      • Thank you very much for your help. I really appreciate all of your hard work.

        Reply
  8. Can you help me? I don’t now what choose.

    Angell-EYE-PayPal-Payments-Pro-PHP-Class.zip
    Pay.php

    It’s best for my needs because: client pay on paypal site (have pay now button) and info about success transaction is on paypal site too. But in this I can’t set items for “payment summary” section.

    Second I use CI Library and payments pro + Set_express_checkout but:

    My cart > Payment summary (can set custom items) > login … and now user have button “continue” and I must acceppt transaction usign “Do_express_checkout_payment”

    Reply
    • Yes, as I explained in response to your previous comment, you can use the “skipdetails” parameter in SetExpressCheckout to enable the “Pay Now” button, but you’ll still need to finalize everything within your application. PayPal will not submit the final DoExpressCheckoutPayment request necessary to complete the payment.

      Reply
      • Do you know why PayPal in this mode does not allow to end transaction when user presses “pay now” button (without DoExpressCheckoutPayment call)?

        Reply
        • That’s just the way the Express Checkout system works. The final payment request always happens within your application. This is actually a good thing in most cases because you can handle any database updates and other automated tasks from within the checkout flow rather than worry about IPN or anything else.

          If you want to have PayPal complete the payment for you you’ll need to switch to Payments Standard. I’d recommend the “cart upload” method of sending data to PayPal.

          Reply
  9. I have one more question.

    1. Set_express_checkout: set amt = ex. 10$
    2. Redirect user to PayPal and summary shows total = 10$
    3. User log in and press “buy now” button (seen 10$).
    4. Do_express_checkout_payment: set amt = 500$
    5. PayPal charges user for 500$!

    Why? User seen in the summary 10%!

    Reply
    • SetExpressCheckout simply prepares a new checkout with the PayPal system. This is not considered as final payment information because lots of things could change after that fact.

      For example, say a customer adds a $10 item to their shopping cart and they immediately go over to PayPal for payment. Well, you may need to include sales tax or a shipping amount after the buyer chooses their shipping address within the PayPal review screen. In such a case you would pass the new total in DoExpressCheckoutPayment in order to get the amount you really need.

      Reply
      • I can do this without user permission, what’s more – user is convinced that he confirm ex. $10 payment, but I charge $500 – it seems to me that’s really big problem and can lead to extortion.

        Reply
        • PayPal vets merchant accounts and keeps their eye on things like that. They might place a temporary hold on funds, for example, to cover a dispute or chargeback on your sales if anything looks out of the ordinary. They take a lot of heat for doing stuff like that, but it helps protect buyers.

          Also, even though you could technically show the user $10 during review and then charge a higher amount later, they would see that in the PayPal emails that are sent and could immediately file a dispute. This action would also cause the amount in question to become held in a pending status while PayPal investigates what is going on.

          So yes, you could do what you’ve mentioned here, but it there are a number of ways it would raise immediate flags and it wouldn’t last long, and the most likely scenario, too, is that nobody would lose any money.

          Reply
  10. hi Angelleye,

    thanks for this great CI class for Paypal payments.. i’m trying to implement Adaptive Payment… but i keep on getting this error: Invalid request: both email and phone cannot be set receiverList.receiver(0)..

    i do have ‘Primary’ => true in the $Receiver array.

    any idea?

    would great appreciate your help

    Reply
    • Hi Jeremiah,

      The email address or phone number is used as a unique value for the user so PayPal knows where to send or pull money from. Their system wants one or the other, but not both. If you just remove the phone number it should work fine with the email alone. If you want to use the phone number you just need to make sure that user has verified their phone with PayPal for use.

      Hope that helps. Let me know if you still have problems.

      Reply
  11. Hi angelleye,
    Thank you for the library. I’m going to build website that sells digital goods (so no need shipping and billing process). I want the paypal process handle paypall/credit card payment as simple as possible for users. Will this library work for this purpose?

    Thanks

    Reply
    • Hi tmengttm,

      Yes, this library will handle that for you just fine. You’ll want to use the Pay.php file with the parameters set to use digital goods. The comments in the file should be self explanatory, but let me know if you have any issues.

      Andrew

      Reply
      • Hi Andrew, thank you for your reply, but where is the pay.php file? is it in this package? i just cannot find it and set parameter to digital goods…

        Thanks!

        Reply
        • Hi Andrew,
          sorry, now i got it.. the comments in the code are clear ; )
          Thanks

          Reply
  12. I used the Chained_payment_demo …How I get the ipn response after the payment…pls help me….

    Reply
    • You need to set the IPNNotificationURL in your Pay request to the URL of your IPN listener.

      Reply
  13. Hello Angelleye.

    First thank your for this library.

    But i have a few problems, maybe i am missing something.

    I autoloaded, the paypal_adaptive library, and i get these errors:

    A PHP Error was encountered
    Severity: Warning

    Message: Missing argument 1 for PayPal_Adaptive::__construct(), called in C:\EasyPHP\www\myjobboardv2\system\core\Loader.php on line 1099 and defined

    Filename: libraries/Paypal_adaptive.php

    Line Number: 49

    A PHP Error was encountered
    Severity: Notice

    Message: Undefined variable: DataArray

    Filename: libraries/Paypal_adaptive.php

    Line Number: 51

    Could you please tell me what i am missning?

    Reply
    • It looks like maybe you didn’t get the config data included when you created the PayPal object. If you want to send me a copy of the file you’re working with I’ll see if I can figure out the problem for you.

      Reply
      • Hi Angelleye,
        Thank you the librarry.
        I’m getting the same error on codeigniter 2.1.3
        Can you be more specific about where to include config data?
        Thanks in advance.

        Reply
        • The config file is /application/config/paypal.php. There are shorthand if/else statements in there so you can populate values for both sandbox and production servers. Then you’ll notice the controllers are already utilizing these congig values. For example, /application/controllers/payments_pro.php is loading up the config data within the constructor by using $this->config->item(‘fieldname’).

          Let me know if that doesn’t help.

          Andrew

          Reply
          • Thank you for your reply.
            No it didn’t work but did following and now its working.

            $config[‘Sandbox’] = TRUE;
            $config[‘APIVersion’] = ‘85.0’;
            $config[‘APIUsername’] = $config[‘Sandbox’] ? ‘mail@somewhere.com’ : ‘PRODUCTION_USERNAME_GOES_HERE';
            $config[‘APIPassword’] = $config[‘Sandbox’] ? ‘23123123’ : ‘PRODUCTION_PASSWORD_GOES_HERE';
            $config[‘APISignature’] = $config[‘Sandbox’] ? ‘longcodecomeshere’ : ‘PRODUCTION_SIGNATURE_GOES_HERE';
            $config[‘DeviceID’] = $config[‘Sandbox’] ? ” : ‘PRODUCTION_DEVICE_ID_GOES_HERE';
            $config[‘ApplicationID’] = $config[‘Sandbox’] ? ‘APP-80W284485P519543T’ : ‘PRODUCTION_APP_ID_GOES_HERE';
            $config[‘DeveloperEmailAccount’] = $config[‘Sandbox’] ? ‘mail@somewhere.com’ : ‘PRODUCTION_DEV_EMAIL_GOES_HERE';
            $config[‘PayFlowUsername’] = $config[‘Sandbox’] ? ‘tester’ : ‘PRODUCTION_USERNAME_GOGES_HERE';
            $config[‘PayFlowPassword’] = $config[‘Sandbox’] ? ‘Passw0rd~’ : ‘PRODUCTION_PASSWORD_GOES_HERE';
            $config[‘PayFlowVendor’] = $config[‘Sandbox’] ? ‘Colin Roberts’ : ‘PRODUCTION_VENDOR_GOES_HERE';
            $config[‘PayFlowPartner’] = $config[‘Sandbox’] ? ‘PayPal’ : ‘PRODUCTION_PARTNER_GOES_HERE';
            $this->load->library(‘paypal/Paypal_adaptive’,$config);

  14. Thanks for creating this! I’m looking forward to trying it out.

    Reply
    • Hope you like it. Let me know if you have any issues.

      Reply
  15. Hi ,

    I Have Used the Paypal Codeigniter PLugin , I Have a doubt that How can I Set the Application Id for Paypal live mode , Now I am in Paypal Sandbox Mode .

    Reply
    • In order to get a live Application ID you have to submit your application for approval to PayPal through http://www.x.com. Once you’re approved they supply you with a live App ID.

      Reply
  16. hi angelleye,
    how are you.
    actually i am facing a problem to create recurring profile in codeigniter. i am using you library.
    i have done do direct payment through your library and it was working fine.

    but i problem is when i am using
    ” Create_recurring_payments_profile ” function
    and fill all required fields ..when i hit on that function then i am facing a error and error is given below:

    Array
    (
    [0] => Array
    (
    [L_ERRORCODE] => 10001
    [L_SHORTMESSAGE] => Internal Error
    [L_LONGMESSAGE] => Timeout processing request
    [L_SEVERITYCODE] =>
    )

    )

    please tell me what kind or error is this and reply me asap

    Thanks
    sandeep dhiman

    Reply
    • That error typically means exactly what it says and happens when PayPal’s servers are getting a little over worked. Are you still having this same issue now? It generally doesn’t continue for very long.

      Reply
  17. hi angelleye, first of all, thanks for your library. You save my much more time!

    I use Pay_chained_demo(function) and I use delayed chained pay. It was successfull working but I can’t return paykey etc. variables. how can I return this informations(getting from paypal) on pay_return(function).

    Reply
    • I’m glad it’s helping.

      I’m not sure I understand your problem. The PayKey would be returned in the Pay response. Are you saying you’re not getting this?

      Reply
        • The PayKey is returned in the Pay response. It would be available in $PayPalResult[‘PayKey’] if following the samples in my library.

          Reply
          • Really thank you angel. how can I use $PayPalResult[‘PayKey’] when process complete and returned. It is automatically returned pay_return(){ function and I lose all of them(paykey etc.). http://paste.ubuntu.com/1073236/

          • I’m not sure if I’m following what you’re trying to do. You might want to extend the class and setup your own setter and getter functions. You could also just use session data. All I can tell you is that when the response comes back in your Pay_chained() function, or whatever it is you’re using, the library result will include all of the data returned from PayPal. There are lots of ways to pass it around from that point on. Just a matter of what works best for you.

  18. Dear angelleye,
    How can I integrated my shopping cart and the code??
    FYI, I have my own shopping cart. But I don’t really know how to plant your code to my shopping cart.

    Please help me!

    Reply
    • Hi Ardo,

      What exactly are you trying to implement? Express Checkout, Payments Pro, Adaptive Payments, or what?

      I offer training services. That may be the best thing for you if my demo video for the library doesn’t help out enough.

      Reply
      • I think I would like to use adaptive payments. In the checkout page I have a Paypal button, but I don’t know exactly how to link it with the code you have given.
        Please help me!

        Reply
        • Hi Ardo,

          Did you watch the introduction video to my library? That should help. If not, I can offer you training as that is one of the paid services I provide. Contact me directly for more information on that.

          Reply
    • That’s the one I meant. I guess it is a little blury, but I figured you’d still be able to follow it since most of the code is already setup for you in the files that come with the library.

      I’m happy to provide more direct help, but we’ll need to schedule a training session for that.

      Reply
      • Thanks for the prompt response. You are really kind. absolutely. But it is impossible for direct help because I am in Indonesia. Or may be you have another choice.

        Reply
        • Impossible? Why is that? We can screenshare with each other no matter you’re at in the world.

          Reply
          • Oh.. Ok if that’s so can I have you email address?

  19. Hi, I’m trying to call the Paypal “Set_express_checkout” Function.

    1 – At some point, you ask for the “buyerregistrationdate” in which I’m supposed to pass a date.

    I send this date :

    $time = date ( ‘c’);
    $time= substr($time, 0, 19).’Z';

    in order to have this date :

    > 2012-07-14T01:19:01Z

    since [they are asking for][1] this format.

    But I got this error message coming back from Paypal when trying to process to the checkout :

    > [0] => Array
    > (
    > [L_ERRORCODE] => 10004
    > [L_SHORTMESSAGE] => Transaction refused because of an invalid argument. See additional error messages for details.
    > [L_LONGMESSAGE] => RegistrationDate of buyer is invalid.
    > [L_SEVERITYCODE] => Error
    > )

    I also tried this date format :

    $time = date ( ‘c’);

    To get the exact ISO format but that doesnt work neiher.

    Does anyone has any idea about which format should I use ?

    Thanks !

    2 – Another Question, I don’t understand how do I het back the token from paypal to pass it in the correct field in the Do_express_checkout_payment(). What should I do ? Should I get it form the Get_express_checkout_details($token) function ? How ?

    Many Thanks !

    Reply
    • I just tested one with the following format and it worked successfully: 2012-07-14T00:00:00Z

      Reply
      • I’ve just copy and Paste your date, so basically here is what I have in the Set_express_checkout() function :
        ‘buyerregistrationdate’ => ‘2012-07-14T00:00:00Z’
        But I still hqve the same error : [L_ERRORCODE] => 10004
        [L_SHORTMESSAGE] => Transaction refused because of an invalid argument. See additional error messages for details.
        [L_LONGMESSAGE] => RegistrationDate of buyer is invalid.
        [L_SEVERITYCODE] => Error

        I’m I doing something wrong somewhere ?
        Thanks for your help :)

        Reply
        • Email me your Set_express_checkout() function so I can take a look at that and I’ll see if I can find your problem.

          Reply
          • Thank You for your great support ! Okay so I figure that out. What happened is that when I saw that error in the error view, I though it was coming from the buyerregistrationdate field of the BuyerDetails Array when in fact it appears to be the buyerregistrationdate field of the SECFields Array. That’s why ! If I may give you an Advice, you should add in the comment section of this line that this field is required and the format is ISO something.
            Okay so now I’m working on how to get that token from paypal, I don’t understand how I can get it back from paypal since nothing is passed through the GET parameter when returning to my returnURL and Paypal is asking me for the PayerID ….

          • That field is actually not required, but if you’re using it, it does indeed need to be in the correct format. I’ll have to update that comment section. I usually do include formatting information. Must have just missed that one.

            When working with HTTP web services you won’t be using $_GET, but instead you’ll be working with $_POST. It really works very similar, though, and my library handles all of that for you.

            You’ll notice the $PayPalResult variable being used to store what the library returns. This will be an array of all the response data from PayPal, so for the token you’d use $PayPalResult[‘TOKEN’]. I like to save it in a session variable so it’s available throughout my app, because the next step is to redirect the user to PayPal.

            For that, you’ll notice the library creates this for you, so you can use $PayPalResult[‘REDIRECTURL’]. That will be the value of the PayPal URL with the token appended as required. Simply send the user to that URL and they’ll be able to sign in and continue the flow.

            Just remember they’ll be sent back to your ReturnURL and then you’ll have to complete the process with GetExpressCheckoutDetails (optional) and DoExpressCheckoutPayment (required).

      • Thank you so much for your help. I’ve almost figured out that process. Thus, I have a last error message when calling the Do_express_checkout_payment() method : The PayerID value is invalid…. Normal, I never specified it, because I dont have it.
        I see in your comments that I get it either from the GetExpressCheckoutDetails or from URL. But I have absolutely nothing passed in my url and the array returned from GetExpressCheckoutDetails doesnt contain any PayerID, i have a lot of information, such as the token, the check out status, the correlation ID, but no Payer ID .
        So I’m wondering if I didn’t forget something in the process, let me tell you why : My understanding of the Express method is that the user is redirected to paypal after the Set_express_checkout, where he has to login and accept the transfer before going back to my confirmation page where I call the Do_express_checkout_payment(), to make the transaction. But when I try by myself, with sandbox, I’m not redirected to paypal, and do not have to login at some point (maybe because I’m already login in my sandbox account ?) .
        So I’m wondering if that’s why I don’t get any Payer ID, if I’m wrong in my understanding of the process, or if I forgot to redirect the user to Paypal at some point ( at the end of Set_express_checkout method ? in the case the ACK is successful ?)

        Thank you for your time !

        Reply
        • When you make the SetExpressCheckout call you’ll get $PayPalResult[‘REDIRECTURL’] back in the result array. You need to add a redirect to that URL, which is where the user will sign in to PayPal to continue the process.

          Once they’ve done that they’ll be sent back to whatever value you specified as the ReturnURL. Here is where you’ll get a PayerID as a URL parameter if you used the SkipDetails parameter in Set_express_checkout, or if you left that blank (or had it set to false) then you would have to call Get_express_checkout_details() to get the PayerID.

          If that doesn’t help I could always schedule a 1 on 1 training session with you, but I’d have to bill you for that. We should be able to get you going within an hour, though. Contact me through my contact page if you’re interested in doing that.

          Reply
          • Ok Thank you, I’ll try by myself first today and let you know by 1 or 2 days if I need more help.

            Thank you for you detailed answers Anyway:)

      • When I do print_r ($PayPalResult) after $this->paypal_pro->APICallSuccessful($PayPalResult[‘ACK’]), at the end of the Set_express_checkout() method I can’t see any REDIRECTURL. the only fields I have are :
        [TOKEN] => EC-1UG79081U82816435
        [TIMESTAMP] => 2012-07-16T17:14:58Z
        [CORRELATIONID] => a5a6568927660
        [ACK] => Success
        [VERSION] => 85.0
        [BUILD] => 3300093
        [ERRORS] => Array
        (
        )

        [REQUESTDATA] => Array

        Why don’t I get a REDIRECTURL here ? Thank you :)

        Reply
        • I found why, I had to change if(isset($NVPResponse[‘TOKEN’]) && $NVPResponse[‘TOKEN’] != ”) to if(isset($NVPResponseArray[‘TOKEN’]) && $NVPResponseArray[‘TOKEN’] != ”) in paypal_pro->SetExpressCheckout since $NVPResponse[‘TOKEN’] was considered as null .. but not $NVPResponseArray[‘TOKEN’]

          Reply
  20. hello

    i am getting this error
    Array
    (
    [0] => Array
    (
    [L_ERRORCODE] => 10747
    [L_SHORTMESSAGE] => Invalid Data
    [L_LONGMESSAGE] => This transaction cannot be processed.
    [L_SEVERITYCODE] => Error
    )

    )
    and where i can fine this details in config file

    $config[‘ApplicationID’] = $config[‘Sandbox’] ? ‘APP-80W284485P519543T’ : ‘PRODUCTION_APP_ID_GOES_HERE';
    $config[‘DeveloperEmailAccount’] = $config[‘Sandbox’] ? ‘rakesh@qualinsoft.org’ : ‘PRODUCTION_DEV_EMAIL_GOES_HERE';

    please let me know ?

    Reply
    • i mean where i can find ApplicationID and DeviceID with sand box account

      Reply
      • The application ID that’s included in the config file is a global ID for developers to use in the sandbox. The DeviceID is any ID you want to send for the individual device being use (like a phone’s IMEI number) but it’s optional. I don’t think that’s your issue here.

        Reply
    • What API are you calling? The result will include an XMLRequest and an XMLResponse. Send those to me so I can take a look and I’ll see if I can find your problem.

      Reply
  21. Hi Andrew,

    I’m having problem executing the PreapprovalDetails API. PayPal always returns an error saying ‘Invalid request parameter: preapprovalKey cannot be null’ although the request XML contains a valid preapprovalKey.

    The request XML:

    ReturnAllen_USPA-XXXXXXXXXXXXX

    The response XML:

    2012-07-23T18:55:12.284-07:00Failureed7792b70de40DEV580022PLATFORMApplicationErrorApplicationInvalid request parameter: preapprovalKey cannot be nullpreapprovalKeynull

    I found the same question is asked in PayPal forum here but no answer is posted to the question. Do you have any idea what is wrong?

    Reply
    • Hi Stanley,

      I think it’s a problem with the version of my library you have. Contact me directly through my contact page and I’ll reply with an updated version that should get rid of that error for you. I’ve been meaning to get the new version posted but I have a few more things I want to do it first so I just haven’t gotten it up yet.

      Reply
  22. Hi friend ,
    I found your plugin thanx for that.and now I want to use the adaptive payment for below require pls help me to achieve it And I don’t know how to hold the money payal

    I need the help to integrate the paypal process in my application.This process is not look like normal transaction.Here I need to make the transaction from one account (buyer) to more than one account (seller,siteadmin). After the transaction amount need to be in hold-on state in site-admin’s paypal account for some days.It will relesed by the admin when he needs .
    Please help me soon..

    Reply
    • Sounds like you’re trying to implement a delayed chained payment solution. You can find details about that starting on page 23 of the PayPal Adaptive Payments documentation. Once you have the flow down in your mind my library will help you build the calls very easily.

      If you need more help beyond that I could schedule a training session with you and give you direct help. Of course, I do bill for that.

      Reply
      • Thanks angelleye I can read it.

        Reply
  23. Hello,

    I’ve successfully implemented the library thanks to you :)
    But now I turned it out in prod, I have a problem with the check out express function : sometimes, It get me back on the website, sometimes it works fine, and sometimes I get this error message :Bad Request

    Your browser sent a request that this server could not understand.
    Size of a request header field exceeds server limit.

    Do you know where is that coming from ?

    Thank you :)
    You can try it by yourself on the website

    Reply
  24. Hello,

    Thanks for this great Library. Very helpful :) I’ve implemented te library, Everything was working fine until I turned it on production the other day. When trying to get to my set_express_checkout function, at the time the function proceed to the call, I have a BAD REQUEST error message : “Your browser sent a request that this server could not understand.
    Size of a request header field exceeds server limit.
    Cookie: Apache=10.19 …. ”
    Why do I get this ? How could I fix that ?
    Thank you very much for your help !

    Reply
    • I think I’ve seen that before from corrupted cookies. Can you clear your cookies and try again or maybe try a different browser?

      Reply
      • Yep you’re right,

        isn’t it any other way to avoid this ?

        Reply
  25. Hi Andrew,

    I’m trying to figure out a way to use your library to facilitate payment from one user of my site to another user of the site, i.e. a simple payment where I am neither receiver nor sender, but the facilitator for the payment. Basically this but having only 1 payment receiver. Can you help?
    Any feedback will be greatly appreciated.

    Aloha.

    Reply
    • Sorry for the delay getting back to you. I’ve been out of town.

      To make a payment to a single receiver you still use the Pay API but you only include a single receiver. The process is virtually the same. Just a matter of whether you include a single or multiple receivers or not.

      Reply
  26. Hello Man,

    I cant do a 1 to 1 payment… I am using the Adaptive_payments/pay method. AN whe I put only one value for $reciever in the $recievers array I get this error:

    [Message] => You must specify only one primary receiver and at least one secondary receiver

    look: https://www.supertcg.com/adaptive_payments/pay

    $FundingTypes = array(‘ECHECK’, ‘BALANCE’, ‘CREDITCARD’);

    $Receivers = array();
    $Receiver = array(
    ‘Amount’ => ‘100’, // Required. Amount to be paid to the receiver.
    ‘Email’ => ‘ja@emog.com.br’, // Receiver’s email address. 127 char max.
    ‘InvoiceID’ => ‘65465465’, // The invoice number for the payment. 127 char max.
    ‘PaymentType’ => ‘GOODS’, // Transaction type. Values are: GOODS, SERVICE, PERSONAL, CASHADVANCE, DIGITALGOODS
    ‘PaymentSubType’ => ”, // The transaction subtype for the payment.
    ‘Phone’ => array(‘CountryCode’ => ”, ‘PhoneNumber’ => ”, ‘Extension’ => ”), // Receiver’s phone number. Numbers only.
    ‘Primary’ => ‘true’ // Whether this receiver is the primary receiver. Values are: TRUE, FALSE
    );
    array_push($Receivers,$Receiver);

    Reply
    • If you’re using a single receiver don’t set it as primary. Just leave that blank. You only use that if you’re using multiple receivers and you want to do a chained payment.

      Reply
  27. Thanks a lot for the great library.

    A small typo. In Create_recurring_payments_profile, for $ScheduleDetails it should be autobilloutamt not autobillamt.

    Reply
    • Thanks for pointing that out! I’ll have it fixed in the next update.

      Reply
  28. Hi Angell, Thank you for the great Library. The scenario is I am developing an application to sell my product online. I have paypal account. For this case which library I should use? Thank you.

    Reply
    • I’d recommend starting with Express Checkout. This includes SetExpressCheckout, GetExpressCheckoutDetails, and DoExpressCheckoutPayment. This will allow buyers to pay using PayPal or a credit card if they don’t have a PayPal account.

      Reply
  29. hi Andrew Angell , thanks for share!

    Reply
  30. Dear Andrew,
    i am getting an error when transferring money to a personnel account,
    In this case amount is transferring properly and getting below error :

    ” This transaction has already been approved. Please visit your PayPal Account Overview to see the details. ”

    In this error showing page when i click the return button it goes to the cancel page .

    reply soon.

    Thanks
    Raj

    Reply
    • It sounds like you must be using a Preapproval key in your Pay request, in which case the payment happens instantly without any redirect over to PayPal. As such, when you do redirect over to PayPal with that PayKey, they tell you it’s already processed, because it was processed with the Preapproval profile.

      When using Preapproval keys you won’t do the redirect. You’ll get your new transaction ID back right away, and you would simply display a completed message of some sort within the application (and that’s not even always necessary depending on your use case.)

      Hope that helps. Let me know if I’m incorrect on that, but I’ve never seen that message unless that was the case.

      Andrew

      Reply
      • What is the use of PreapprovalKey? From where should we get this?

        Reply
        • Well, if you’re unsure of what it is or how to get it then that would disprove my theory. Again, though, I’ve never seen that particular error unless you’re already using a Preapproval key.

          If you want to send me what you’re working with I’ll take a look and see what I can figure out for you.

          Andrew

          Reply
  31. I am stuck with another error….

    When I am doing a transaction, paypal returns to the success page..But still the transaction is not working with paypal sandbox ..is it hte error with sandbox

    Sarath

    Reply
  32. Hi Andrew Angell.

    I need to do a project with paypal from scratch and I do not know much about this librery you’ve created with codeigniter could give me a link where I can learn all about the codeigniter paypal library thanks

    Reply
    • Unfortunately, I don’t have much detailed documentation yet. If you’re familiar with CI in general, though, using this library should be pretty simple. It’s just a matter of knowing which PayPal API calls you need to make. I do have a basic demo that should give you an idea of how to use this thing, and I can offer 30 min of free training, too, should you need it. We could do a screen share and I can walk you through everything.

      Reply
  33. Hi! I have just started using CI and I can say I have the hang of it already but after I downloaded your files and tried to run them there are a couple of errors like this:

    Severity: Warning

    Message: highlight_file(C:/xampp/htdocs/demo/codeigniter/includes/get_balance.php) [function.highlight-file]: failed to open stream: No such file or directory

    Filename: views/payments_pro_demo.php

    Line Number: 64

    is your files for download contain the includes folder? coz the one I have right now doesn’t

    thanks!

    Reply
    • Ah, that view file was setup to pull the code from an include on my server and display the code for demo/display purposes here: http://www.angelleye.com/demo/codeigniter

      If you click on the Payments Pro link there you’ll see the sample code. I should probably just remove that from the download file. It’s not something you’ll be using directly anyway. You would be creating your own controller functions (or building off the included ones) and loading your own views accordingly.

      That said, you mentioned you’re just getting comfortable with CI…is that because a current project requires it or are you using it because that’s what this library is built for? If that’s the case I have a separate version of the library that is a general PHP class, not specific to CI. You may want to check it out, too. It’s basically the same thing but without any specific framework behind it.

      Reply
  34. how i can make parallel payment with this library.Where i have to change the code??
    Thanks in advance

    Reply
    • Sorry for the delay getting back with you. I’ve been out of town (at PayPal Leader’s Day) and I just got back.

      For a Parallel payment you have a couple of options. You could use Express Checkout or the Pay API. If you want to contact me directly I’d be happy to discuss the differences with you and get you where you want to be.

      Reply
  35. Hi Andrew,

    First of all many thanks for your great library.

    Second of all, I have a few questions regarding best practices.

    1. Is it safe to save the success response from do_direct_payment into the database to use it to trigger orders and issue invoices?

    OR

    2. Should I use IPN and use the post data from that to save it into the database and then trigger backend operations such as invoicing?

    Some people say you don’t need IPN if you use do_direct_checkout (because you never leave the site) but some say, you should still use it and save that data…

    What is the best and safest thing to do according to you?

    Should I only use IPN if the customer decided to use Express Checkout instead of using do_direct_payment or…?

    Thanks for your help and advice in advance.

    Zoltan

    Reply
    • Hi Zoltan,

      I like to use IPN with pretty much any solution I ever setup. It’s just a nice additional place to save retrieve and save data, and it’s also great for automating tasks based on payments, refunds, disputes, etc. Also, it’s nice because it works with all the PayPal products, so you’d still get the same result regardless of whether you’re using Payments Standard, Express Checkout, Adaptive Payments, Payments Pro, etc.

      That said, it’s perfectly fine to save API response data and process it accordingly within your checkout flow. I make this a standard practice just so I can refer to my API logs if things don’t go as expected and I need to see exactly what was sent and returned for any given transaction. In fact, I often relate this API log data back to my IPN data based on the transaction ID.

      Hope that helps.

      Andrew

      Reply
      • Hi Andrew,

        Great, thanks for your reply. It definitely helps me figure out what data to save and when to save it.

        One more thing that you might be able to help me with…I’ve IPN setup on my system, and when I test it with PayPal IPN tool the response I get is VERIFIED, the POSTA data is good and everything works fine. However, when I test it with my own cart the do_direct_payment gives me SUCCESS but the IPN response I get from PayPal regarding that transaction is INVALID even though the transaction is COMPLETE, the type is ‘Transaction made’ and the HTTP response code is 200. The POST array in both cases contains all the information regarding the transfer, and to my naked eye it should be verified.

        Do you have any hunch why I receive the INVALID response for my transfer but not for the one sent through the test tool?

        Again, sorry for taking up your time and many thanks for any help in advance.

        Zoltan

        Reply
        • Are you using my IPN solution or something you did yourself? You just need to make sure all of the data is POSTed back to PayPal exactly the same way they sent it to you.

          Reply
          • I’m using a different IPN library with CURL. But I have no idea why it works with the PayPal’s test tool data but not with my own POST data.

            I’ve also tested it with your IPN library tonight, and the strange thing is that I’ve received 2 success emails, but the IPN status for each order is actually Invalid, even for the one from PayPal.

            I have no idea what’s causing it to return Invalid instead of Verified.

  36. download does not include the needed demo folder?

    Reply
    • Sorry for the delay getting back to you. Were you able to get this figured out or are you still having trouble?

      Reply
  37. Hey Andrew,

    Hope you are doing good. You saved my day. Thumbs up for your library. It worked like charm. I have just started with CI and I didn’t find it difficult to use your library.
    You have developed it smartly. Great job done Andrew.

    “Human Knowledge belongs to the world”

    Reply
    • Hi Irfan,

      I appreciate the kind words. I’m glad it helped you out!

      Reply
  38. In this path it was error,How to utilize?Send me the idea,Want to implement it immediately.It’s urgent buddy

    Reply
    • Very sorry for the delay getting back to you. Did you get this resolved or are you still seeking help?

      Reply
  39. In the Pay_chained_demo() example on your site paypal/adaptive_payments/pay_cancel and paypal/adaptive_payments/pay_return are missing and also not included in the angell-eye-paypal-payments-pro-codeigniter-library.zip It would be nice to have those examples.

    Reply
    • Are you talking about those views? Sorry for the confusion. Those values really weren’t intended to be live demo values. They were simply to show that you should include some value for your return and cancel URL’s. I do plan on making those active at some point, but it would really be nothing more than creating those view files and doing what you want with them. My demo will probably do nothing more than display a basic message.

      Reply
  40. Hi Andrew

    first of all thanks for this library, but i would like to see if you can help me with an error “This transaction cannot be processed. Please enter a valid credit card expiration year.” in test environment, i can see the balance but i know is that kind of error sound easy to solve but i am not sure what is because i try my testing account and it works in your site demo adaptive payment best regards

    Reply
    • by the the problem is using paypal pro

      Reply
    • Hi David,

      Your request must not be including the expiration date correctly for some reason. If you want to send me your file you’re working with I’ll see if I can figure out what’s up.

      Reply
  41. Hello Andrew.

    Thanks for the great library, this is just what I need, but…

    Maybe this is something what a real beginner would do, still: I downloaded, unzipped, uploaded etc the files to my server. Then I entered data to config/paypal.php config file (my Sandbox API key etc…), Next, I wanted to test the adaptive_payments/pay function, but I got Codeigniter’s message: The configuration file paypallib_config.php does not exist.

    Then I deiscovered that trying to get any of demo functions actually generates this error.

    So, I’m stucked… Please, tell me is it something with your library, with it’s installation, or with my app..? You can reach my app on eb-dev2.myoutdooradventurecanada.com/en

    Thanks in advance,
    Dušan

    Reply
  42. Hello again, Andrew!

    Regarding my previous comment: found the cause of the error… sorry for bugging you… :)

    cheers
    Dušan

    Reply
    • Glad you got it worked out. Let me know if you have any other questions or concerns.

      Reply
      • Hello, (once) again, Andrew.

        After two weeks of doing something else, I am at the point when I have to implement your library. SO, I have a question.

        Which library would you recommend for my case, Adaptive Payments or Payment Pro?

        What I need to do: enable visitors on the site to pay with their Paypal account (or credit card). There is only one item per transaction, it is a service, not a material or digital good, so the shipping address is not really important – I will treat it as the billing address, the address that Paypal account holder has with their account.

        Basically, that’s it… Thanks in advance for your response.

        Cheers,
        Dušan

        Reply
        • I would recommend using Express Checkout, which is part of my Pro class library. It consists of SetExpressCheckout, GetExpressCheckoutDetails (optionally), and DoExpressCheckoutPayment. In your SEC request, set SOLUTIONTYPE=Sole and LANDINGPAGE=Billing. This way it will present the option for non-PayPal users to pay with a credit card and they won’t be forced to create an account. The payment will happen on PayPal’s page, though, and will redirect back to your site.

          If you want to process credit cards directly then you’ll actually need to activate the Payments Pro product on your PayPal account. Then you could setup a full credit card form on your own site and the buyer wouldn’t have any idea PayPal was still processing it in the background. In this case you would use DoDirectPayment or my PayFlow class library depending on which version of Pro you get setup with it on your PayPal account.

          Reply
          • Wow.. that is a complete and very very quick answer! Thank you Andrew!

          • How to activate the payment product in paypal test account ?

          • What product are you trying to activate?

          • dodirect payment not working with my sandbox test account credetials.But it is working when using the credentials that you have given in the library.Can u please tell me where did i made a mistake?

          • What error are you getting?

          • It is showing the error as: This transaction cannot be processed due to an invalid merchant configuration.

          • That means you don’t have Payments Pro (DoDirectPayment) enabled on your account. If you’re sure that you do have Payments Pro, then you probably have the PayFlow version and you would need to use the PayFlow gateway instead of DoDirectPayment.

          • how to enable payments pro in my account please tell me i am new to paypal.

          • You can apply for Pro on a live PayPal account here.

          • can u please send me the way to activate the pro on live account in paypal

          • If you apply at that link I sent that will begin the process. Then just follow the instructions in the email(s) you get from that.

          • How to make the sandbox test account as live account for payments pro

  43. Hello,

    Do you plan to move your library to Github/Bitbucket?
    I just found the bug in file Paypal_adaptive.php:1383 and wanted to share it.

    Thanks

    Reply
    • Sorry, not 1383, Paypal_adaptive.php:1381
      $XMLRequest .= $PaymentPeriod != '' ? '' . $Memo . '' : '';

      Reply
      • Thanks for bringing that to my attention.

        Reply
    • Yes, the next update will be on Github and I’ll manage it from there from then on. I’m still trying to get a solid grasp of using Git in general or I’d have already had it done.

      Reply
  44. I am interested in using this codeigniter package.
    We are using a certificate and im not sure how to go about setting that up. can you help?
    Thanks

    Reply
    • First, I would ask why you want to do certificate mode..?? Signature mode is a lot easier to work with.

      Reply
      • I am not very familiar with paypal code at all. Personally i try to avoid it. Currently we have a certificate setup so i was just going with what i have. Are security risks with signature over certificate?
        Im open to try anything. thanks

        Reply
        • No, the security is still solid as long as you protect your credentials accordingly. Just don’t want to let those values get in the hands of the wrong people. If you’re already working with certificate then it should just be a matter of including the path to the cert file in the class file. If you look in the actual class you’ll see a PathToCertKeyPEM parameter with a current bogus value of /path/to/cert/pem.txt. You just need to update this with your actual path to your pem file. I don’t have a specific setter method included for that parameter, but you can update it using $PayPal->PathToCertKeyPEM = ‘your value’ from your caller file after setting up the PayPal object.

          Reply
  45. Hey Andrew,

    I need your one favor.
    For pro recurring shall I use this method “Create_recurring_payments_profile”.
    This method creates recurring payment profile and returns profileid of the user whose card info we used for payment. Am I right.
    So what shall I do with this profile id and And how I use this profile id for future to make recurring payment. Do I need to use another method when the billing period is due for the same user.
    I am little confused like how it works. Please guide me.

    Regards.

    Reply
    • Yes, for Pro recurring payments you would use CRPP as you mentioned. That profile can be stored in case you need to update it in the future, but the payments will happen automatically. You don’t need to do anything to trigger future payments. That’s what the PayPal profile handles for you. It will simply bill the amount automatically depending on how you have it setup (weekly, monthly, annually, etc.)

      If you’re working with variable amounts that need to be charged (so the amount is not the same every time) you would need to use a preapproval profile or reference transactions. If that’s what you’re after let me know and I can provide more details on that.

      Reply
      • Hi Andrew,

        Thanks for your valuable feedback. I really appreciate it. I have created one test recurring profile by following your guide lines and used CRPP method. I have made billing period every day for test purpose. Now each day I shall get notification that this much amount has been paid to you by this user. Am I right and if I didn’t get this. Means then I have done something wrong. I will let you know.

        Thanks for your time.

        kind Regards.

        Reply
        • Yes, that should do it as long as your request was generated to correctly portray what you’re after.

          Reply
          • Hi Andrew.

            I am getting this notification in my sandbox with this heading “An automatic payment from testname new failed”

            I have used your dummy credit card info. The recurring profile is being created successfully. But for auto billing it displaying this info in the sandbox notification
            “The automatic payment from testname new has failed”. I am not getting what is the cause for this failure.

          • I would recommend trying some different test card details. The one I’m using could have been used so many times in their sandbox that it’s no longer being accepted. I’ve seen that happen with test card numbers in the past. I’d recommend Googling a site that will generate random numbers for you or just use an old expired card of your own for testing.

  46. I have gone thru the pdf completely.
    Apologies, but I am still not sure how to handle it.(my first time)
    Buyer deposits money (Escrow) for the seller
    Seller sees the amount
    seller ships the item to the buyer
    buyer releases the money once item recd.

    now here the site admin (middleman) , will deduct 10% from the buyer and 3% from the seller.

    please help me with a step by step guide on how i can achieve this.
    it would be great if you can provide me a piece of code for the same.

    regards.

    Reply
    • What you want to do is a delayed chained payment. Read all of the details about that in the PayPal Adaptive Payments documentation. It allows you to setup a split payment, but delay the secondary payments until you trigger them, which can be done up to 90 days after the original transaction.

      You’ll call the Pay API using PAY_PRIMARY and you’ll see a primary receiver and at least 1 secondary receiver. When that payment occurs, the primary receiver will receive the funds in their account. When you want to trigger the secondary payments you call the ExecutePayment API.

      Hope that helps.

      Reply
  47. Hi Andrew,
    First of all thanks for creating such great library for php and furthermore for Codeigniter. I am new in Paypal integration. Actually I am creating one website thta is on ecommerce based.I seen your Library and Paypal Intigration wizard.I got Properly Integration wizard from paypal. But I not got the your library flow So can you explain me How I can use your Library. And which controller are useful for me.
    Thanks
    Balu Raut

    Reply
    • Hi Balu,

      The library provides a controller for all the standard API’s (express checkout, dodirectpayment, auth and capture, transaction details, recurring payments, etc.) Then there is a separate controller for the Adaptive Payment stuff, and yet another for the PayFlow stuff. So, depending on what API’s you’re using you can just open up that controller, find the method that matches the API call you want to make, and fill in the parameters accordingly.

      Reply
  48. hi, thanks for your great work .. i have a ecommerce site so people pay there for buying product .. i am confused which library should i call for paypal checkout for the customer .can you help me as i am new to paypal api ? and i understand that for creditcard checkout .. do_direct_payment would help ..
    thanks

    Reply
    • For PayPal payments you can either use Express Checkout, which consists of SetExpressCheckout, GetExpressCheckoutDetails, and DoExpresscheckoutPayment, or you can use the Pay API. For a standard website shopping I would recommend Express Checkout.

      Reply
      • [L_ERRORCODE] => 10004
        [L_SHORTMESSAGE] => Transaction refused because of an invalid argument. See additional error messages for details.
        [L_LONGMESSAGE] => RegistrationDate of buyer is invalid.
        [L_SEVERITYCODE] => Error

        this is coming up while set express checkout .. is the
        buyer details is required ? if required which i should put
        thanks for your support .. And one more thing in config file
        i saw pauFlowUsername and Password .. what the things is for ?

        Reply
    • I don’t have IPN built into my library as of now, no. Sorry. It’s coming in the future, though!

      Reply
  49. Hi, i have a problem getting the IPN messages(the payment works well), could you help me?

    in $PayRequestFields:

    ‘IPNNotificationURL’ => base_url().’member/ipn_handle’,

    the function:

    function ipn_handle(){
    $new_member_insert_data = array(
    ‘paypalId’ => $this->input->post(‘auth_id’),
    );

    // FAZER DENTRO DE MODEL!!!!!!!!!!!!!!!!!!!!!!!!!!!
    $insert = $this->db->insert(‘money_transactions’, $new_member_insert_data);

    }

    Reply
    • Are you not getting anything at all or are you getting data but it’s not verified?

      Reply
  50. hello andrew, can you help me setup the IPN Notification listener . i dont know which function on the library should i use . thank you .

    Reply
    • My class library doesn’t yet have IPN included so you’d have to build your own child class for that. I do plan on adding it in the future, though. I also do have a separate IPN solution you might find useful, but it’s not MVC based.

      Reply
      • yeah, i have read and downloaded your IPN solution tutorial, but i dont understand it clear enough. i mean , convert it in MVC way. i used ci in my app, can you tell me where i can find some tuts about the API of IPN Notifier maybe i will try to make a lib based on your code in IPN solution.
        At last this library is so cool you know. You are the best.
        thank you brother.

        Reply
        • PayPal provides pretty good documentation for IPN. That should be enough for you to extend the library to include it. You could probably also find existing CI libraries for handling IPN. I haven’t searched myself, but I’d be surprised if there was something out there already.

          Reply
  51. Hi, such a great library, thanks.

    I have two questions:

    1.It seems though the demo data is still outdated, I was running payments_pro/do_direct_payment_demo method and first I needed to change the expiry date which was ‘102012’. Now I’m facing another error:

    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
    )

    )

    2.I want to setup regular membership subscription on my website and wonder if you would know what are the steps I should follow to get the functionality working using your library. I know I should submit the data using Recurring Payment API but there are a number of methods and I’m not sure what’s the correct business logic. I think people are quite into Recurring Payments but there’s very little information on the internet, and it would be perfect to just grab a tutorial and have it done once forever lol

    Thanks again.

    Reply
    • Just wanted to add that’s I’m testing it with my own sandbox account.

      Reply
      • The sandbox account you’re using isn’t setup for Payments Pro (DoDirectPayment). Get that enabled on there and you’ll be good.

        Reply
    • Ok, it requires more education to have it working. The website helped a lot, check it out https://www.x.com/developers/community/blogs/pp_integrations_preston/testing-paypal-payflow-gateway
      So my code looks like that now:

      Array
      (
      [TIMESTAMP] => 2013-05-03T15:26:05Z
      [CORRELATIONID] => 22b6378decc25
      [ACK] => Success
      [VERSION] => 85.0
      [BUILD] => 5715372
      [AMT] => 100.00
      [CURRENCYCODE] => USD
      [AVSCODE] => X
      [CVV2MATCH] => M
      [TRANSACTIONID] => 6JX016693V643133R
      [ERRORS] => Array
      (
      )

      [REQUESTDATA] => Array
      (
      [USER] => ukpro_api1.interpreting-centre.com
      [PWD] => 1367591889
      [VERSION] => 85.0
      [BUTTONSOURCE] => AngellEYE_PHPClass
      [SIGNATURE] => AFcWxV21C7fd0v3bYYYRCpSSRl31AhthP-fgooieWNMV5xA5KzmkFydw
      [METHOD] => DoDirectPayment
      [PAYMENTACTION] => Sale
      [IPADDRESS] => 94.192.29.223
      [RETURNFMFDETAILS] => 1
      [CREDITCARDTYPE] => Visa
      [ACCT] => 4944447533424515
      [EXPDATE] => 052018
      [EMAIL] => test@domain.com
      [BUSINESS] => Testers, LLC
      [SALUTATION] => Mr.
      [FIRSTNAME] => Tester
      [LASTNAME] => Testerson
      [STREET] => 123 Test Ave.
      [CITY] => Kansas City
      [STATE] => MO
      [COUNTRYCODE] => US
      [ZIP] => 64111
      [PHONENUM] => 555-555-5555
      [AMT] => 100.00
      [CURRENCYCODE] => USD
      [ITEMAMT] => 95.00
      [SHIPPINGAMT] => 5.00
      [DESC] => Web Order
      [L_NAME0] => Test Widget 123
      [L_DESC0] => The best test widget on the planet!
      [L_AMT0] => 95.00
      [L_NUMBER0] => 123
      [L_QTY0] => 1
      [SHIPTONAME] => Tester Testerson
      [SHIPTOSTREET] => 123 Test Ave.
      [SHIPTOCITY] => Kansas City
      [SHIPTOSTATE] => MO
      [SHIPTOZIP] => 64111
      [SHIPTOCOUNTRY] => US
      [SHIPTOPHONENUM] => 555-555-5555
      )

      [RAWREQUEST] => USER=ukpro_api1.interpreting-centre.com&PWD=1367591889&VERSION=85.0&BUTTONSOURCE=AngellEYE_PHPClass&SIGNATURE=AFcWxV21C7fd0v3bYYYRCpSSRl31AhthP-fgooieWNMV5xA5KzmkFydw&METHOD=DoDirectPayment&PAYMENTACTION=Sale&IPADDRESS=94.192.29.223&RETURNFMFDETAILS=1&CREDITCARDTYPE=Visa&ACCT=4944447533424515&EXPDATE=052018&EMAIL=test%40domain.com&BUSINESS=Testers%2C+LLC&SALUTATION=Mr.&FIRSTNAME=Tester&LASTNAME=Testerson&STREET=123+Test+Ave.&CITY=Kansas+City&STATE=MO&COUNTRYCODE=US&ZIP=64111&PHONENUM=555-555-5555&AMT=100.00&CURRENCYCODE=USD&ITEMAMT=95.00&SHIPPINGAMT=5.00&DESC=Web+Order&L_NAME0=Test+Widget+123&L_DESC0=The+best+test+widget+on+the+planet%21&L_AMT0=95.00&L_NUMBER0=123&L_QTY0=1&SHIPTONAME=Tester+Testerson&SHIPTOSTREET=123+Test+Ave.&SHIPTOCITY=Kansas+City&SHIPTOSTATE=MO&SHIPTOZIP=64111&SHIPTOCOUNTRY=US&SHIPTOPHONENUM=555-555-5555
      [RAWRESPONSE] => TIMESTAMP=2013%2d05%2d03T15%3a26%3a05Z&CORRELATIONID=22b6378decc25&ACK=Success&VERSION=85%2e0&BUILD=5715372&AMT=100%2e00&CURRENCYCODE=USD&AVSCODE=X&CVV2MATCH=M&TRANSACTIONID=6JX016693V643133R
      )

      Reply
    • 1) This means that Payments Pro is not active on the account you’re attempting to test with. You need to make it’s been approved/enabled, and you’ve agreed to the fees for it within the account.
      2) If you’re going to setup recurring payments using PayPal Express Checkout then you would first call SetExpressCheckout to obtain a token. Make sure to include the billing agreement parameters in this request. Then you’ll redirect to the user to PayPal where they sign in and agree to continue the payment. PayPal then returns the user back to your ReturnURL that you specify in SEC. From there, you can call GetExpressCheckoutDetails to obtain the buyer information from PayPal, and then you can call CreateRecurringPaymentsProfile to setup the subscription profile accordingly.

      If you’re setting up the subscription using a credit card directly (Payments Pro) then you can use CreateRecurringPaymentsProfile by itself and include the CC details.

      That’s assuming you’re using DoDirectPayment. If you’re on the PayFlow API this all changes, and unfortunately it can be tough to know because they’re calling both of them Payments Pro these days. If you have a PayPal Manager account, though, separate from your PayPal.com login, then you’re on PayFlow.

      Reply
      • Thanks Andrew, I am on PayFlow as I have a Paypal Manager account. It’s only a test mode at the moment. Would be great if they were just providing step by step business logic. I have a couple of questions. Do you know how to go about PayFlow? and do we always submit the clients data to our library over the Post? Are there any security risks and issues I should be aware? Thanks I’m studying the Website Payments Pro Payflow Edition – Recurring Payments Developer’s Guide.

        Reply
        • Not sure exactly what you mean by “go about PayFlow”..?? You can integrate the API’s for PayFlow using my library just like other PayPal calls. There’s actually a single PayFlow.php included that handles all PayFlow calls. There are comments pulled from the documentation for each parameter and what you can pass into it.

          Reply
  52. Andrew, just wanted to confirm that I can successfully utilise API’s for PayFlow using your library. I have just created Create_profile_demo() and Get_profile_details_demo() and I get results.
    Now I know I have created number of profiles and I can query their details with Get_profile…() yet when I go to my manager.paypal.com -> Manage Profiles, I get only one profile RT0000000001.
    This tells me that I somewhat created the Profiles somewhere else.
    Do you know how could I pragmatically request details about my Paypal account?
    I got my Classic TEST API credentials from developer.paypal.com although I don’t know how to get the DeviceID. I know that ApplicationID by default is ‘APP-80W284485P519543T’ but I don’t know how to obtain PayFlowUsername, PayFlowPassword, PayFlowVendor and PayFlowPartner.. Instead I’m using the default credentails – tester, Passw0rd~, angelleye, PayPal..

    Reply
    • Nevermind. Have just figured out that the Payflow credentials are nothing else than the same credentials we need to log into manager.paypal.com PARTNER= PayPal, VENDOR= someusername, USER= someusername, PWD= samepassword.. So I can Create Profiles and query them in a test mode.

      Reply
      • Yes, and you would use the payflow.php controller (or your own controller following that sample) to make the calls instead of the payments_pro controller with those other methods you mentioned.

        Reply
  53. The more I read about the Payflow the more I realize I should implement Payflow Link on my website because of the PCI compliance. I am also based in UK so I’m not sure if it’s supported here or not. Question: How can I implement Payflow Link on my website using your library to give it some extra flexibility? Thanks

    Reply
    • As long as you’re using an SSL certificate and you’re not saving any credit card data in your database (or anywhere else) then there’s really not much to PCI. The point is to protect the sensitive data, which the SSL does during checkout. If you’re not saving anything after that then there’s nothing to protect.

      PayFlow Link is actually what they call the product that uses a 3rd party merchant account other than PayPal. If you’re using PayPal as your merchant with the PayFlow Gateway then you would use Payments Advanced, which is the same thing as PayFlow Link except that it uses PayPal as the merchant.

      That said, I know PayFlow is available in the UK, but I don’t think Link/Advanced is, so you would have to use the full Pro version anyway.

      Reply
    • With your support and with this website https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/ht_ec-freeTrialRecurringPayments-curl-etc/
      I was able to create recurring payment profiles in a test mode. Now in reality my paypal has only Express Checkout. Correct me if I’m wrong but the ‘CreateRecurringPaymentsProfile’ or ‘ManageRecurringPaymentsProfileStatus’ are methods availably only under Payments Pro, are they not? I was looking for the recurring payments option under the Express Checkout and all I could find was Subscribe and Unsubscribe buttons. So perhaps buttons are the easiest way to go but then how could I check out the subscription status programatically in order to give the user access to my website features or not? Thanks Andrew.

      Reply
      • No, those calls are available with Express Checkout, too. When using CRPP with EC you would just include a token instead of credit card details. On that note, when you call SetExpressCheckout you need to make sure and include the billing agreement parameters so that it will give you a token that is compatible with CRPP.

        The flow would be SetExpressCheckout, GetExpressCheckoutDetails (optional), DoExpressCheckoutPayment (if required), and finally CreateRecurringPaymentsProfile. For example, my USBSwiper.com site has a subscription tied to the product we sell that requires shipping. I finalize the payment for the physical goods with DECP, and then I use CRPP to generate the recurring payment profile. The same token is used through-out.

        Reply
      • Yes, that is a good guide, although it’s a little bit out-dated now. He’s using version 64.0 in that example and they’re up to about 101.0 right now which includes additional parameters that weren’t available with 64.0. On that note, I still need to get my template files updated, but all you would need to do is look at the PayPal documentation to see what new parameters there are and add them into the arrays provided in my templates.

        Reply
    • I’m curious what you think of Subscribe and Unsubscribe buttons. Haven’t tested it yet but I’m wondering if there are any options for developers to check programatically if the subscription is paid or not.

      Reply
  54. Hi Andrew, and thanks for the previous answers. Could you tell me how would you validate a user with a paid subscription? Would you call API(what method??) each time the user wants to have an access to your website resources to check the PROFILESTATUS? Or update the PROFILESTATUS in database each time the ManageRecurringPaymentsProfileStatus is called? Or Should I setup some other trigger? I’m just simply not sure what are the best standards of dealing with this kind of situation.

    Reply
    • If you’re working with standard subscription buttons, unfortunately, those aren’t available via the API. If you’re working with Recurring Payments setup using Payments Pro or Express Checkout then you can check the status by calling GetRecurringPaymentsProfileDetails and checking the STATUS parameter you get back.

      Reply
  55. hi im using adaptive payment. how do i get transaction id. when i get successfull result.

    Reply
    • The PayKey that you get back is used as the transaction ID so that’s what you want to log for your records.

      Reply
  56. hi, can u share to me codeigniter library for perfect money payment.
    thx

    Reply
    • I’m not sure I understand what you’re asking. “Perfect money payment”..??

      Reply
      • see perfectmoney.is that like paypal
        thx

        Reply
  57. Hi Andrew,

    I need your help.

    I have used your library earlier successfully. Please, may you get me out of this. I am not getting what to do?

    I have to create recurring profile using Payflow by accepting credit cards on my site.
    So, will you please let me know what I have to do.

    I have earlier use CreateRecurringPaymentsProfile method. But, now Paypal guys say this is wrong method you have used. They have activated Payflow to my account. I have Payflow details.

    I have used this Class from your library “payflow”. But in this class you have given this method only Process_transaction.
    In this method the parameters that are required for making recurring profile are missing.
    So, please let me know which method do I need to use for making recurring profile using payflow.

    Please Help….

    Thanks.

    Reply
    • Unfortunately, PayPal has made their Payments Pro product very confusing for people as they migrate the Payflow gateway into their own stuff. They’re trying to get people into the PayFlow side now, but depending on the version of PayPal account you have you’ll have access either PayFlow API’s, PayPal Classic API’s, sometimes you can have full access to both. You never really know until start trying, though.

      Have you already tried using CreateRecurringPaymentsProfile? If you have an account with full access to both you could use that without any issues. If your account is PayFlow only then you could call PayPal and specifically request “Website Payments Pro w/ Recurring Payments”. You could tell them you’ve already got your stuff integrated DoDirectPayment and CreateRecurringPaymentsProfile, and you don’t want to have to redevelop everything to use PayFlow instead. They can do this for you.

      If you’d like to go ahead and with PayFlow, that’s fine, too. It’s just that my library for that is a little bit out of date. That said, like you mentioned, PayFlow calls are all done with that one request file. If there are parameters missing you can simply add them into the array and populate it accordingly.

      Hope that helps. Let me know if you continue to have trouble.

      Reply
      • Thanks Andrew. I will try what you said.

        Thanks lot for your Time.

        Regards

        Reply
  58. Hi Andrew,

    Thanks for your library.

    I have doubts about after payment successful retrieving paypal data, How to retrieve data ? Im using codeigniter framework. And also how to change shop email address and shop name. It shows always “Test store”.

    Reply
    • What API call are you working with? With most calls you’ll get the response data back in the API response immediately. The result of the function will be an array of all the response parameters. For some things you might need to configure IPN to process the payments. The shop name can be adjusted from within the PayPal profile under Business Settings or Payment Preferences. I don’t remember for sure, but it’s in there somewhere.

      Reply
  59. Hi, Andrew,

    I’m trying to implement a mobile version of my website and seems that your paypal class is missing a parameter

    my code

    $PayPalResult = ($this->detect->isMobile() ? $this->paypal_pro->SetMobileCheckout($PayPalRequest) : $this->paypal_pro->SetExpressCheckout($PayPalRequest));

    the error is

    L_ERRORCODE => 81259
    L_SHORTMESSAGE => Missing Parameter
    L_LONGMESSAGE => ItemAmt : Mandatory parameter missing
    L_SEVERTYCODE => Error

    Then testing this on a PC it works fine, but when testing in a tablet does not work.

    Thank you for your help.

    Reply
    • I would need to see the raw request that’s getting generated. That would be returned in the result. Also, I’d recommend just using Express Checkout as it will automatically switch to a mobile UI if a mobile device is used.

      Reply
  60. I am making a php codignator application to sent money to my employees all over the world.I want to integrate paypal to this.Can I use this?

    The actual problem I am facing is that, I want to send money to my employees,but I don’t know thir API details.I only know their paypal email ids.

    This is asking me to set the receiver’s API details..please help me!!!

    Reply
    • Yes you can use this library for that. You don’t need all of your employee’s API credentials. You simply use your own credentials which verify your own account to send money out to receivers. As long as you have the PayPal account ID’s of the receivers you’ll be good to go.

      I would recommend using the Pay API which will allow you to simply enter the email address of a receiver and send them funds directly. You can loop through however many you need to make and make this call for each.

      You could also use the MassPay API, which might better since you’re paying employees. With the Pay API they’d have to pay a fee on the money they receive. With the MassPay API you would actually pay the fee, but it’s minimal. It’s a lot less than the normal fees since you’re paying with cash funds.

      You have to get MassPay specifically enabled on your account to use it, though, so you’ll want to get that approved before beginning development.

      Hope that helps!

      Reply
  61. Hi,
    Thanks for the libraries that u have done .A good job and saved our lot of time .

    Thanks
    Az

    Reply
    • I’m glad you like it. It has saved me lots of time as well. :)

      Reply
  62. Hii,

    I am using payment_pro payment and there i need chained payment.Do you have library for that.

    Reply
    • For chained payments you need to use the Adaptive class, which extends the regular Pro class.

      Reply
  63. Hey Andrew,

    thanks for your lovely PayPal class for CI … it makes dealing with PayPal much more easy, but it’s still a bit confusing.

    My (german) customer has a small project (create a FAX online ans send it) and wants to have PayPal integrated.

    He just needs a “dead simple” solution without any fancy functions or options.

    He wants to charge a very small amount (about 2 USD) once via PayPal, get the customer back to his website, check it the payment was succesful and then … whatever.

    Strangly enough, he has no APP-ID at all, but just APIUsername, APIPassword and a APISignature.

    No DeviceID, ApplicationID or whatever.

    What exactly would be the best option for him, using your library? Just PayPal Pro? Adaptive (which needs an APP-ID)? Or anything else?

    Thanks in advance …

    Reply
    • The APP ID is only required when you’re working with the Adaptive Payments API’s. You get your APP ID when you submit the application to PayPal and they approve it. If you’re not working with Adaptive then you don’t need to worry about it. Same with DeviceID.

      I would recommend having them sign up for Express Checkout Digital Goods. Express Checkout itself needs no specific signup/approval from PayPal, but adding the Digital Goods part does. That’s what gives you micro-payment processing so you won’t pay near as much in fees on $2 transactions as you would with a regular account.

      Then you can use the pro library to integrate Express Checkout w/ Digital Goods very quickly and easily.

      Hope that helps!

      Reply
      • Thanks! I’ll suggest that to my customer and let you know if it worked 😉

        Reply
  64. Hi Andrew,

    Once again I am here to get your help. My question is:

    Can I create recurring profile by simply redirecting user to Paypal site. If yes which method should I use?

    I have implemented the creating recurring profile using Payflow with your help and using your library.

    Now, I want to do same by simply redirecting user to Paypal Site. Please let me know what I have to do.
    Kind Regards

    Reply
    • I would use the Express Checkout API. The process will be calling SetExpressCheckout, then GetExpressCheckoutDetails (optional), and then CreateRecurringPaymentsProfile.

      SetExpressCheckout will return a token that you use append to the end of a URL at PayPal that you redirect the user to. My library will return $PayPalResult[‘REDIRECTURL’] in the SetExpressCheckout result to make that easy for you. You’ll also want to save $PayPalResult[‘TOKEN’] in a session variable or something because you’ll then pass that into GetExpressCheckoutDetails and CreateRecurringPaymentsProfile.

      Reply
    • What you’re referring to isn’t Payments Pro. That’s called Payments Advanced. Unfortunately, my library does not yet have this included, but it’s pretty simple to setup. PayPal provides a nice video on setting this up: http://www.youtube.com/watch?v=qyiv3ndRcZI

      Reply
  65. Hi Andrew,

    Hope you are doing good. I have used PayFlow as you have earlier guided me through that. I have got some paid users and most of them have opted for monthly plan that is on my site. My confusion is that do I need to renew there usage period by sending them email for next month payment or PayPal will send them payment notification for the second month automatically and its then up-to them if they want to continue or not.

    Please guide me again. Thanks for you time :)

    Warm Regards,

    Irfan

    Reply
    • You’ll need to update your local system that gives the users access to your content based on the result of the subscription signup and the future payments. You can use Instant Payment Notification (IPN) to automate the process of updating things based on future payments, payment failures, canceled profiles, etc.

      Reply
  66. Hello Andrew,

    i have used you PHP library for paypal payments pro and its working like charm, now i’m trying to use payflow pro but i’m getting an error “Invalid Vendor Account”

    currently i’m using your credentials only which are:

    PayFlowUsername = tester
    PayFlowPassword = Passw0rd~
    PayFlowVendor = angelleye
    PayFlowPartner = PayPal

    please help me in this, thank you in advance.

    Regards,
    Ajay

    Reply
    • I just tested the sample included with my library and it seems to be working fine for me. Are you sure you don’t have any extra white space or anything added to those values somehow? Do you have your own account you can test with?

      Reply
      • yes i have my own testing account but now i’m getting DECLINED error for result number 12.
        Can you please tell me about this error ?

        Reply
        • What credit card number are you using?

          Reply
          • Card Number: 5215871115180006
            Expiration Date: 10/2018

          • The PayFlow gateway has specific credit cards you have to use for test mode. Look at this documentation on page 85-86.

  67. Thank you so much Andrew you were so helpful..
    Best tutorial for new programmers :)

    Reply
  68. Hi Andrew, sorry for the silly question but I am still lost on how to implement your code for digital goods. Just like someone mentioned above – I just can’t find the location or where to add the digital goods plus the pop-up.

    Do you have any doc?

    Reply
    • Hi Shina,

      I’m sorry for the delay getting back to you. What I like to do is go ahead and use the library to get everything setup without the popup window. Just get it working the “regular” way with the browser redirects.

      Once that’s done you can make the simple adjustments to add the PayPal javascript and do it with the popup window instead. All of the details for that are available in their Adaptive Payments documentation.

      Reply
  69. Hiya, I am getting an error when I open the adaptive_payments file, it says
    ‘Cannot redeclare PayPal_Pro::SetCustomerBillingAgreement()’ when I try to open the controller.
    I checked this paypal_pro file in my editor and it seems one of the functions has been declared twice? Why is this?

    Reply
    • I’m really not sure. I haven’t seen that myself. I’ll have to double check my library and see if I accidentally copied a function or something. Odd I wouldn’t have ever noticed that. If you don’t notice anything different about the functions I’d say you can just go ahead and remove one of them.

      Reply
  70. Hi Andrew,

    Thanks for the library, I think it will be very helpful.

    Currently, I am battling through your code, but there are so many bits I don’t really know where to find.

    It seems that you have linked to code in ‘/demo/codeigniter/includes/’ but I don’t have that folder. Am I missing something?

    I think that the file ‘do_direct_payment_demo’ is missing from the view part of the application.

    I had to remove the last two methods in the ‘Paypal_pro.php’ library. These are both duplicates of methods which occur much further up the file.

    I am sorry if this looks like a complaint, it is not meant to be, just some help for you and others.

    Without the demo files working, I am a little suck.

    Kate

    Reply
    • Hi Kate,

      do_direct_payment_demo is a function of the controller, not a page.

      Somebody else recently mentioned a duplicate function. I’ll have to look into that and get it fixed. You can remove it like you said if that’s the case.

      Reply
  71. Hi Andrew,
    Please excuse my ignorance, but I want to know if it is possible to make a chained payment, but send a user to the express checkout page. The payments will primarily be made from mobile devices and I keep getting sent to the full payment page. Is this sandbox dependent or is there a way to force the chained payment to go to the mobile checkout page?

    Reply
    • Ok.. I tried using the DIGITALGOODS field and it seems to work ok on my android, but fails miserably on the iPhone. Any other thoughts?

      Thanks

      Reply
      • I would need more info than “fails miserably.”

        Reply
        • Hi Andrew,
          Sure it opens to a page with a login button on it in a second window, but when you click that login button it just keeps taking you back to that login page. It never lets you put in credentials.

          Reply
          • Not to confuse the issue, but if one of the members of the chained payment is “PRO” in the sandbox it fails on the android as well by redirecting back to the screen with the login button after you put in your credentials.

          • I guess I’d have to see what’s going on. If you want to take a video cap and send it to me or just send me the file you’re working with I’ll see if I can reproduce the issue.

  72. I have a video of what’s happening.. where do you want me to send it?

    Reply
    • If you contact me directly through the contact page on my site that’ll come straight to me. I’ll warn you, though, I am a little bit behind on things, so I’ll have to take a look and get back to you as soon as I can, but it may be a day or two. Sorry.

      Reply
      • Sent.. Thanks again.

        Reply
        • Hi Andrew,
          Any luck tracking that down?

          Reply
  73. Hi Andrew,
    Your library is more than the best.You are the best.
    I am using Pay_chained_demo methond in my site.Everything works well.After a successful response from paypal, I am getting the folllowing array.

    Array
    (
    [Errors] => Array
    (
    )

    [Ack] => Success
    [Build] => 7935900
    [CorrelationID] => 8f304bfca8ae8
    [Timestamp] => 2013-11-01T03:59:28.631-07:00
    [PayKey] => AP-0C600871YA0679300
    [PaymentExecStatus] => CREATED
    [RedirectURL] => https://www.sandbox.paypal.com/webscr?cmd=_ap-payment&paykey=AP-0C600871YA0679300
    [XMLRequest] => ReturnAllen_USPAYhttp://localhost/salvagecars/paypal/adaptive_payments/pay_cancelAPP-80W284485P519543T::1USDEACHRECEIVERECHECKBALANCECREDITCARD500.00murad-facilitator@company.comGOODSfalseareena@gmail.comhttp://localhost/salvagecars/paypal/adaptive_payments/pay_return
    [XMLResponse] => 2013-11-01T03:59:28.631-07:00Success8f304bfca8ae87935900AP-0C600871YA0679300CREATED
    )

    You see I do not get the TransactionID and TrackingID in this response. Actually I have to store these values in my database for further use i.e if I want to refund this transcation. Because the Refund() function require these values to refund.

    Can you help me please how can I get these values after a successful payment.

    Thanks again.

    Reply
    • Hi Murad,

      I’m noticing a couple of things you might have issues with. It’s a little tough to read the API results here because the array output doesn’t give you the actual XML. You have to view source to see the XML, which makes it easier to look at. It looks like the response has CREATED, though, which tells me the Pay called was executed with CREATE instead of PAY as the action type. If that is indeed the case then the payment wouldn’t actually happen until you called the ExecutePayment API behind that. Again, it’s a little tough to confirm without seeing your actual XML getting generated.

      Apart from that, though, the adaptive payments responses don’t do a good job of providing transaction details in the API response. That information will need to be obtained via an IPN (instant payment notification) solution. You basically setup a listener script on your server and PayPal will POST transaction details to this script so that you can automate procedures like updating your database, sending out email notifications, etc. IPN notifications are sent in real-time, so you can still make things happen during checkout (or after checkout) but it won’t happen directly within the checkout flow of code.

      Hope that makes sense.

      Reply
      • Thanks Andrew, It really helped me.

        Reply
  74. Hi Andrew, I’ve made some progress with the digital goods checkout on a mobile browser. If I set the expType = “mini” I can actually progress far enough to enter user data and make the actual payment. However when you try to cancel or return to the original site the paypal window turns into “Returning” with a spinner and never changes. Any thoughts?

    Reply
    • When using embedded payments you have to include the javascript snippet in your return URL to close the mini window. In fact, that’s pretty much all you need in your return URL in that scenario.

      The PayPal Adaptive Payments documentation covers this in depth and gives you code samples at the bottom of the page, but here’s the snippet for closing the lightbox.

      dgFlow = top.dgFlow || top.opener.top.dgFlow;
      dgFlow.closeFlow();
      top.close();

      Reply
      • Thanks so much for the help. So if I am reading that correctly I can’t use a success url on my site that says thanks for paying.. I basically only have the option to close the window that the payment was taken in? I would really like to have that window close then redirect to a success or cancel url based on what the user did in the paypal window, but it seems all the call does is close the window.

        Reply
        • If you want to do the redirect you’ll need to do a regular checkout instead of embedded payments. The whole embedded flow is intended to simply sit on top of your app and then go away when it’s done. You may be able to trigger a redirect using based on when that iframe window gets closed, but I really haven’t played with that myself so I can’t say for sure. It was just be something custom you’d have to do from your checkout page.

          Reply
          • Just what I needed to hear.. thanks again for a great library.

  75. Hi Andrew, please add missing code xmlns="" to your PayPal_Adaptive class on line 1601.
    This lile must be
    $XMLRequest .= $CurrencyCode != '' ? '' . $CurrencyCode . '' : '';

    Reply
    • Thank you for bringing that to my attention. I got it fixed in my copy and updated my download file. I’ll have this on Github before long so this sort of thing will be a little more smooth. Thanks!

      Reply
  76. Hello sir,
    i am using this library and using adaptive_payment controller. i want to pay for two user. every thing working perfectly but i am not getting these two user’s payment detail i.e. transaction ids (to save in db). only first reciver transaction id is available in pay_return function and get_payment_detail function. how i will get both user’s transaction ids????? thanx in advance..

    Reply
    • The PayKey that you get back is actually for the whole transaction. There aren’t really any unique transaction ID’s at that point (unless you’re using Preapproval) because the user still has to authenticate the payment before it’s finalized.

      You’ll probably need to setup IPN to get what you’re after. It will POST transaction data to a listener script on your server after transactions place.

      Reply
  77. Hey Andrew
    I need your one favor if you have some time

    Say for example I have a site where users purchases and make payment. And payment mode is only via PayPal account. Means the customer should possess the PayPal account to do transactions.

    My question is when user will pay via his PayPal account is there any way in PayPal that I can divert the in coming amount to two different PayPal accounts. If I can put this other words. I need to divert 5% of the in coming amount to other PayPal account as commission.
    Is this possible in PayPal. Is there any way I can achieve this in PayPal. Please let know I would be waiting eagerly for your reply.

    Reply
    • There are a few different ways to handle that sort of thing. What I would recommend depends on other details like what you want the checkout flow to look like, what data you want to PayPal and include in the transaction request, how you want to handle post-payment processing tasks (automating database updates, email notifications, etc.)

      If you want to contact me directly we can get into that in more depth.

      Reply
    • hey Irfan Rasool use adaptive method and set two or more reciever in array. you can set whatever % of price the receiver will get. its in pay(). hope u get what i mean. if any help need ask me directly on gotosachin18@gmail.com. hope this help you…

      Reply
  78. hey Irfan Rasool use adaptive method and set two or more reciever in array. you can set whatever % of price the receiver will get. its in pay(). hope u get what i mean. if any help need ask me directly on gotosachin18@gmail.com. hope this help you…

    Reply
  79. Hey,
    Can you tell me why it’s need developer’s email?

    Reply
    • That’s only necessary for Adaptive Payments. It sends your developer email address in the headers of your API requests, which is required by PayPal because that’s where your live Applications are managed.

      Reply
  80. Hello, Andrew.

    Which library would you recommend for my case, Adaptive Payments or Payment Pro?

    what i want on my website is that that random user comes to the website for registartion he has to pay a particular amount ….that is all i need…plaese suuggest

    Reply
    • Go with the Payments Pro library. It really includes all of the standard Merchant API’s that PayPal provides, not just Pro (DoDirectPayment). For basic web registration you can start with Express Checkout and then add Pro later if you decide you want to. If you need more direct help we do offer training, and we could probably get you well on your way within an hour or two.

      Reply
  81. Hello, Andrew.

    i have go to this link : http://www.angelleye.com/demo/codeigniter/

    but it’s 403 Forbidden..
    my browser show :

    Forbidden

    You don’t have permission to access /demo/codeigniter/index.php on this server.

    Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.1e-fips DAV/2 mod_bwlimited/1.4 Server at http://www.angelleye.com Port 80

    why this happens ?
    Sorry for bad english.
    Thank You.

    Reply
    • Hi, sorry, I don’t support the CodeIgniter specific library anymore because the standard PayPal SDK I provide is compatible with Composer and can be used within CodeIgniter that way. The CodeIgniter library does still work just fine, and the demo that used to load at that URL is included with it, so you could get it up and running on your own server pretty quickly. I would recommend using the Composer install, though, as it’s more up-to-date with PayPal and will continue to be maintained.

      Reply

Leave a Reply