HomeCalendarFAQSearchRegisterMemberlistUsergroupsLog in

Share | 

 Online PayPal Payments with PHP and Oracle

Go down 

Number of posts : 1264
Age : 44
Registration date : 2008-03-08

PostSubject: Online PayPal Payments with PHP and Oracle   Mon 24 Mar - 20:17

Many small businesses and non-profit organizations hesitate to enter the online marketplace because of the mis-perceptions that online payment processing is risky for their users, expensive to implement, and integrate poorly with existing systems. In reality, with the advent of and subsequent improvement to Web services, the efficiency of fund transfer has greatly increased, providing an ideal way to handle nearly any volume of transactions through third-party vendors. eBay's PayPal, among the most widely known, offers competitive rates and a workable PHP SDK to access its API.

This recipe will provide an overview of this service as well as PayPal's API-less method, which can get your application processing payments even more quickly.

Let's Be Pals
To continue investigation beyond the examples in this recipe, you will need a properly configured PHP5 installation connected to a Web server application of your choice, as well as an Oracle database with appropriate connections to PHP. Zend Core for Oracle and Oracle Database 10g Express Edition (XE) are the best tools for the job. Because of the sensitive nature of online payment processing, you will want to ensure this server is secure, making strong php.ini configuration a priority. Several extensions are also required for the successful installation of the PayPal SDK: PEAR, cURL, and SSL. Best results are attained when these are compiled with PHP, though they can be loaded in the php.ini.

With your environment adequately set up, you will need to download the PayPal PHP SDK, which includes the Services/PayPal PEAR package, the PayPal WebConsole, SDK documentation and an informative PDF. (See an important note regarding WebConsole in the "Un-WebConsole-able" section below.) After downloading and extracting this file, you will need to run a few command line operations:

pear install --alldeps <location_of_extracted_sdk>/Services_PayPal/package.xml
cp -r <location_of_extracted_sdk>/WebConsole <web_server_document_root>

This command may install a few other PEAR packages and leave you with a functioning install of the PayPal SDK. You can check whether it worked by visiting http://localhost/WebConsole in your browser, where you should be greeted by the PayPal Profile Admin Tool. Common pitfalls include a missing cURL or SSL installation, which you can fix by modifying your php.ini or recompiling PHP, then running the PEAR command again. If you are unable to install PEAR or one of the necessary extensions due to hosting limitations or security concerns, you can still use Standard Checkout, described below.

Take the High Road...
Using the API through the SDK is a very flexible and powerful way to use PayPal's functionality. The two payment methods allowed through the API are:

Direct Payment: Use this to gather billing details on your Web site, charge the user's credit card, and never leave your domain. Suited to large organizations that already have https secure applications and infrastructure for storing customer and cart information.
Express Checkout: Users save time by using their PayPal account information as well as choose shipping methods, instead of reentering this information on your site. This approach frees your application from having to store a local copy of the buyer's information, and can be conducted with a minimum of additional security infrastructure.
Additional API features, not fully covered in this recipe, are also available:
Charitable donations: Provide your users with real-time information on charitable donations based on their purchases.
Shipping: If selling real-world goods, allow users to choose from various shipping vendors, shipping types, insurance, and other attributes. You will instantly be able to provide the cost of shipping to your users before they actually purchase the goods, or could use this to populate more accurate prices in your product display pages.
Refunds: Provide means to return funds to your users.
Taxes: Charge per-item or per-cart taxes, to be displayed appropriately on receipts and invoices.
Subscriptions: Flexibly define subscriptions for real-world or digital goods with recurrence.
The SDK also provides extensive eBay support, which although valuable is outside our scope here.

...Or the Low Road
The power of the SDK can far exceed what your users require; for this case, PayPal provides another solution. Standard Checkout does not use SOAP, relying solely on passing HTML form values between your application and PayPal's secure server. To use this, you need only generate a form, which can submit appropriate POST variables such as the example below:

<form action="" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="">
<input type="hidden" name="item_name_1" value="Big Widget">
<input type="hidden" name="amount_1" value="100.00">
<input type="hidden" name="item_name_2" value="Little Widget">
<input type="hidden" name="amount_2" value="1.00">
<input type="submit" value="PayPal">

After submitting this form, users will be taken to PayPal's server where they enter billing information. After verification of information and authorization of billing mechanism, they will be returned to your site at a place you define. If you are merely collecting donations, instead of selling things, you're done! However, for all other cases, a plethora of variables are available to customize this experience from functional, monetary, and display perspectives. (See the Reference Guide.)
Using Instant Payment Notification (IPN) with the notify_url variable allows your application to be notified as soon as the user finishes payment to a location of your choosing—you can use a customized link to provide back your proprietary user identifier, for example, to allow instant access to online content or trigger an order from a wholesaler. Furthermore, through the use of invoice and custom variables, you can create a structure to tie PayPal's records back to your own. If your application already saves user name and address information, you can pass this information along to PayPal through a slew of variables including address1, city, and country, and the appropriate fields will be pre-populated.

Many of the features provided by the API for collecting funds for things other than product are also covered in a rudimentary fashion by Standard Checkout: variables exist for tax, handling, and shipping, and can be applied by the cart or singly per product.
The cpp_ family of variables allows you to fine-tune the experience your users will see on the PayPal server, including cpp_header_image, cpp_headerback_color, cpp_headerborder_color and cs, which sets the payment page background color. If your application needs are met by this method, Standard Checkout can be a very cost-effective solution. Unlike the API-based Direct Payment, no monthly fee is assessed and less development is required at implementation time.
Back to top Go down
View user profile
Online PayPal Payments with PHP and Oracle
Back to top 
Page 1 of 1
 Similar topics
» Problem with Heramila Online trading
» Funny in NDBS Online
» Sri Lanka's Dialog starts mobile payment service
» CT500 set to revolutionise online-marketing in Sri Lanka
» Capital Trust "ATRAD"online trading system

Permissions in this forum:You cannot reply to topics in this forum
Job98456 :: PayPal-
Jump to: