Important information


Manage payment page

Manage payment pages


To be able use the Payment Page integration with the PHP SDK, you must create a Paypage instance and initialize it using the Unzer object. As a result you get an ID and a redirectURL which can be used to show the Payment Page:

  • Use the Payment Page ID to render the embedded Payment Page as described in Embedded Payment Page guide.
  • Or redirect your customer to the redirectURL to use the hosted Payment Page as shown in the Hosted Payment Page guide.

Initialize a Payment Page

To initialize a payment page, you require at least an amount, a currency and the returnUrl.
Optional parameter for the API request can be added to your paypage instance using the setter function of the given property as demonstrated in the example below.

For a full list of parameters, see the API reference guide.

    $unzer = new UnzerSDK\Unzer('s-priv-xxxxxxxxxx');

// set mendatory parameters
$paypage = new UnzerSDK\Resources\PaymentTypes\Paypage(100.0, 'EUR', 'https://your.return.url');

// set optional parameters
        ->setShopName('My Test Shop')
        ->setShopDescription('We are selling goods.')
        ->setTagline('We are selling goods.')
            'shopDescription' => 'color: purple',
            'header' => 'background-color: red',
            'helpUrl' => 'color: blue',
            'contactUrl' => 'color: green',

// init payment page to charge transaction ...

// ... or init payment page to authorize transaction

// get the redirectURL
$redirectUrl = $paypage->getRedirectUrl();

// redirect the customer to the redirectUrl
// after finishing the payment there the customer will be redirected to the returnUrl you set via the Payment Page constructor

// Note: you have to store the paymentId (for example, in the checkout session) to be able to fetch the payment result later.
$paymentId = $paypage->getPaymentId();

Arguments to Paypage::__construct

Parameter Type Description
amount float The amount to be charged
Required: true
currency string The currency of the amount.
Required: true
returnUrl string The URL the customer will be redirected to after a transaction.
This needs to be set to a valid URL, no matter whether a redirect is necessary or not.
Required: true

Exclude payment types

To exclude specific payment types from the payment page, pass their list before calling $unzer->initPayPageCharge($paypage) or $unzer->initPayPageAuthorize($paypage).

    $unzer = new UnzerSDK\Unzer('s-priv-xxxxxxxxxx');

// set mandatory parameters
$paypage = new UnzerSDK\Resources\PaymentTypes\Paypage(100.0, 'EUR', 'https://your.return.url');

// add a single payment type to exclude list

// ...or set a list of excluded types
// ...

Additional Attributes

In PHP SDK, you can set additional attributes either with a direct setter for specific use cases or you can call the general setter for adding additional attributes.

If you want to learn more about the use cases of additionalAttributes, see Additional attributes list.

    $unzer = new UnzerSDK\Unzer('s-priv-xxxxxxxxxx');

// set mandatory parameters
$paypage = new UnzerSDK\Resources\PaymentTypes\Paypage(

// set additional attributes with direct setters.
// ...
    $unzer = new UnzerSDK\Unzer('s-priv-xxxxxxxxxx');

// set mandatory parameters
$paypage = new UnzerSDK\Resources\PaymentTypes\Paypage(

// Set additional attributes via key value pair.
$paypage->setAdditionalAttribute('myAttributeName', 'mayValue');
// ...

Arguments to Paypage::setAdditionalAttribute

Parameter Type Description
string Name of the attribute.
mixed Value for the given key.

Fetch a Payment Page

You can feth a payment page using the paypageId.

    $unzer = new Unzer('s-priv-xxxxxxxxxx');

Arguments to Paypage::fetchPayPage

Parameter Type Description
Paypage | string The paypage object or the ID of a paypage.

See also