Paypal Standard Integration PHP

Paypal Standard Integration PHP


In this article, we’re going to

  1. See the requirements to accomplish objective.
  2. Create two paypal sandbox accounts.
  3. Create a basic HTML Form.
  4. Receive the paypal response and store that in php variables.
  5. Going Live



  1. Paypal account
  2. 2 Paypal sandbox accounts  ( seller & personal/buyer )
  3. Basic knowledge of HTML Forms & PHP.
  4. Difficulty: Low


Creating Sandbox Accounts:

Paypal sandbox accounts aren’t really necessary if you just want to dive into production without testing. So yes, for testing purpose and see how things work, you’d have to make at least two sandbox accounts, which is very simple. Here are the steps:

  1. Login to your  paypal account
  2. From developers paypal site create two new sandbox accounts ( 1 personal and 1 business, say buyerAccount and payerAccount respectively )

That’s it! You’ve got your two accounts ready! You can always change account settings by simply logging into paypal with those sandbox accounts. Just like any other account. Alright! you’re good to go for next step.


Payment Form:

Creating payment or purchase form is as easy as creating basic form in HTML. So we’re now going to create an HTML form with some specific form fields, fields that are expected by paypal website. So for more simplification, here is what we’re going to do.

  1. Create a form with action attribute set to Paypal website URL
  2. Paypal will receive, process and return the transaction status as well as the payer information.

Alright, so here is that HTML form


That’s it! You’re ready with most basic payment form. However there is way more things that you can include in the form, here is the link where you can find the list of all input fields that are acceptable by paypal.


Receiving paypal response:

Now we need to check if transaction was successful or not. To do that we can access these attributes ( depending upon the response method defined in our form ) to know what happened with the information.


I’ve tried my best to cover all the necessary response attributes in this list. So, if payment is successful you’ll get those attributes listed above. However, if payer cancels the transaciton, you can simply make cancelled.php like this:


Going live

This is the time we need to get out of testing environment and go live! That’s pretty simple, change the action URL from  to and you’re all set to go live!

Also make sure you change your value for business input field.


If you face any difficulty on any step of this article, do not hesitate to ask in the comment section below. I’ll be more than happy to assist!


Share this post

Post Comment