This is a video screencast that was created to go along with this Nettuts+ tutorial.
Step by step instructions on creating a PHP application to process credit cards using PayPal Payments Pro, specifically the DoDirectPayment API.
The tutorial includes the steps for creating a basic application structure with configuration details, generating an NVP API request to send to PayPal via HTTP POST, and parsing the response data returned from PayPal to handle the result accordingly.
Looking for Live Help?
Schedule a live meeting with Drew Angell, PayPal Certified Developer, and get all of your questions or concerns answered.
Featured PayPal Products and Services
-
PayPal Support
$100.00 -
PayPal for WooCommerce
FREE! -
WooCommerce Multiple PayPal Accounts Plugin
FREE! -
PayPal Shipment Tracking for WooCommerce
$49.99 -
Offers for WooCommerce
$59.99 -
WordPress PayPal Invoice Plugin
$20.00 -
PayPal Webhooks for WordPress
$79.99 -
Sale!
PayPal IPN for WordPress
Original price was: $59.99.$49.99Current price is: $49.99.
Hello angelleye,
I am using your paypal payment pro DoDirectPayment library for credit card transactions and its good at sandbox when my client test it live then he faild the transaction. he told me that paypal says this method is old ??? is paypal payment pro method is old and payflow is new ?
Hope you give me better answer.
There is no error generated by paypal. client told me that our site is not connected with paypal but its done at sandbox 🙁
Any help appreciated.
Thanks in advance,
Aezaz
Hi Aezaz,
They have a new version of Payments Pro now, but DoDirectPayment still works with it. It’s just a matter of having it enabled on your live account. Have you signed up for Pro on that account? It costs an extra $30/mo so you have to get signed up and agree to that charge before it’ll become active for you.
Hi Andrew,
Thanks for your help. Now its working live. but i have one question that is, i have used DoDirect method of paypal payments pro and paypal say its old method 🙁 , can you tell me which one is new method for direct payment ?
Thanks again for your help.
Aezaz
Unfortunately, some of the PayPal reps are misinformed about their own products. PayPal has launched a new version of Payments Pro (3.0) but it still works with DirectPayment. They are opening up the PayFlow gateway to PayPal merchants now, too, which is what they actually did with 2.0. Technically, you have access to both PayFlow and DoDirectPayment, but lots of reps seem to think you have to use PayFlow. In reality, even if you build API requests using the PayFlow API, if your merchant is PayPal, the PayPal system actually rewrites it and pushes it through DoDirectPayment anyway.
Quick question:
I’d like to check if the following is possible with/without any specific compliance requirements to be met by the Merchant (like PCI/DSS).
1. The first time, all card details are accepted on the merchant site, and a call to DoDirectPayment() is made to process payments.
2. Now, the Merchant ‘saves’ the card details into their private db.
3. The next time the same customer (who is logged in) comes in to make a payment….the Merchant’s site does not ask the customer to fill in the info, but simply uses the saved info (say, by using the last 4 digits of the card as a user selected option) and calls DoDirectPayment() to do the payment.
Would this be possible?…basically, trying to avoid the filling in card details for every purchase on the same site for the same customer.
Actually saving the CC data to your local database would indeed raise PCI Compliance issues and would cause you to go through a lot of headaches (and spend a lot of money) to be officially compliant. The good news, though, is that you don’t have to do that. You can use what are called Reference Transactions instead.
Reference transactions are exactly what you mention…using previously saved info to process a new payment…but PayPal is the one saving the CC data on their servers. Using the DoReferenceTransaction API you can simply pass in the transaction ID of a previous Auth or Sale transaction along with a new amount to be charged. PayPal will process it using the info they have saved from the previous transaction.
This is a much more secure way of doing it and is definitely recommended.
I am using your great library to communicate with Paypal. We are using the CreateRecurringPaymentsProfile for subscriptions. I am getting a timeout error (after 3 to 5 seconds) when connecting to Paypal. It doesn’t matter if we hit the sandbox or production. Same error for both sites. Any ideas?
Thanks
Eric
Hi Eric,
Do you know if you have a Firewall or something that could be blocking communication with PayPal’s servers? If you want to send me a copy of what you’re working with I’ll see if I can reproduce the problem.
Andrew
Andrew, thanks for answering. The issue was an ill formatted expiration date for the credit card. Correcting that got us by the timeout error. Hopefully that helps someone in the same boat.
Now on to the next issue. Learning to hate paypal more each day
Hi Andrew,
I’m getting the following error using CreateRecurringPaymentsProfile. Any ideas:
An error occurred in script ‘/Applications/MAMP/htdocs/HelpYouSponsor/modules/paypal/includes/paypal.class.php’ on line 6600: Declaration of PayPal_Adaptive::CURLRequest() should be compatible with PayPal::CURLRequest($Request) Date/Time: 10-15-2012 14:53:48
The script is working and I’m getting successful test transactions but my error script always spits this out.
Thanks,
Chad
I’m not sure what would be causing that. I don’t seem to be getting that. Contact me directly and I can work with you to try and figure out where that’s coming from.
Hi Andrew,
I’m receiving the same error as Chad received above for GetVerifiedStatus.
Strict Standards: Declaration of PayPal_Adaptive::CURLRequest() should be compatible with PayPal::CURLRequest($Request) in \includes\paypal.adaptive.class.php on line 4336
I’m receiving the data back for the verified Paypal account, but I don’t know how to specifically fix this error with curl().
Thanks,
Vince
Can you send me a copy of the file you’re working with and I’ll see if I can reproduce the issue and figure out what’s up..??
at least for me, this strict standards error reporting was covering up a simple curl function not being found. you use phpinfo or just comment out strict error reporting for sandbox mode in the config to see where the real error is. definitely try the second option if you’re working with php 5.4+ where e_all now includes e_strict.
Good tip, thanks for sharing!
I am also getting PayPal_Adaptive::CURLRequest() should be compatible with PayPal::CURLRequest($Request)
Have you found any causes to this error? I’m running php version 5.4.4, and my config for sandbox has E_ALL for error reporting. Commenting out the error reporting doesn’t seem to get rid of it.
Thanks!
Mike
Sorry for the delay getting back to you. I’ve got this fixed in my current local version. I have a few things I need to fine-tune before I release the next official update, though. If you want to contact me directly I’d be happy to get you the current version that resolves this warning.
Hi Andrew, i’ve got the same problem. I’m new to integrate your library on my apps. And in my opinion, if we set ‘display_errors’ to ‘0’ it will not show the error anymore. But i dont know this is safe or not??
And in my opinion, it is because in parent class(paypal.class.php) on method CURLRequest receive one parameter but on child class (paypal.adaptive.class) receive 3 params. This maybe cause the error.
Trying to solved it with add parameter on parent and child class just like this :
paypal.class => function CURLRequest($Request=”, $APIName=”, $APIOperation=”)
paypal.adaptive.class => function CURLRequest($Request=”, $APIName=”, $APIOperation=”)
paypal.payflow.class => function CURLRequest($Request=”, $APIName=”, $APIOperation=”)
But i dont know, is it secure/safe enough??
Yes, simply setting display_errors to 0 will get rid of it and you won’t have any issues. I ran it that way for a long time and still have quite a few solutions in place that don’t have the fix included.
You are correct about the fix, though, so you may just want to go ahead and do that. You just need to make it so that function has the same parameters in all of the child classes as it does in the parent class. I’ve done this already with my local copy, but I still have some other things I need to get done before I upload the official update.
What you’ve outlined here, though, is exactly what I did to fix it. Just add those extra parameters in each class that function exists.
[Errors] => Array
(
[0] => Array
(
[Receiver] =>
[Category] => Application
[Domain] => PLATFORM
[ErrorID] => 580001
[ExceptionID] =>
[Message] => Invalid request: {0}
[Parameter] =>
[Severity] => Error
[Subdomain] => Application
)
)
I’m getting an error but can’t tell what the error means. Any help is appreciated. I’m using the demo for adaptive payments and have all required fields filled out.
Thanks,
Eric
Please send me a copy of your RAW request that is getting generated. It’s available in the result that comes back from the library when you make the call.
Hi Eric,
I’m sorry for the delay getting back to you. I’d be happy to help, but that error alone isn’t doing me much good. Can you send me a copy of the RAW request you’re using, or the file you’re using to generate it? Please do so directly via the Contact page on my site.
Dear Andrew: thanks a lot for this work, is just amazing and so clean !
However I think I will need some of your help please. There are some issues that I do not understand:
My app, should be able to charge a customer, but the main amount is not for me, but for a supplier, I am supposed to charge only the commission fee (which is less), so when I am trying with the chained payments, it displays the message “The amount for the primary receiver must be greater than or equal to the total of other chained receiver amounts” so I swapped the users (primary/secondary account) but when I do it so, it displays the message “Account xyz@mysupplier.com is restricted”
So… what am I supposed to do ? should my supplier open a business account / request the application authorization to paypal / any other thing ? because this is just the example, but I work with many suppliers like that…so should I ask permission for each one of them ?? what have I understood wrong ? or what is the best solution in this case ?
Thanks in advance for your time !
Are you getting these errors in the sandbox or live?
Your supplier should be the primary receiver and then you should be the secondary receiver. If you’re getting an error about being restricted that sounds like the account is in limited status or maybe just needs to verify/confirm the account. I’d look into those things first.
Hello,
any one help me please, i have a question, i am working on a codeigniter site. i want direct payment process through paypal without redirect to paypal site. can you please explain me process how to set up and configure it?
For that you’ll need to sign up for PayPal Payments Pro or Payments Advanced. Payments Advanced embeds a checkout form into your site using an iframe with the checkout actually hosted by PayPal. This is not yet included in my library, but it’s pretty easy to setup.
Payments Pro gives you direct access to the credit card processing API so you can send cc details directly and process payments that way. Buyers have no idea PayPal is processing this payment. They just choose credit card and fill out the details directly. You take those details, pass them over the DoDirectPayment or PayFlow API (depending on which version of Pro you’re on) and display the results accordingly.
If you’re interested in getting Pro setup let me know and I can help you get it without the $30/mo fee.
Hi bro please click on this link here explain step by step implementation process of paypal pay-flow-pro with example running code ..
http://phpsollutions.blogspot.in/2014/04/step-by-step-implementation-of-paypal.html
I would recommend using my class library. It’ll make the procedure much more simple.