Important information

There was an update of Unzer TLS/SSL certificates. Learn more


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).

See also