PostFinance Card

PostFinance Card is a debit card used for online payments in Switzerland.

About PostFinance Card

With PostFinance Card, you can accept payments in Swiss franc.

The customer gets redirected to the PostFinance Card login webpage.

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

Accept a PostFinance Card payment

To accept a PostFinance Card payment, follow the steps below.

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

Test credentials
For PostFinance Card test credentials, contact PostFinance.

image

Step 1: Create a post-finance-card resource

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

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

Body: {}
{
    "id": "s-pfc-3qujdbdjas5w",
    "method": "post-finance-card",
    "recurring": false,
    "geoLocation": {
        "clientIp": "46.140.127.001",
        "countryIsoA2": "CH"
    }
}
Property Type Description
id String The ID of the post-finance-card 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-card 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. 50
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-card resource that you received in Step 1 (as id). s-pfc-3qujdbdjas5w
POST https://api.unzer.com/v1/payments/charges

Body:
{
    "amount": "10",
    "currency": "CHF",
    "returnUrl": "https://unzer.com",
    "resources": {
        "typeId": "s-pfc-3qujdbdjas5w"
    }
}
{
    "id": "s-chg-1",
    "isSuccess":false,
    "isPending":true,
    "isError":false,
    "url": "https://api.unzer.com/v1/redirect/post-finance-card/s-2g0Jb8LhYsna",
    "timestamp": "2021-03-05 14:33:18",
    "traceId": "7f1aaf9f8ba768e7b6e0e9c55caeff5f"
}
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.
url 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-card resource, implement the following flow:

  1. Redirect the customer to the redirectURL.
  2. The customer is forwarded to the PostFinance Card 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-card resource that you received in Step 1 (as id). s-pfc-3qujdbdjas5w
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-pay-7",
    "state":{
        "id": 0,
        "name": "completed"
    },
    "amount": {
        "total": "10.0000",
        "charged": "10.0000",
        "canceled": "0.0000",
        "remaining": "0.0000"
    },
    "currency": "CHF",
    "orderId": "",
    "invoiceId": "",
    "resources": {
        "customerId": "",
        "paymentId": "s-pay-7",
        "basketId": "",
        "metadataId": "",
        "payPageId": "",
        "traceId": "6e37c627b10b8a3cc10b843042b9a7c5",
        "typeId": "s-pfc-3qujdbdjas5w"
    },
    "transactions": [
        {
            "date": "2020-11-11 13:58:14",
            "type": "charge",
            "status": "success",
            "url": "",
            "amount": "10.0000"
        }
    ]
}