[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


PayPal payment intergation with php

Posted on 2016-09-02
Medium Priority
Last Modified: 2016-09-05
This questionis a follow on to this question.


I forgot to mention; we want the customer to be able to pay either through paypal (with  paypal account) or via credit card. Does the awarded answer, based on http://www.evoluted.net/thinktank/web-development/paypal-php-integration cover that case as well? Also, in some cases there may be a buyer whose paypal email is not the same as that we have in our database for that client; I presume the payer email used must be that of the payers paypal account, assuming the buyer want's to use their paypal account.

Question by:Richard Korts
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 111

Accepted Solution

Ray Paseur earned 1000 total points
ID: 41782434
PayPal can accept credit cards at the same rates as PayPal account payments.  PayPal is quite rigid about its requirements for client verification and email addresses.  So much so, that vendors can rely on shipping products to PayPal verified addresses.  Mismatched emails are simply unacceptable, so if you're using email #1 and PayPal is using email #2, you will have to have program logic to bridge the gap.

My instinct is that instead of going to "evoluted" for PayPal advice you should go straight to PayPal.  They have all kinds of helpful developer documentation.  And if you want to save time you can hire a PayPal developer - they have links for that, too.
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 500 total points
ID: 41782467
It's too hard to follow the other question because the excepted answer was just a link to some possible test code and not what you may or may not actually be doing.

Payments are one of those things that seem simple in your mind but get more complex when you start adding on features.

In short, you have an invoice table in your database.  That invoice will contain the invoice id and contact id that is related to a contact table.  Then you will have a table of invoice transactions that will contain the invoice transaction id, invoice id, item id and selling price.

You will probably also have a table of payments that contains a contact id, invoice id and amount.

Your cart code adds up the total billed using the invoice transaction table, then subtracts any payments associated with the invoice.

A customer now pays online where you offer to pay by credit card or via paypal.  If the customer chooses pay by credit card or their paypal account, that is something you must account for in your code then send the info via the appropriate api call https://developer.paypal.com/docs/api/

Once the payment is accepted, you update your payment transaction table that shows $X amount went to invoice #123.  As mentioned, I put a contact id in the payment table because sometimes the person paying is not the person buying.  

That is an over simplified view.

There are different integration methods and the "easier" methods do make it more complex when you have more custom features.  Also, you can accept payment on your server which gives you more control, but then the pci compliance (essentially running a scan on your server and make sure your server passes) is your responsibility.   When you send the payer to the paypal site, you do not worry about pci compliance but then you also are sending the user to the paypal site and have to build in a listener page on your site to accept the paypal call back.
LVL 11

Assisted Solution

by:Andrew Angell
Andrew Angell earned 500 total points
ID: 41782569
Your question is pretty broad.  There are lots of potential answers to it.

I would recommend you start with the Express Checkout APIs.  This will allow you to integrate PayPal in a way that you can force "guest checkout" as an option, which is what they call it when somebody pays with a credit card without signing in to a PayPal account.  The checkout still occurs on the PayPal hosted pages, but again, the user does not have to create/log-in to an account.

With EC integrated people who prefer to login and pay that way can do so, and people who do not have PayPal or prefer to enter card details directly will also be able to do so (in most cases.)

Guest checkout is simply not available for ALL transactions.  Depending on the seller and buyer countries and some other variables the buyer may not get the option to pay without logging in or creating an account.  If you're in the US and most of your buyers are US, though, you won't have any issues.

Beyond that, you could then choose to leave Express Checkout integrated but eliminate the guest checkout option.  This way people who choose to pay with PayPal would go through your EC integration and would simply login as they would expect to do.

Then for credit card payments you could use the REST API with "direct credit card" enabled in your REST application settings, or you could upgrade your account to PayPal Payments Pro.  

Pro gives you more functionality for handling direct credit card payments.  When approved for Pro you'll use either DoDirectPayment API or the PayFlow API to send credit card payment requests to PayPal depending on the version of Pro they put you in.

Yet another option would be to use Braintree, which is now owned by PayPal, and it has an entirely separate set of APIs / SDKs you can use to integrate payments.  In fact, the Braintree v.zero integration would allow you to include credit cards, PayPal, Apple Pay, Samsung Pay, and more, all within a single integration.

So again, you have all sorts of options here.  You'll need to study each and figure out what suits your business needs the best.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question