Saferpay
in package
Interface to Saferpay
Tags
Table of Contents
Constants
- saferpay_windowoption_id_count = 3
- saferpay_windowoption_id_popup = 1
- Window options constants
- saferpay_windowoption_id_window = 2
Properties
- $isTest : bool
- 'Is test' flag
- $arrCurrency : array<string|int, mixed>
- Currency codes
- $arrError : array<string|int, mixed>
- Error messages
- $arrKeys : array<string|int, mixed>
- Keys needed for the respective operations
- $arrLangId : array<string|int, mixed>
- Language codes
- $arrWarning : array<string|int, mixed>
- Error messages
- $gateway : array<string|int, mixed>
- The hosting gateways
- $testAccountId : string
- The test account ID
Methods
- getErrors() : string
- Returns accumulated warnings as a HTML string
- getForm() : mixed
- getOrderId() : int
- Returns the order ID of the current transaction
- getWarnings() : string
- Returns accumulated warnings as a HTML string
- getWindowMenuoptions() : string
- Returns code for HTML menu options for choosing the window display option
- payComplete() : bool
- Completes the payment transaction
- payConfirm() : bool
- Confirms the payment transaction
- payInit() : string
- Returns the URI for initializing the payment with Saferpay
- checkAttribute() : bool
- Verifies the value of an attribute
- getAttributeList() : string
- Generates a list of all attributes
Constants
saferpay_windowoption_id_count
public
mixed
saferpay_windowoption_id_count
= 3
saferpay_windowoption_id_popup
Window options constants
public
mixed
saferpay_windowoption_id_popup
= 1
Tags
saferpay_windowoption_id_window
public
mixed
saferpay_windowoption_id_window
= 2
Properties
$isTest
'Is test' flag
public
static bool
$isTest
= \false
Tags
$arrCurrency
Currency codes
private
static array<string|int, mixed>
$arrCurrency
= array('CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'PLN', 'SEK', 'USD')
Tags
$arrError
Error messages
private
static array<string|int, mixed>
$arrError
= array()
Tags
$arrKeys
Keys needed for the respective operations
private
static array<string|int, mixed>
$arrKeys
= array('payInit' => array('AMOUNT', 'CURRENCY', 'ACCOUNTID', 'SUCCESSLINK', 'DESCRIPTION'), 'payConfirm' => array('DATA', 'SIGNATURE'), 'payComplete' => array('ACCOUNTID', 'ID'))
Tags
$arrLangId
Language codes
private
static array<string|int, mixed>
$arrLangId
= array('de', 'en', 'fr', 'it')
Tags
$arrWarning
Error messages
private
static array<string|int, mixed>
$arrWarning
= array()
Tags
$gateway
The hosting gateways
private
static array<string|int, mixed>
$gateway
= array('payInit' => 'https://www.saferpay.com/hosting/CreatePayInit.asp', 'payConfirm' => 'https://www.saferpay.com/hosting/VerifyPayConfirm.asp', 'payComplete' => 'https://www.saferpay.com/hosting/PayComplete.asp')
Tags
$testAccountId
The test account ID
private
static string
$testAccountId
= '99867-94913159'
Tags
Methods
getErrors()
Returns accumulated warnings as a HTML string
public
static getErrors() : string
Return values
string —The warnings, if any, or the empty string
getForm()
public
static getForm(mixed $arrOrder[, mixed $autopost = false ]) : mixed
Parameters
- $arrOrder : mixed
- $autopost : mixed = false
getOrderId()
Returns the order ID of the current transaction
public
static getOrderId() : int
Tags
Return values
int —The Order ID
getWarnings()
Returns accumulated warnings as a HTML string
public
static getWarnings() : string
Return values
string —The warnings, if any, or the empty string
getWindowMenuoptions()
Returns code for HTML menu options for choosing the window display option
public
static getWindowMenuoptions([int $selected = 0 ]) : string
Parameters
- $selected : int = 0
-
The selected option ID
Return values
string —The HTML menu options
payComplete()
Completes the payment transaction
public
static payComplete(array<string|int, mixed> $arrOrder) : bool
Parameters
- $arrOrder : array<string|int, mixed>
-
The attributes array
Tags
Return values
bool —True on success, false otherwise
payConfirm()
Confirms the payment transaction
public
static payConfirm() : bool
Tags
Return values
bool —The transaction ID on success, NULL otherwise
payInit()
Returns the URI for initializing the payment with Saferpay
public
static payInit(array<string|int, mixed> $arrOrder[, bool $is_test = NULL ]) : string
Parameters
- $arrOrder : array<string|int, mixed>
-
The attributes array
- $is_test : bool = NULL
-
If true, uses the test account. Defaults to NULL (real account)
Tags
Return values
string —The URI for the payment initialisation on success, the empty string otherwise
checkAttribute()
Verifies the value of an attribute
private
static checkAttribute(string $attribute, string $value) : bool
Parameters
- $attribute : string
-
The attribute name
- $value : string
-
The attribute value
Tags
Return values
bool —True for valid values, false otherwise
getAttributeList()
Generates a list of all attributes
private
static getAttributeList(string $step, array<string|int, mixed> $arrOrder) : string
Note that attribute names and values are urlencode()d here, so you MUST NOT do that yourself before or after.
Parameters
- $step : string
-
The current payment step
- $arrOrder : array<string|int, mixed>
-
The attributes array
Tags
Return values
string —The URL parameter list on success, the empty string otherwise