VERSION 1.0.0
This document describes web samples that use advanced features for Website Payments Standard - including button encryption, Payment Data Transfer (PDT), and Instant Payment Notification (IPN) in the following sections:
The following are examples of Website Payments Standard's advanced features, which include code for its function:
These code samples aren't needed if you don't use these features. PayPal provides easier methods to create payment buttons. Learn more about buttons at https://www.paypal.com/IntegrationCenter/ic_standard_home.html#BuyNowButtons
The following software is required:
Software |
Download Location |
PHP 4.3.0 (or Higher) |
Download
|
PHP OpenSSL Extention |
|
OpenSSL |
Download
|
Unzip the PayPal_PHP_WPS_Toolkit.zip file, for example to C:\. You will see a paypal_php_wps_toolkit folder created under C:\.
Follow the instructions of the PayPal WPS Toolkit PHP Samples README file.
The web samples consist of the following:
The default EWP credentials used by these samples are:
Default Business Account: | sdk-seller@sdk.com |
Cert ID: | B62GVU8RWNBFC |
Path to EWP certificate: | <install_directory>\samples\web\cert\my-pubcert.pem |
Path to EWP private key: | <install_directory>\samples\web\cert\my-prvkey.pem |
Path to PayPal Public: | certificate: <install_directory>\samples\web\cert\paypal_cert_pem.txt |
The main page of the samples - index.html - contains links to each sample.
This sample shows how to dynamically encrypt payment data before sending the request to PayPal
Encrypted Buy Now button | Create an encrypted Buy Now button and complete payment on PayPal |
The primary files for this sample are:
File |
Description |
InputButtonParameters.php |
This page collects payment parameters for the Buy Now button to be generated by encryption. Called by index.html. Calls BuyNow.php. |
BuyNow.php |
This page generates the encrypted BuyNow button using payment parameters collected through the InputButtonParameters.php page. The code collects Buy Now parameters from the form displayed by InputButtonParameters.php then constructs Buy Now button by calling encryptButton method of the EWPServices class supplied with the toolkit. After the button parameters are signed and encrypted using the sdk-ewp-cert.pem certificate, the sdk-ewp-key.pem key, and the sandbox-cert.pem; the BuyNow button is displayed with the encrypted BLOB. Called by InputButtonParameters.php. uses EWPServices class which in turn uses PPCrypto class. The encryption is done using PHP OenSSL Extention functions. |
PDTResponse.php |
This page gets the PDT Get Parameters of the PDT transaction, and posts back the same to get the status of the Website Payments Standard transaction Called by PayPal to give notification about the Website Payment Standard transaction status. |
Credentials.php |
This page shows the credentials used for encrypting the Buy Now button. |
IPNListner.php |
This handler file listen for the IPN postback from the PayPal server, and logs a message in the IPN log file. |
File |
Description |
||||||||||||||
index.html |
The main web page with links to each sample. Calls InputButtonParameters.php, paypal-ipn.log, and Credentials.php. |
||||||||||||||
sdk.css |
Cascading Style Sheet (CSS) used by all sample pages. | ||||||||||||||
utility.php |
This is the configuration file for the samples.This file contains the parameters needed to encrypt the Buy Now button parameters. PayPal includes the following EWP credentials for encrypting the Buy Now button:
|
||||||||||||||
paypal-ipn.log |
IPN log file - logs all IPN details received through listener with DateTime stamp. |
The Website Payments Standard Integration Guide is available in PDF format.
https://www.paypal.com/en_US/pdf/PP_WebsitePaymentsStandard_IntegrationGuide.pdf |