![]() |
|
Provides a paypal interface wrapper. More...
Public Member Functions | |
PayPal () | |
createForm ($business, $item_name, $currency_code, $price, $submit=null, $action=null) | |
formSet ($fields, $value= '') | |
formAction ($action) | |
recurringPaymentType ($type, $every=1) | |
redirectAfter ($seconds) | |
formIpn ($ipn_url) | |
formExtend () | |
formOutput () | |
headersNoCache () | |
ipnPaymentData ($key=null) | |
ipnPostedData ($key=null) | |
validIpn ($paypalurl=self::PPURL) | |
Data Fields | |
const | SANDBOX = 'https://sandbox.paypal.com/cgi-bin/webscr' |
const | ACTIVE = 'https://www.paypal.com/cgi-bin/websrc' |
const | PPURL = 'www.paypal.com' |
const | PPSBURL = 'sandbox.paypal.com' |
$form_fields = array() | |
$form_submit_image = null | |
$form_action = '' | |
$form_redirect = 10 | |
$ipn_posted_data | |
$ipn_payment_data = array() | |
Provides a paypal interface wrapper.
Usage
PayPal | ( | ) |
Construct
createForm | ( | $business, | |
$item_name, | |||
$currency_code, | |||
$price, | |||
$submit = null , |
|||
$action = null |
|||
) |
Creates a form based on the required fields
string | $business | : email adress for the paypal account |
string | $item_name | : name of the item or shopping cart( must be 127 characters max ) |
string | $currency_code | : defines the currency in which the monetary variables are denoted |
string | $price | : price of the item or the total price of all items in the shopping cart |
Tag | $submit | : [optional] the button for the buyer to press in order to initiate the process. The default will be the paypal button 'x-click-but01.gif' from their website. |
string | $action | : [optional] the location the form will be submited to. The default value is https://www.paypal.com/cgi-bin/websrc |
formSet | ( | $fields, | |
$value = '' |
|||
) |
Set fields for the form
string | $fields | : field name |
array | $fields | : array of field names and values to set |
string | $value | : [optional]field value |
formAction | ( | $action | ) |
Set form action, PayPal::SANDBOX, PayPal::ACTIVE can be used
string | $action |
recurringPaymentType | ( | $type, | |
$every = 1 |
|||
) |
Set the payment type : once a day, a month, a year or just one payment
string | $type | : once / day / month / year |
integer | $every | : [optional] enable recurring payment for every number of years/months/days |
redirectAfter | ( | $seconds | ) |
Redirect the form to paypal after a set number of seconds
integer | $seconds |
formIpn | ( | $ipn_url | ) |
formExtend | ( | ) |
Set the paypal form to the extended version in order to support more arguments
formOutput | ( | ) |
Generate the form and output it
headersNoCache | ( | ) |
Function call recomended in order to disable caching before outputing the form
ipnPaymentData | ( | $key = null | ) |
Get ipn payment data after the ipn has been processed
string | $key | : [optional]set to null in order to return all the values as an array |
IndexOutOfBoundsException |
ipnPostedData | ( | $key = null | ) |
Get posted data from paypal after the ipn has been processed
string | $key | : [optional]set to null in order to return all the values as an array |
IndexOutOfBoundsException |
validIpn | ( | $paypalurl = self::PPURL | ) |
Checks is the request is a valid ipn from paypal
string | $paypalurl | : [optional] paypal url to post data to |
PageNotFoundException | : in case the paypal connection can't be established |
IncompleteActionException | : in case the ipn verification failed |
SANDBOX = 'https://sandbox.paypal.com/cgi-bin/webscr' |
string : Paypal sandbox post link
ACTIVE = 'https://www.paypal.com/cgi-bin/websrc' |
string : Paypal active post link
PPURL = 'www.paypal.com' |
string : Paypal url
PPSBURL = 'sandbox.paypal.com' |
string : Paypal developer url
$form_fields = array() |
array : Fields that will be posted to paypal
$form_submit_image = null |
string : Custom submit button
$form_action = '' |
string : Paypal form action, can be either the paypal sandbox url or the original one
$form_redirect = 10 |
string : Submit the form using javascript after a set number of seconds. Set this to 0 to disable autosubmitting
$ipn_posted_data |
string : The posted data received by the ipn request
$ipn_payment_data = array() |
string : Payment data processed from the posted data received by ipn