SaferpayJson
in package
Interface to Saferpay JSON API
Tags
Table of Contents
Properties
- $acquirersWithout3dSecure : array<string|int, mixed>
- For all payment providers that SIX redirects to (i.e. does not handle internally) we do not need to check PSD-2 compliance as the payment provider is responsible for this in this case.
- $arrError : array<string|int, mixed>
- Error messages
- $liveUrl : string
- Base API URL for live system
- $testUrl : string
- Base API URL for test system
- $transactionId : string
- Contains the ID of the current transaction. Empty unless payment is confirmed.
- $urls : mixed
- API endpoint offsets for the different payment steps
Methods
- getErrors() : string
- Returns accumulated warnings as a HTML string
- getOrderId() : int
- Returns the order ID of the current transaction
- payComplete() : bool
- Completes the payment transaction
- payConfirm() : bool
- Confirms the payment transaction
- payInit() : string
- Returns the URI for initializing the payment with Saferpay
- doRequest() : stdClass|bool
- Perform a request to the Saferpay JSON API
Properties
$acquirersWithout3dSecure
For all payment providers that SIX redirects to (i.e. does not handle internally) we do not need to check PSD-2 compliance as the payment provider is responsible for this in this case.
protected
static array<string|int, mixed>
$acquirersWithout3dSecure
= array('Alipay', 'BillPay Direct Debit', 'BillPay Purchase on Receipt', 'Bonus Card', 'ePrzelewy', 'eps', 'giropay', 'iDEAL', 'JCB', 'MyOne', 'paydirekt', 'PayPal', 'PostFinance Card', 'PostFinance eFinance', 'SEPA Direct Debit', 'SOFORT', 'TWINT')
Also if a payment provider is only available for citizens of countries outside the PSD-2 zone we can ignore PSD-2 as this is an exception to it.
List of acquirer names
$arrError
Error messages
protected
static array<string|int, mixed>
$arrError
= array()
$liveUrl
Base API URL for live system
protected
static string
$liveUrl
= 'https://www.saferpay.com/api/Payment/v1/'
$testUrl
Base API URL for test system
protected
static string
$testUrl
= 'https://test.saferpay.com/api/Payment/v1/'
$transactionId
Contains the ID of the current transaction. Empty unless payment is confirmed.
protected
static string
$transactionId
= ''
$urls
API endpoint offsets for the different payment steps
protected
static mixed
$urls
= array('payInit' => 'PaymentPage/Initialize', 'payConfirm' => 'PaymentPage/Assert', 'payComplete' => 'Transaction/Capture')
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
getOrderId()
Returns the order ID of the current transaction
public
static getOrderId() : int
Return values
int —The Order ID
payComplete()
Completes the payment transaction
public
static payComplete() : bool
Return values
bool —True on success, false otherwise
payConfirm()
Confirms the payment transaction
public
static payConfirm() : bool
This sets static::$transactionId on success
Return values
bool —True on success, false otherwise
payInit()
Returns the URI for initializing the payment with Saferpay
public
static payInit(array<string|int, mixed> $arrOrder) : string
Parameters
- $arrOrder : array<string|int, mixed>
-
The attributes array
Return values
string —The URI for the payment initialisation on success, the empty string otherwise
doRequest()
Perform a request to the Saferpay JSON API
protected
static doRequest(string $step, array<string|int, mixed> $data) : stdClass|bool
Parameters
- $step : string
-
One of the strings defined as a key in $urls
- $data : array<string|int, mixed>
-
Associative array with the request payload
Return values
stdClass|bool —Decoded JSON on success, false otherwise