PostFinance e-finance

PostFinance e-finance is an online direct payment method used in Switzerland.

About PostFinance e-finance

With PostFinance e-finance, you can accept payments in Swiss franc.

The customer gets redirected to the PostFinance e-finance login webpage.

After a successful login, PostFinance e-finance initiates a payment transaction with the customer’s bank account.

Accept a PostFinance e-finance payment

To accept a PostFinance e-finance payment, follow the steps below.

You can also implement PostFinance e-finance with the Unzer Java SDK.

Test credentials
For PostFinance e-finance test credentials, contact PostFinance.

image

Step 1: Create a post-finance-efinance resource

To create a post-finance-efinance resource, make a POST call to types/post-finance-efinance, with an empty request body:

POST https://api.unzer.com/v1/types/post-finance-efinance

Body: {}
{
    "id": "s-pfe-5bkwmmj3fz26",
    "method": "post-finance-efinance",
    "recurring": false,
    "geoLocation": {
        "clientIp": "46.140.127.001",
        "countryIsoA2": "CH"
    }
}
Property Type Description
id String The ID of the post-finance-efinance resource that you just created.

This is your typeId in Step 2.
method String The payment method.
recurring Boolean Indicates whether this is a recurring payment.
clientIp String The IP address of the device used for the payment.
countryIsoA2 String The country where the card was issued, displayed in the ISO 3166-1 alpha-2 format.

Step 2: Make a charges call

To charge the post-finance-efinance resource, make a payments/charges call with the following parameters in the request body:

Parameter Required Type Default Description Example
amount Yes Number / The amount to be charged. 110
currency Yes String / The transaction currency, in the ISO 4217 alpha-3 format. EUR
returnUrl No String / After the customer confirms the payment on the Unzer Bank Transfer payment page, returnUrl is called to redirect customer to the shop’s website. https://www.unzer.com
typeId Yes String / The ID of the newly-created post-finance-efinance resource that you received in Step 1 (as id). s-pfe-5bkwmmj3fz26
POST https://api.unzer.com/v1/payments/charges

Body:
{
    "amount": "110",
    "currency": "CHF",
    "returnUrl": "https://unzer.com",
    "resources": {
        "typeId": "s-pfe-5bkwmmj3fz26"
    }
}
{
    "id": "s-chg-1",
    "isSuccess":false,
    "isPending":true,
    "isError":false,
    "url": "https://api.unzer.com/v1/redirect/post-finance-efinance/s-2g0Jb8LhYsna",
    "timestamp": "2021-03-05 14:40:32",
    "traceId": "776e9e2f8d4eeeb89bdf049937a3041a"
}
Property Type Description
id String The transaction’s unique ID.
isSuccess Boolean Set to true if the transaction was successful.
isPending Boolean Set to true if the transaction is pending
(e.g. if a redirect to an external system is required).
isError Boolean Set to true if an error occurs.
redirectUrl String The URL to which the customer gets redirected after the payment.
timestamp String The exact time of the transaction.
traceId String A unique, randomly-generated ID of the charges process.

Step 3: Forward the customer to the redirect URL

After you charge the post-finance-efinance resource, implement the following flow:

  1. Redirect the customer to the redirectURL.
  2. The customer is forwarded to the PostFinance e-finance payment page.
  3. After a successful payment, the customer is redirected to the returnURL that you specified in the charges call (Step 2).

Step 4: Check the payment status

After the customer gets redirected to the returnUrl, check the status of the payment.

Make the following GET call:

Parameter Required Type Default Description Example
typeId Yes String / The ID of the post-finance-efinance resource that you received in Step 1 (as id). s-pfe-5bkwmmj3fz26
id Yes String / The transaction’s unique ID that you received in Step 2 (as id). s-chg-1
GET https://api.unzer.com/v1/payments/<typeId>/charges/<id>
{
    "id": "s-chg-1",
    "isSuccess": true,
    "isPending": false,
    "isError": false,
    "redirectUrl": "",
    ...
}