PayPal Services for Ecommerce: Introduction and Methods
On eBay or Amazon we see a lot of small vendors and professionals try to sell their product and services. These small businesses also have websites to sell their product and services but integrating payment gateways to website is not that easy. It needs investment, resources and time to build a custom Ecommerce website. But, with PayPal these small businesses have reason to smile and sell their service online worldwide.
Today, We will help you to sell your product and services online via Paypal.
You may ask me Why PayPal?
I am not sure that it serves to explain, but I will draw your attention to two points in favor of Paypal.
- A Comscore stats shows us that in US 72% of online shoppers do aware of PayPal Services and approximately 50% of online shoppers have already using PayPal for their purchases.
- The PayPal API is well documented and extremely easy to use.
Introduction and Methods of PayPal:
First, let us consider the example of a photographer who wants to sell his images on website. Lets understand the method how he may use PayPal. He would like to avoid connecting everyday at PayPal to check if someone bought his pictures and he has to send them via email.
So, his goal will be to have a structure that deals alone to verify that payment status and enable to download the images for the user who purchased the photo.
Here’s how this can be done via PayPal System:
- After user decides which photo to buy from photographer’s website the user will be invited to make checkout and redirected to Payment page of PayPal.
- PayPal will take care of everything related to the Payment and redirect the user to a page on the website.
- At the same time PayPal will send a report to a different address, which must be interpreted from the website and registered on the database.
In all this we must be careful to website security trying not to leave any loopholes where the process of transaction takes place.
For this to happen seller must have a PayPal account. The basic tool of sale that PayPal provides us with is “Pay Now” button that you can edit directly within your panel PayPal. Whenever you upload any new product or service to sell then you should charge on website, log in to PayPal and create the corresponding button via the control panel, copy the code and paste it on the product page.
Creating buttons dynamically:
We should make sure that the site is for us to create the buttons dynamically. A button “Pay now” is nothing more than a link (or submit a form) that sends to a given url information related to the payment. To dynamically create a button we all know what we should send information to PayPal and to which URL.
The official url is: https://www.paypal.com/cgi-bin/webscr
The url sandbox is: https://www.sandbox.paypal.com/cgi-bin/webscr
In this URL we can send different parameters, some are mandatory for payment to be successful, others are optional. We find a complete overview of the parameters available to us here:
There are many variables which can be integrated but we will only focus on those that we will use:
- CMD: The command or action to be done, we will use _xclick that identifies the button “Pay Now”
- Business: PayPal ID or the email address associated with the account of the beneficiary.
- LC: Localization, this is used to support other codes.
- item_name: The name of the product that should be sold on website.
- item_number: The product identification code that should be sold
- Amount: The amount of the payment.
- currency_code: Indicates the Currency to be used for the payment, we will use INR.
- no_note: If set to 0 disables the ability to add a note to the payment.
- bn: Identifying those who built the code for the button, having built side code we’ll use : PP-BuyNowBF: btn_buynowCC_LG.gif: NonHostedGuest
- notify_url: This parameter is important; Paypal will send notifications regarding the status of the payment to the url specified here.
- return: the url to which the user is redirected to a payment made
- cbt: the text that is inserted button will return the payment made
- rm: abbreviation of Return Method, this parameter will decide the method of return of the payment information: Setting it to 1, the purchaser will be redirected to our site using the GET method, but the variables of payment will not be included. Setting it to 2, the purchaser will be redirected to our site using the POST method and the payment will be included in variables.
For now we’ll just create a basic button:
$cbt=‘Redirect to Website’;
Then we compose the url:
And finally we print the whole thing:
echo ‘<a href=”‘.$url.'”>Print</a>’;
We are sure that it works? How can we manage it? Anyway there is still no system that automatically controls the payment. How can we automate the controls and at the same time improving safety?
We will answer these questions and more in future articles.