PayPal
in package
Interface for the PayPal payment service provider
Tags
Table of Contents
Properties
- $arrAcceptedCurrencyCode : array<string|int, mixed>
- Currency codes accepted by PayPal
Methods
- getAcceptedCurrencyCodeArray() : array<string|int, mixed>
- Returns the array of currency codes accepted by PayPal
- getAcceptedCurrencyCodeMenuoptions() : string
- Returns HTML code representing select options for choosing one of the currency codes accepted by PayPal
- getForm() : string
- Returns the PayPal form for initializing the payment process
- getOrderId() : mixed
- Returns the Order ID taken from either the "custom" or "order_id" parameter value, in that order
- ipnCheck() : bool
- This method is called whenever the IPN from PayPal is received
- isAcceptedCurrencyCode() : bool
- Returns true if the given string equals one of the currency codes accepted by PayPal
Properties
$arrAcceptedCurrencyCode
Currency codes accepted by PayPal
private
static array<string|int, mixed>
$arrAcceptedCurrencyCode
= array(
'AUD' => 'AUD',
// Australian Dollar
'CAD' => 'CAD',
// Canadian Dollar
'CHF' => 'CHF',
// Swiss Franc
'CZK' => 'CZK',
// Czech Koruna
'DKK' => 'DKK',
// Danish Krone
'EUR' => 'EUR',
// Euro
'GBP' => 'GBP',
// British Pound
'HKD' => 'HKD',
// Hong Kong Dollar
'HUF' => 'HUF',
// Hungarian Forint
'JPY' => 'JPY',
// Japanese Yen
'NOK' => 'NOK',
// Norwegian Krone
'NZD' => 'NZD',
// New Zealand Dollar
'PLN' => 'PLN',
// Polish Zloty
'SEK' => 'SEK',
// Swedish Krona
'SGD' => 'SGD',
// Singapore Dollar
'THB' => 'THB',
// Thai Baht
'USD' => 'USD',
// U.S. Dollar
// 20120601 New supported currencies:
'ILS' => 'ILS',
// Israeli New Shekel
'MXN' => 'MXN',
// Mexican Peso
'PHP' => 'PHP',
// Philippine Peso
'TWD' => 'TWD',
)
Mind that both key and value are required by the methods below.
Methods
getAcceptedCurrencyCodeArray()
Returns the array of currency codes accepted by PayPal
public
static getAcceptedCurrencyCodeArray() : array<string|int, mixed>
Note that both keys and values of the returned array contain the same strings.
Return values
array<string|int, mixed> —The array of currency codes
getAcceptedCurrencyCodeMenuoptions()
Returns HTML code representing select options for choosing one of the currency codes accepted by PayPal
public
static getAcceptedCurrencyCodeMenuoptions([string $selected = '' ]) : string
Parameters
- $selected : string = ''
-
The optional preselected currency code
Return values
string —The HTML select options
getForm()
Returns the PayPal form for initializing the payment process
public
static getForm(string $account_email, string $order_id, string $currency_code, string $amount, string $item_name) : string
Parameters
- $account_email : string
-
The PayPal account e-mail address
- $order_id : string
-
The Order ID
- $currency_code : string
-
The Currency code
- $amount : string
-
The amount
- $item_name : string
-
The description used for the payment
Return values
string —The HTML code for the PayPal form
getOrderId()
Returns the Order ID taken from either the "custom" or "order_id" parameter value, in that order
public
static getOrderId() : mixed
If none of these parameters is present in the $_REQUEST array, returns false.
Return values
mixed —The Order ID on success, false otherwise
ipnCheck()
This method is called whenever the IPN from PayPal is received
public
static ipnCheck([string $amount = NULL ][, string $currency = NULL ][, string $order_id = NULL ][, string $customer_email = NULL ][, string $account_email = NULL ]) : bool
The data from the IPN is verified and answered. After that, PayPal must reply again with either the "VERIFIED" or "INVALID" keyword. All parameter values are optional. Any that are non-empty are compared to their respective counterparts received in the post from PayPal. The verification fails if any comparison fails. You should consider the payment as failed whenever an empty (false or NULL) value is returned. The latter is intended for diagnostic purposes only, but will never be returned on success.
Parameters
- $amount : string = NULL
-
The optional amount
- $currency : string = NULL
-
The optional currency code
- $order_id : string = NULL
-
The optional order ID
- $customer_email : string = NULL
-
The optional customer e-mail address
- $account_email : string = NULL
-
The optional PayPal account e-mail
Return values
bool —True on successful verification, false on failure, or NULL when an arbitrary result is received.
isAcceptedCurrencyCode()
Returns true if the given string equals one of the currency codes accepted by PayPal
public
static isAcceptedCurrencyCode(mixed $currency_code) : bool
Parameters
- $currency_code : mixed
Return values
bool —True if the currency code is accepted, false otherwise