# PostFinance Pay

Via the Saferpay JSON API, payments can be handled through PostFinance Pay.

## General requirements

Acceptance of PostFinance Pay requires:

* A [corresponding license](https://docs.saferpay.com/home/master/licensing) and thus a valid identification with a username and password for the Saferpay system.
* A valid contract with PostFinance.

### Technical requirements

The general integration of PostFinance Pay can be done via the [Payment Page](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/payment-page) and has the following requirements for integration:

* JSON API Version 1.37 or later.
* [Recurring payments](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/transaction-interface/recurring-payments) are only available [via Alias](https://docs.saferpay.com/home/licences-and-interfaces/transaction-interface/recurring-payments#recurring-payments-using-an-alias).
* Postfinance Pay does not support the [Iframe integration](https://docs.saferpay.com/home/general-information/iframe-integration-and-css#iframe-integration). [Saferpay will break out of the IFrame, if necessary](https://docs.saferpay.com/home/general-information/iframe-integration-and-css#iframe-support).
* The **`Payment.OrderId`** is restricted to a maximum of 18 characters. Anything more will be truncated.

{% hint style="warning" %}
PostFinance Pay transactions are only valid for 30 days and must be [captured](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/capture-and-daily-closing) in this time frame. After 30 days, the reservation will void and the authorized amount can no longer be transferred! However you have a guaranteed payout, within these 30 days.
{% endhint %}

{% hint style="warning" %}
[Refunds](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/transaction-interface/refunds) may only be executed up to 12 months, after the original transaction.
{% endhint %}

### Supported features

| Feature                                                                                                                                                                                                         |                                  Support                                 |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------: |
| [Capture](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/capture-and-daily-closing)/[Cancel](https://docs.saferpay.com/home/licences-and-interfaces/capture-and-daily-closing#cancel) |                                   ✅ / ✅                                  |
| [Multipart Captures](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/capture-and-daily-closing/partial-captures)                                                                       |                                     ✅                                    |
| [Secure Card Data](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/secure-card-data)                                                                                                   |                                     ✅                                    |
| [Refunds](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/transaction-interface/refunds)                                                                                               |                                     ✅                                    |
| [Recurring Payments](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/transaction-interface/recurring-payments)                                                                         | <p>✅<br><a href="#integration"><strong>Needs attention!</strong></a></p> |
| 3D Secure                                                                                                                                                                                                       |                                     ❌                                    |
| Dynamic Currency Conversion (DCC)                                                                                                                                                                               |                                     ❌                                    |
| Mail Phone Order                                                                                                                                                                                                |                                     ❌                                    |
| [Testing](#testing)                                                                                                                                                                                             |                                     ✅                                    |
| Omni-Channel                                                                                                                                                                                                    |                                     ❌                                    |

## Storage in the Secure Card Data Store

If you intend on saving PostFinance Pay-data for later use, Saferpay provides the possibility of storing the payment data inside the Saferpay Secure Card store, for the [Payment Page ](https://docs.saferpay.com/home/licences-and-interfaces/secure-card-data#secure-card-data-and-the-payment-page)and the [Standalone Alias Registration](#stansdalone-registration). For this, the following requirements must be met:

* Activation of Saferpay Secure Card Data in the Saferpay merchant account.
* The feature must also be activated on PostFinance side.

### Stansdalone registration

If you intend to use the [standalone registration](https://docs.saferpay.com/home/licences-and-interfaces/secure-card-data#standalone-secure-card-data-registration), you need to specify the parameter **Type** with the value **POSTFINANCEPAY**, which signals, that you want to save Postfinance Pay payment means.

{% tabs %}
{% tab title="Request" %}

```json
{
  "RegisterAlias": {
    "IdGenerator": "RANDOM_UNIQUE"
  },
  "Type": "POSTFINANCEPAY",
  "LanguageCode": "en",
  "RequestHeader": {
    "SpecVersion": "1.37",
    "CustomerId": "242225",
    "RequestId": "5f543be575b3f3ecff3214257ac6978a",
    "RetryIndicator": 0,
    "ClientInfo": {
      "ShopInfo": "My Shop",
      "OsInfo": "Windows Server 2013"
    }
  },
  "ReturnUrl": {
    "Url": "https://www.myshop.com/"
  }
}
```

{% endtab %}
{% endtabs %}

## Address collection from PostFinance

This function is currently not yet available and will be delivered at a later date.

## Instant Payouts

Instant Payouts enables merchants to directly fund Swiss bank accounts. Use-cases may include the payout of winnings and other cases, that do not directly refund a previously made transaction.

### Requirements

Instant Payouts requires the following things in order to work:

* The merchant needs a dedicated Instant Payout contract and a bank account with PostFinance.
  * Activation of said contract on the desired Saferpay Terminal-ID
* The recipient needs a bank account with a participating Swiss bank.
* **API SpecVersion** 1.50+

{% hint style="info" %}
Instant payouts are only possible in Swiss francs and up to a maximum amount of CHF 20'000. If the PostFinance recipient account is held in a foreign currency, PostFinance will convert the amount.
{% endhint %}

### Technical Integration

From a technical standpoint, the merchant is performing a [**RefundDirect request**](https://saferpay.github.io/jsonapi/#Payment_v1_Transaction_RefundDirect), with which they are providing the IBAN of the destination bank account, inside the **`PaymentMeans.BankAccount`** container.

In addition, for legal reasons, you **must** also send the **complete address** of the recipient inside the **`OriginalCreditTransfer.Recipient`** container. Not submitting the address may lead to errors, or rejections.

#### Example

```json
{
  "RequestHeader": {
    "SpecVersion": "[current Spec-Version]",
    "CustomerId": "[your customer id]",
    "RequestId": "[your request id]",
    "RetryIndicator": 0
  },
  "TerminalId": "[your terminal id]",
  "Refund": {
    "Amount": {
      "Value": "100",
      "CurrencyCode": "CHF"
    }
  },
  "PaymentMeans": {
    "BankAccount": {
      "IBAN": "CH98123456789012345",
      "HolderName": "John Doe"
    }
  },
  "OriginalCreditTransfer": {
    "Recipient": {
      "FirstName": "John",
      "LastName": "Doe",
      "Gender": "MALE",
      "Email": "john.doe@provider.com",
      "CountryCode": "ch",
      "City": "Somecity",
      "Street": "Somestreet 1",
      "Zip": "12345",
      "Phone": "+411234567890123",
      "DateOfBirth": "1989-03-17"
    }
  }
}
```

## Testing

Please refer to [this chapter](https://docs.saferpay.com/home/integration-guide/testing-and-go-live#postfinance-pay), if you want to test PostFinance Pay.
