alt

Important information

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

Unzer

Manage payment page

Manage payment pages

Overview

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
$paypage->setLogoImage('https://your.logo.image.url')
        ->setFullPageImage('https://your.full.page.image.url')
        ->setShopName('My Test Shop')
        ->setShopDescription('We are selling goods.')
        ->setTagline('We are selling goods.')
        ->setOrderId('YourShopOrderId')
        ->setTermsAndConditionUrl('https://your.tac.url')
        ->setPrivacyPolicyUrl('https://your.privacy.policy.url')
        ->setImprintUrl('https://your.imprint.url')
        ->setHelpUrl('https://your.help.url')
        ->setContactUrl('https://your.contact.url')
        ->setInvoiceId('YourShopInvoiceId')
        ->setCard3ds(true)
        ->setEffectiveInterestRate(4.99)
        ->setCss([
            'shopDescription' => 'color: purple',
            'header' => 'background-color: red',
            'helpUrl' => 'color: blue',
            'contactUrl' => 'color: green',
        ]);

// init payment page to charge transaction ...
$unzer->initPayPageCharge($paypage);

// ... or init payment page to authorize transaction
$unzer->initPayPageAuthorize($paypage);

// 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 (e.g. 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