PostfinanceMobile
in package
Mobile Payment
Pay your bill using your mobile phone
Tags
Table of Contents
Properties
- $arrError : array<string|int, mixed>
- Error messages
Methods
- getErrors() : array<string|int, mixed>
- Returns the array with error messages
- getForm() : mixed
- Creates and returns the HTML form for initialising the Postfinance Mobile payment.
- getOrderId() : int
- Returns the Order ID from the POST request, if present
- validateSign() : int
- Verify the result of the payment
Properties
$arrError
Error messages
private
static array<string|int, mixed>
$arrError
= array()
Tags
Methods
getErrors()
Returns the array with error messages
public
static getErrors() : array<string|int, mixed>
Call this when any of the other methods returns boolean false.
Return values
array<string|int, mixed> —The error message array
getForm()
Creates and returns the HTML form for initialising the Postfinance Mobile payment.
public
static getForm(int $amount, int $order_id[, string $customparam = '' ][, bool $ijustwanttotest = null ]) : mixed
Fields:
- Mandatory: currency ISO 4217 currency code (only CHF for the time being) amount Amount in cents (2.50 CHF = 250) orderid Unique order ID webuser The Mobilesolutions webuser name sign SHA-1 Signature urlsuccess Target URL after successful payment urlerror Target URL after failed payment
- Optional: customparam Parameters to be appended to the success or error URL ijustwanttotest Enables the test mode if present
Parameters
- $amount : int
-
The order amount in cents
- $order_id : int
-
The order ID
- $customparam : string = ''
-
The optional custom parameter(s)
- $ijustwanttotest : bool = null
-
Enable test mode if true
Tags
Return values
mixed —The HTML form on success, false otherwise
getOrderId()
Returns the Order ID from the POST request, if present
public
static getOrderId() : int
If the "orderid" index is missing in the $_POST array, returns zero.
Return values
int —The Order ID, or zero
validateSign()
Verify the result of the payment
public
static validateSign() : int
Validates the parameters in the fields of the POST request:
- state Payment status; "success" or "error"
- amount Amount in cents (2.50 CHF = 250)
- currency ISO 4217 currency code (CHF)
- orderid Order ID
- mosoauth Mobile Solutions Authorisation ID
- postref PostFinance Reference ID
- sign SHA-1 Signature
Return values
int —The order ID on success, zero otherwise