# Omni-Channel

Omni-Channel is the fusion of, the previously separated, POS (Point Of Sales) and E Commerce, enabling the merchant to move transactions between these two worlds, starting them on one end, finishing them on the other, or just moving card-data from the POS-side to E Commerce.

{% hint style="info" %}
This chapter soely covers the E-Commerce side of Omni-Channel, meaning moving transactions/card data from POS towards E-Commerce.

However, since Omni-Channel is the combination of the two worlds, you should contact your account-manager/sales contact, in order to get help with the POS side.
{% endhint %}

{% hint style="info" %}
Please consider our [license-chapter](https://docs.saferpay.com/home/master/licensing), to determine, if Omni-Channel is available for you.
{% endhint %}

## Requirements

The following requirements need to be met, in order to use omni-channel:

* A capable [Saferpay licence](https://docs.saferpay.com/home/master/licensing) (Flex, E Commerce, or Business) and thus the existence of a valid identification with a username and password for the Saferpay system.
* Availability of at least one active Saferpay terminal via which payment can be carried out and availability of the associated Saferpay TerminalId.
* Availability of at least one POS-device and a corresponding contract, that is compatible with Worldline Omni-Channel.
* If the [Secure Card Data use-case](#undefined) is used, you also need Saferpay Secure card Data to be activated.
* Omni-Channel can only be performed with the following payment methods:
  * [Visa/V PAY](https://docs.saferpay.com/home/integration-guide/payment-methods/visa-and-vpay)
  * [Mastercard/Mastercard Debit](https://docs.saferpay.com/home/integration-guide/payment-methods/mastercard)
  * [Maestro International](https://docs.saferpay.com/home/integration-guide/payment-methods/maestro)
  * [JCB](https://docs.saferpay.com/home/integration-guide/payment-methods/jcb)
  * [UnionPay](https://docs.saferpay.com/home/integration-guide/payment-methods/china-unionpay) ([**Creation of an alias**](#transferring-the-card-details-from-pos-to-saferpay-e-commerce) **is NOT SUPPORTED!**)
  * [Diners/Discover](https://docs.saferpay.com/home/integration-guide/payment-methods/diners-and-discover)
  * [American Express](https://docs.saferpay.com/home/integration-guide/payment-methods/american-express)
  * [Alipay+](https://docs.saferpay.com/home/integration-guide/payment-methods/alipay+)
  * [Twint](https://docs.saferpay.com/home/integration-guide/payment-methods/twint) ([**Creation of an alias**](#transferring-the-card-details-from-pos-to-saferpay-e-commerce) **is NOT SUPPORTED!**)
  * [WeChat Pay](https://docs.saferpay.com/home/integration-guide/payment-methods/wechat-pay) ([**Creation of an alias**](#transferring-the-card-details-from-pos-to-saferpay-e-commerce) **is NOT SUPPORTED!**)

{% hint style="info" %}
Please contact your account-manager/sales contact, if you are unsure about whether your POS-integration is capable of Omni-Channel, or not!
{% endhint %}

## The Transaction-Reference

Before you can begin integrating the specific use-cases, you first need to acquire the Transaction Reference.

This reference is used to perform the omni-channel requests in the first place, by referencing a previously performed POS (or E Commerce) transaction inside the Worldline acquiring-systems. Using this reference, the transaction and/or used card-details then can be transfered from the POS system to Saferpay (E Commerce).

### How to get the transaction reference, using Saferpay.

Saferpay always returns the reference inside the **`Transaction.SixTransactionReference`** parameter:

```json
"Transaction": {
    "Type": "PAYMENT",
    "Status": "AUTHORIZED",
    "Id": "723n4MAjMdhjSAhAKEUdA8jtl9jb",
    "Date": "2015-01-30T12:45:22.258+01:00",
    "Amount": {
      "Value": "100",
      "CurrencyCode": "CHF"
    },
    "AcquirerName": "Saferpay Test Card",
    "AcquirerReference": "000000",
    "SixTransactionReference": "0:0:3:723n4MAjMdhjSAhAKEUdA8jtl9jb",
    "ApprovalCode": "012345"
  }
```

### How to get the transaction reference via POS

The transaction-reference may always have this general format:

```json
0:0:3:723n4MAjMdhjSAhAKEUdA8jtl9jb
```

However, depending on which POS integration you have, this information may not be obvious, or even be returned in multiple parameters, requiring you to first combine a certain set of parameters, in order to get this reference.

When in doubt, please contact your account-manager/sales contact, or POS-support. They'll be able to help you.

## Use-Cases

Once you have ensured, that the transaction reference is gathered and built correctly, you can proceed with integrating the specific Omni-Channel use-cases, which are the following:

### Transferring a transaction from POS to Saferpay (E Commerce)

This enables you to perform further actions on a POS transaction, like authorizing a card and [capturing the transaction on E Commerce side](https://docs.saferpay.com/home/integration-guide/capture-and-daily-closing#capture), or refunding a POS transaction via Saferpay, be it [via Backoffice](https://docs.saferpay.com/home/interfaces/backoffice/transactions/journal-details#refund), or [via API](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/transaction-interface/refunds).

This is done, by executing the [OmniChannel AcquireTransaction](https://saferpay.github.io/jsonapi/#Payment_v1_OmniChannel_AcquireTransaction) request:

#### Request

```json
{
  "RequestHeader": {
    "SpecVersion": "[current Spec-Version]",
    "CustomerId": "[your customer id]",
    "RequestId": "[your request id]",
    "RetryIndicator": 0
  },
  "TerminalId": "17791723",
  "SixTransactionReference": "1:100002:1:87768996410",
  "OrderId": "Id of the order"
}
```

#### Response

```json
{
  "ResponseHeader": {
    "SpecVersion": "[current Spec-Version]",
    "RequestId": "[your request id]"
  },
  "Transaction": {
    "Type": "PAYMENT",
    "Status": "AUTHORIZED",
    "Id": "723n4MAjMdhjSAhAKEUdA8jtl9jb",
    "Date": "2015-01-30T12:45:22.258+01:00",
    "Amount": {
      "Value": "100",
      "CurrencyCode": "CHF"
    },
    "AcquirerName": "Saferpay Test",
    "AcquirerReference": "8EZRQVT0ODW4ME525",
    "SixTransactionReference": "0:0:3:723n4MAjMdhjSAhAKEUdA8jtl9jb",
    "ApprovalCode": "012345"
  },
  "PaymentMeans": {
    "Brand": {
      "PaymentMethod": "VISA",
      "Name": "VISA Saferpay Test"
    },
    "DisplayText": "9123 45xx xxxx 1234",
    "Card": {
      "Number": "912345678901234",
      "MaskedNumber": "912345xxxxxx1234",
      "ExpYear": 2015,
      "ExpMonth": 9,
      "HolderName": "Max Mustermann",
      "CountryCode": "CH"
    }
  }
}
```

This then behaves like any other Saferpay transaction, offering the same set of possibilities. The transaction will also show up inside the [Saferpay Backoffice Journal](https://docs.saferpay.com/home/interfaces/backoffice/transactions#journal).

### Transferring the card-details from POS to Saferpay (E Commerce)

This method gathers the card-details of a POS transaction and saves them within [Saferpay Secure Card Data](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/secure-card-data), giving you a card-alias. This alias then can be used like any other Secure Card Data alias. You could perform [recurring payments](https://docs.saferpay.com/home/integration-guide/licences-and-interfaces/transaction-interface/recurring-payments), or even offer this card within the card holders online account, so he/she may execute further transactions, without having to enter his/her card-details.

This is done, by executing the [OmniChannel InsertAlias](https://saferpay.github.io/jsonapi/#Payment_v1_OmniChannel_InsertAlias) request:

#### Request

```json
{
  "RequestHeader": {
    "SpecVersion": "[current Spec-Version]",
    "CustomerId": "[your customer id]",
    "RequestId": "[your request id]",
    "RetryIndicator": 0
  },
  "SixTransactionReference": "1:100002:1:87768996410",
  "RegisterAlias": {
    "IdGenerator": "RANDOM"
  }
}
```

{% hint style="info" %}
Please also consider the settings for the [IdGenerator](https://docs.saferpay.com/home/integration-guide/secure-card-data#the-id-generator)!
{% endhint %}

#### Response

```json
{
  "ResponseHeader": {
    "SpecVersion": "[current Spec-Version]",
    "RequestId": "[your request id]"
  },
  "Alias": {
    "Id": "alias35nfd9mkzfw0x57iwx",
    "Lifetime": 1000
  },
  "PaymentMeans": {
    "Brand": {
      "PaymentMethod": "VISA",
      "Name": "VISA Saferpay Test"
    },
    "DisplayText": "9123 45xx xxxx 1234",
    "Card": {
      "MaskedNumber": "912345xxxxxx1234",
      "ExpYear": 2015,
      "ExpMonth": 9,
      "HolderName": "Max Mustermann",
      "CountryCode": "CH"
    }
  }
}
```

This gives you a Secure Card Data alias, [which can be used like any other alias](https://docs.saferpay.com/home/integration-guide/secure-card-data#how-to-use-the-obtained-data).

## Testing

Testing Omni-Channel requires a special activation and configuration of your test-account. For end-to-end testing, you'd also require special POS-devices and test-cards.

If you are in need of testing Omni-Channel use-cases, please contact your account-manager/sales contact, in order for the activation to be done and to get access to the needed hardware.
