Accept PayPal with server-side-only integration

Build your own payment form to add PayPal payment to the checkout page


The PayPal payment method doesn’t require any input from the customer on your website. Once they select the products and click Pay, they are redirected to the PayPal login page where they enter their details and complete the payment. Optionally, you can send the customer’s email with typeId creation and it will be profiled for them on PayPal’s webpage. You can see an example of PayPal on our demo page.

Before you begin

Step 1: Create a Payment Type resource
server side

When creating the payment type PayPal, you need to send a request to the Unzer API. The response contains an id , this is later referred to as typeId. You will need this typeId to perform the transaction. The customer email is an optional field.

POST https://api.unzer.com/v1/types/paypal/

  "email": "tester1@gmail.com"
$unzer = new Unzer('s-priv-xxxxxxxxxx');

$paypal = new Paypal();
$paypal = $unzer->createPaymentType($paypal);
Paypal paypal = new Paypal();
Unzer unzer = new Unzer(new HttpClientBasedRestCommunication(), "s-priv-xxxxxxxxxx");
paypal = unzer.createPaymentType(paypal);

The response looks similar to the following example:

  "id": "s-ppl-skki29gw2fue",
  "method": "paypal",
  "recurring": false,
  "geoLocation": {
    "clientIp": "",
    "countryCode": "DE"
  "email": "t*****1@g*****m"

For more details on PayPal payment type creation, see API reference.

Next steps

The next steps are the same as for the UI components integration, check Accept PayPal with UI Components from Step 2 onwards.