# Payments

The Omnitron module where the payments and their configurations are stored. POS, Bank,Card, CardType, MultiCurrencyCard, BinNumber, Installment, PaymentOption and BankAccount models are in the payments application. Virtual POS settings to be used on webshop and mobile platforms, management of bank settings, defining new card types and management of their settings, payment options such as credit-card, cash-register etcCredit and debit card settings can be managed using different checkout providers through the payments application.

## POS

Stores the settings of the virtual POS you will use on your website or mobile application. It can be accessed from the Sales Channels > Payment Management > Add/Edit POS Integration menu on the Omnitron panel.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

***

### `GET` POS

Retrieves attribute values from the POS table. Gets the filter parameters with `{omnitron.payments.resources.filters.PosFilter}` in PosFilter as query parameters. Supports pagination by inheriting ViewSet from ListModelMixin with query parameters of page=X and limit=Y.

Path: `/api/v1/pos/`

Filters: Filtering can only be done with `channel`, `id` and `modified_date`.

Example: `?channel=1`

**Response**

```json
{
   "count": 1,
   "next": "/api/v1/pos/?page=2",
   "previous": null,
   "results": [
       {
           "pk": 1,
           "name": " Test Garanti Pay",
           "slug": "gpay",
           "gateway": "omnicore.libs.payment_gateways.gpay.GPayGateway",
           "config": {
               "auth": {
                   "password": "111111",
                   "merchant_id": "111111",
                   "terminal_id": "111111",
                   "prov_username": {
                       "oos": "oos",
                       "refund": "refund"
                   }
               },
               "mode": "TEST",
               "version": "v0.01",
               "store_key": "111111",
               "refund_url": "https://sanalposprovtest.garanti.com.tr/VPServlet",
               "company_name": "AAA",
               "timeout_period": 300
           },
           "resource_url": "https://sanalposprovtest.garanti.com.tr/servlet/gt3dengine",
           "three_d_resource_url": null,
           "channel": 1,
           "gateway_display": "Gpay",
           "modified_date": "2022-02-10T06:28:55.575801Z",
           "created_date": "2022-02-10T06:28:55.575773Z"
       }
   ]
}
```

### `POST` Create POS

Adds a new record to the POS table. Verified with PosSerializer. Returns HTTP400 if data is not available. Returns HTTP406 if there is an error or incompatibility at the service layer during the registration process.

Path: `/api/v1/pos/`

```json
{
   "name": "POS",
   "slug": "POS",
   "gateway": "omnicore.libs.payment_gateways.dummypay.DummyPayGateway",
   "config": {
               "three_d_enabled": false,
               "fail_on_void": false,
               "auth": {},
               "fail_on_refund": false
           },
   "resource_url": "https://dummypay.net/",
   "three_d_resource_url": "https://dummypay.net/",
   "channel": 1
}
```

**Response**

The success response status is HTTP201 and the response body contains the generated POS information HTTP400 and HTTP406 response statuses mean that the POS object was not created.

```
Status 201
```

```json
{
   "pk": 11,
   "name": "POS",
   "slug": "POS",
   "gateway": "omnicore.libs.payment_gateways.dummypay.DummyPayGateway",
   "config": {
       "three_d_enabled": false,
       "fail_on_refund": false,
       "fail_on_void": false,
       "auth": {}
   },
   "resource_url": "https://dummypay.net/",
   "three_d_resource_url": "https://dummypay.net/",
   "channel": 1,
   "gateway_display": "Dummypay",
   "modified_date": "2023-01-13T11:08:43.792169Z",
   "created_date": "2023-01-13T11:08:43.792140Z"
}
```

**Errors**

```
Status 400
```

```json
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set."
   ]
}
```

```
Status 406
```

```json
{
   "non_field_errors": "{"username": ["This field is required."], "store_key": ["This field is required."], "password": ["This field is required."], "client_id": ["This field is required."]}",
   "error_code": "pos_100_2"
}
```

### `GET` POS Detail

Retrieves the object of the corresponding primary key from the POS table. If it cannot find the object, it returns HTTP404.

Path: `/api/v1/pos/{id}/`

Returns POS information with the provided ID.

**Response**

Successful response status is HTTP200 and response BODY is the details of the object.

```json

{
           "pk": 1,
           "name": " Test Garanti Pay",
           "slug": "gpay",
           "gateway": "omnicore.libs.payment_gateways.gpay.GPayGateway",
           "config": {
               "auth": {
                   "password": "111111",
                   "merchant_id": "111111",
                   "terminal_id": "111111",
                   "prov_username": {
                       "oos": "oos",
                       "refund": "refund"
                   }
               },
               "mode": "TEST",
               "version": "v0.01",
               "store_key": "111111",
               "refund_url": "https://sanalposprovtest.garanti.com.tr/VPServlet",
               "company_name": "AAA",
               "timeout_period": 300
           },
           "resource_url": "https://sanalposprovtest.garanti.com.tr/servlet/gt3dengine",
           "three_d_resource_url": null,
           "channel": 1,
           "gateway_display": "Gpay",
           "modified_date": "2023-01-13T11:08:43.792169Z",
           "created_date": "2023-01-13T11:08:43.792140Z"
}
```

### `DELETE` POS

Path: `/api/v1/pos/{id}/`

Permanently deletes POS with the provided ID.

**Response:** Only returns status 204 in response

### `PATCH`-`PUT` Update POS

Path: `/api/v1/pos/{id}/`

POS information with the provided ID is updated.

Request

```json
{
    "Pk":1,
    "name":"DummyPay",
    "Slug":"dummy-pay",
    "gateway":"omnicore.libs.payment_gateways.dummypay.DummyPayGateway",
    "Config":{
        "Three_d_enabled":false,
        "Fail_on_void":false,
        "Fail_on_refund":false
    },
    "resource_url":"https://dummypay.net/",
    "three_d_resource_url":"https://dummypay.net/",
    "Channel":1,
    "gateway_display":"Dummypay"
}
```

**Response**

```json
{
    "Pk":10,
    "name":"DummyPay",
    "Slug":"dummy-pay",
    "gateway":"omnicore.libs.payment_gateways.dummypay.DummyPayGateway",
    "Config":{
        "Three_d_enabled":false,
        "Fail_on_refund":false,
        "Fail_on_void":false,
        "Auth":{}
    },
    "resource_url":"https://dummypay.net/",
    "three_d_resource_url":"https://dummypay.net/",
    "Channel":1,
    "gateway_display":"Dummypay",
    "modified_date": "2023-01-13T11:37:10.547812Z",
    "created_date": "2023-01-13T11:08:43.792140Z"
}
```

**Errors**

```json
-- OR 406
{
    "non_field_errors": "Channel: Shop of Pos: dummy_pos cannot change.",
    "error_code": "pos_100_3"
}
-- OR 406
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set."
   ]
}
-- OR 406
{
   "non_field_errors": "{"username": ["This field is required."], "store_key": ["This field is required."], "password": ["This field is required."], "client_id": ["This field is required."]}",
   "error_code": "pos_100_2"
}
```

### `GET` Schema Structure

Path: `/api/v1/pos/schema/`

Returns the schema structure for the POS endpoint.

```json
{
    "name": "Schema",
    "description": "",
    "renders": [
        "application/json",
        "text/html",
        "text/csv",
        "application/xls",
        "application/xml"
    ],
    "parses": [
        "application/json",
        "application/x-www-form-urlencoded",
        "multipart/form-data"
    ],
    "actions": {
        "POST": {
            "pk": {
                "type": "integer",
                "required": false,
                "read_only": true,
                "label": "ID"
            },
            "name": {
                "type": "string",
                "required": true,
                "read_only": false,
                "label": "Name",
                "max_length": 64
            },
            "slug": {
                "type": "string",
                "required": true,
                "read_only": false,
                "label": "Slug"
            },
            "gateway": {
                "type": "choice",
                "required": true,
                "read_only": false,
                "label": "Gateway",
                "choices": [
                    {
                        "display_name": "alpha",
                        "value": "omnicore.libs.payment_gateways.alpha.AlphaGateway"
                    },
                ]
            },
            "config": {
                "type": "json field",
                "required": false,
                "read_only": false,
                "label": "Config",
                "choices": {
                    "fiba_credit": {
                        "client_id": {
                            "type": "string",
                            "required": true,
                            "read_only": false,
                            "label": "Client Id",
                            "max_length": 64
                        },
                        "client_secret": {
                            "type": "string",
                            "required": true,
                            "read_only": false,
                            "label": "Client Secret Key",
                            "max_length": 64
                        },
                        ...
            },
            "resource_url": {
                "type": "url",
                "required": true,
                "read_only": false,
                "label": "Resource url",
                "max_length": 200
            },
            "three_d_resource_url": {
                "type": "url",
                "required": false,
                "read_only": false,
                "label": "Three d resource url",
                "max_length": 200
            },
            "channel": {
                "type": "pk field",
                "required": true,
                "read_only": false,
                "label": "Channel"
            },
            "gateway_display": {
                "type": "method field",
                "required": false,
                "read_only": true,
                "label": "Gateway display"
            },
            "modified_date": {
                "type": "datetime",
                "required": false,
                "read_only": true,
                "label": "Modified date"
            },
            "created_date": {
                "type": "datetime",
                "required": false,
                "read_only": true,
                "label": "Created date"
            }
        }
    },
    "filters": {
        "id": {
            "type": "NumberFilter",
            "lookup_types": [
                "exact",
                "gt",
                "gte",
                "lt",
                "lte"
            ]
        },
        "channel": {
            "type": "ModelChoiceFilter",
            "lookup_types": [
                "exact"
            ]
        },
        "modified_date": {
            "type": "DateFilter",
            "lookup_types": [
                "exact",
                "gt",
                "gte",
                "lt",
                "lte",
                "date"
            ]
        },
        "pk": {
            "type": "NumberFilter",
            "lookup_types": [
                "exact",
                "gt",
                "gte",
                "lt",
                "lte"
            ]
        }
    },
    "ordering": "__all__"
}
```

## Bank

Permits bank definitions on Omnitron. It can be accessed from the Sales Channels > Payment Managements > Banks menu on Omnitron.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable 
```

***

### `GET` Banks

Path: `/api/v1/banks/`

Returns the recorded banks in Omnitron.

**Response**

```json
{
    "count": 29,
    "next": "http://localhost:8000/api/v1/banks/?page=2",
    "previous": null,
    "results": [
        {
            "pk": 2,
            "name": "Türkiye Finans Katılım Bankası",
            "slug": "turkiye-finans-katlm-bankas",
            "logo": null,
            "channel": 1,
            "modified_date": "2017-02-01T14:18:17.752654Z",
            "created_date": "2017-02-01T14:18:17.752631Z"
        },
…
}
```

**Filters**

Filtering can only be made with channel, ID and modified\_date.

`/api/v1/banks/?channel=1`

**Response**

```json

{
   "count": 1,
   "next": "/api/v1/banks/?page=2",
   "previous": null,
   "results": [
       {
           "pk": 1,
           "name": "Test Bank",
           "slug": "test-bank",
           "logo": null,
           "channel": 1,
           "modified_date": "2017-02-01T14:18:17.752654Z",
           "created_date": "2017-02-01T14:18:17.752631Z"
       }]
}
  
```

### `POST` Create Bank

Path: `/api/v1/banks/`

Adds a new record to the Bank table. It is validated with BankSerializer. If the data is not suitable, it returns HTTP400. If there is an error or non-compliance in the service layer during the recording process, it returns HTTP406.

```json
{
   "name": "Test Bank",
   "slug": "test-bank",
   "logo": null,
   "channel": 1
}  
```

**Response**

HTTP 200

```json
{
   "pk": 2,
   "name": "Test Bank",
   "slug": "test-bank",
   "logo": null,
   "channel": 1,
    "modified_date": "2023-01-13T13:28:34.304746Z",
    "created_date": "2023-01-13T13:28:34.304708Z"
}
```

**Errors**

```json
{
    "non_field_errors": [
        "The fields slug, channel must make a unique set."
    ]
}
```

### `GET` Bank Detail

Path: `/api/v1/banks/{id}/`

Returns bank information with the provided ID.

**Response**

```json
{
   "pk": 2,
   "name": "Test Bank",
   "slug": "test-bank",
   "logo": null,
   "channel": 1,
   "modified_date": "2023-01-13T13:28:34.304746Z",
   "created_date": "2023-01-13T13:28:34.304708Z"
}
```

### `DELETE` Bank

Path: `/api/v1/banks/{id}/`

Permanently deletes banks with the provided ID.

**Response**

Only returns status `204` in response.

### `PUT`-`PATCH` Update Bank

Path: `/api/v1/banks/{id}/`

Permits changes to banks with the provided ID.

```json
{
   "name": "Edited Test Bank",
   "slug": "test-bank",
   "logo": null,
   "channel": 1
}
```

**Response**

```json
{
   "pk": 2,
   "name": "Edited Test Bank",
   "slug": "test-bank",
   "logo": null,
   "channel": 1,
   "modified_date": "2023-01-13T13:31:55.092127Z",
   "created_date": "2023-01-13T13:31:29.377205Z"
}
```

**Errors**

```json
HTTP 400
{
    "non_field_errors": [
        "The fields slug, channel must make a unique set."
    ]
}
-- OR HTTP 406
{
    "non_field_errors": "Channel: Test Edited of Bank: test-bank cannot change.",
    "error_code": "bank_100_2"
}
```

### `POST` Bulk Bank Creation

Path: `/api/v1/banks/bulk_create/?channel_id={channel_id}`

Permits the bulk creation of banks with the CSV file. It is mandatory to provide channel ID as a query parameter. The fields in BankSerializer must be present in the CSV file. The logo must be expressed within the URL.

```json
{
    filename: csv_file.csv
}
```

**Response**

```json
{
    "<name>": "<Creation status>"
}
```

## Card Type

Used for the type identification of the cards to be defined on Omnitron. It can be accessed from the **Sales Channels > Payment Management > Card Types** menu on Omnitron.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

***

### `GET` Credit Card Types

Path: `/api/v1/card_types/`

Returns the card types registered on Omnitron.

**Filters**

Filtering can only be done with channel, ID and modified\_date.

`/api/v1/card_types/?channel=1`

**Response**

```json
{
   "count": 1,
   "next": "http://{customer_omnitron_url}/api/v1/card_types/?page=2",
   "previous": null,
   "results": [
       {
           "pk": 1,
           "name": "Bonus",
           "slug": "bonus",
           "logo": "http://logo.url",
           "channel": 1,
           "modified_date": "2017-02-01T14:18:17.763175Z",
           "created_date": "2017-02-01T14:18:17.763148Z"
       }]
}
```

### `GET` Credit Card Type Detail

Path: `/api/v1/card_types/{id}/`

Returns card types with the provided ID.

**Response**

```json
{
   "pk": 1,
   "name": "Bonus",
   "slug": "bonus",
   "logo": "http://logo.url.jpg",
   "channel": 1,
   "modified_date": "2017-02-01T14:18:17.763175Z",
   "created_date": "2017-02-01T14:18:17.763148Z"
}   
```

### `DELETE` Credit Card Type

Path: `/api/v1/card_types/{id}/`

Permanently deletes card types with the provided ID.

**Response**

Only returns status `204` in response

### `PUT`-`PATCH` Update Credit Card Type

Path: `/api/v1/card_types/{id}/`

Updates card types with the provided ID.

```json

{
   "pk": 1,
   "name": "Bonus-v2",
   "slug": "bonus",
   "channel": 1
}
   
```

**Response**

```json

{
   "pk": 1,
   "name": "Bonus-v2",
   "slug": "bonus",
   "logo": "http://logo.url",
   "channel": 1
}
   
```

**Errors**

```json
{
   "logo": [
       "The submitted data was not a file. Check the encoding type on the form."
   ]
}
-- OR
{
    "non_field_errors": [
        "The fields slug, channel must make a unique set."
    ]
}
-- OR HTTP 406
{
    "non_field_errors": "Channel: test of CardType: test cannot change.",
    "error_code": "card_type_100_2"
}
```

### `POST` Create a New Card Type

Adds a new record to the CardType table. Validated with CardTypeSerializer. Returns HTTP400 if data is not available. Returns HTTP406 if there is an error or incompatibility at the service layer during the recording process.

Path: `/api/v1/card_types/`

```json

{
   "name": "New Type",
   "slug": "new-type",
   "logo": "<logo file>",
   "channel": 1
}

```

**Response**

HTTP 200

```json

{
   "pk": 2,
   "name": "New Type",
   "slug": "new-type",
   "logo": "http://logo.url",
   "channel": 1,
    "modified_date": "2023-01-13T14:30:39.534199Z",
    "created_date": "2023-01-13T14:30:39.534173Z"
}

```

**Response**

HTTP 400

```json

{
   "logo": [
       "The submitted data was not a file. Check the encoding type on the form."
   ]
}
-- OR
{
    "non_field_errors": [
        "The fields slug, channel must make a unique set."
    ]
}
```

## Card

Used to define and process cards that can be used in sales channels on Omnitron. Creating a card firstly requires the creation of a card type, POS and the bank to which it will be linked. It can be accessed from the Sales Channels > Payment Management > Card Settings menu on the Omnitron panel.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

### `GET` All Credit Cards

Path: `/api/v1/cards/`

Returns all cards registered in the system.

**Filters**

Location: `Omnitron.payments.resources.filters.CardFilter`

Filtering can be performed with all fields available in the Card model.

Example: `?name=Bonus&bank=2`

**Response**

```json

{
   "count": 1,
   "next": null,
   "previous": null,
   "results": [
       {
           "pk": 1,
           "name": "Bonus",
           "bank": 2,
           "card_type": 1,
           "card_payment_type": "credit",
           "cash_payment": 10,
           "installment_payment": 2,
           "slug": "bonus",
           "three_d_payment": 10,
           "is_commerce_card": false,
           "channel": 1,
           "modified_date": "2017-02-01T14:18:17.776010Z",
           "created_date": "2017-02-01T14:18:17.775977Z"
       }
   ]
}

```

### `GET` Card Detail

Path: `/api/v1/cards/{id}/`

Returns card information with the provided ID.

**Response**

```json

{
   "pk": 1,
   "name": "Bonus",
   "bank": 2,
   "card_type": 1,
   "card_payment_type": "credit",
   "cash_payment": 10,
   "installment_payment": 2,
   "slug": "bonus",
   "three_d_payment": 10,
   "is_commerce_card": false,
   "channel": 1,
   "modified_date": "2017-02-01T14:18:17.776010Z",
   "created_date": "2017-02-01T14:18:17.775977Z"
}
```

### `PUT`-`PATCH` Update Card

Path: `/api/v1/cards/{id}/`

Updates the card information with the provided ID.

```json

{
   "pk": 1,
   "name": "New Card",
   "bank": 2,
   "card_type": 1,
   "card_payment_type": "credit",
   "cash_payment": 10,
   "installment_payment": 2,
   "slug": "new-card",
   "three_d_payment": 10,
   "is_commerce_card": false,
   "channel": 1
}

```

**Response**

```json
{
   "pk": 1,
   "name": "New Card",
   "bank": 2,
   "card_type": 1,
   "card_payment_type": "credit",
   "cash_payment": 10,
   "installment_payment": 2,
   "slug": "new-card",
   "three_d_payment": 10,
   "is_commerce_card": false,
   "channel": 1,
   "modified_date": "2023-01-16T07:35:04.404826Z",
   "created_date": "2023-01-16T07:25:39.965970Z"
}
```

**Response / 400**

```json

{
   "non_field_errors": [
       "The fields slug, channel, bank, card_type must make a unique set.",
       "The fields bank, card_type, card_payment_type must make a unique set."
   ]
}
```

**Response / 406**

```json

{
   "non_field_errors": "Card: <bank> <card_tpye> <bank_slug> <channel_name> incompatible.",
   "error_code": "card_100_2"
}

```

### `POST` Create Card

Adds a new record to the card table. Verified with CardSerializer. Returns HTTP400 if data is not available. Returns HTTP406 if there is an error or incompatibility at the service layer during the registration process.

Path: `/api/v1/cards/`

```json

{
   "name": "new",
   "bank": 2,
   "card_type": 1,
   "card_payment_type": "debit",
   "cash_payment": 10,
   "installment_payment": 2,
   "slug": "new",
   "three_d_payment": 10,
   "is_commerce_card": false,
   "channel": 1
}

```

**Response / 201**

```json
{
   "pk": 2,
   "name": "new",
   "bank": 2,
   "card_type": 1,
   "card_payment_type": "debit",
   "cash_payment": 10,
   "installment_payment": 2,
   "slug": "new",
   "three_d_payment": 10,
   "is_commerce_card": false,
   "channel": 1,
   "modified_date": "2023-01-16T07:25:39.965998Z",
   "created_date": "2023-01-16T07:25:39.965970Z"
}
```

**Response / 400**

```json
{
   "non_field_errors": [
       "The fields slug, channel, bank, card_type must make a unique set.",
       "The fields bank, card_type, card_payment_type must make a unique set."
   ]
}
```

**Response / 406**

```json
{
   "non_field_errors": "Card: <bank> <card_tpye> <bank_slug> <channel_name> incompatible.",
   "error_code": "card_100_2"
}
```

### `DELETE` Credit Card

Path: `/api/v1/cards/{id}/`

Permanently deletes cards with the provided ID.

Returns status `204` in response.

### `POST` Bulk Card Creation

Path: `/api/v1/cards/{id}/bulk_create/`

Used to bulk create BIN numbers for cards with the provided ID. The CSV file is a single column and contains the BIN number. For this process, it uses the `bulk_create` function of `BinNumberService`.

```
{
    filename: csv_file.csv
}
```

**Response**

```json
{
    "<bin_number>": "<Creation status>" 
}
```

**HTTP 406**

```json
{
    "non_field_errors": "File not found please provide an appropriate file",
    "error_code": "file_100_1"
}
```

## Bank Identification Number

The BIN that can be shopped within sales channels are defined. Each BIN is linked to a card. The match is made when the card information is entered in the sales channels. When we enter the details of a card on the Sales Channels>Payment Management>Card Settings page on the Omnitron panel, the bottom of the opened page displays a table with the title Card BIN Numbers.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

***

### `GET` All BINs​

Path: `/api/v1/bin_numbers/`

Returns all BIN numbers registered on Omnitron.

**Filters**

Filters can be applied to bin\_number\_length (6 or 8) in addition to all fields on the serializer. E.g.: `?card=1`

**Response**

```json

{
   "count": 1,
   "next": "http://{customer_omnitron_url}/api/v1/bin_numbers/?page=2",
   "previous": null,
   "results": [
       {
           "pk": 1,
           "bin_number": "524659",
           "card": 5,
           "is_active": true,
           "channel": 1,
           "modified_date": "2017-02-01T14:18:17.782154Z",
           "created_date": "2017-02-01T14:18:17.782137Z"
       }]
}

```

### `GET` BIN by ID

Path: `/api/v1/bin_numbers/{id}/`

Returns BIN numbers with the provided ID.

**Response**

```json

{
   "bin_number": "524659",
   "card": 5,
   "is_active": false,
   "channel": 1,
   "bin_number_length": "6",
   "modified_date": "2017-02-01T14:18:17.782154Z",
   "created_date": "2017-02-01T14:18:17.782137Z"
}
```

### `POST` Create BIN

Path: `/api/v1/bin_numbers/`

It is used to create BIN numbers.

```json

{
   "bin_number": "123452",
   "card": 5,
   "is_active": true,
   "channel": 1
}

```

**Response / 200**

```json

{
   "pk": 724,
   "bin_number": "123452",
   "card": 5,
   "is_active": true,
   "channel": 1,
   "bin_number_length": "6",
   "modified_date": "2023-01-16T10:03:28.949597Z",
   "created_date": "2023-01-16T10:03:28.949570Z"
}

```

**Response / 400**

```json

{
   "non_field_errors": [
       "The fields bin_number, channel must make a unique set."
   ]
}

```

**Response / 406**

```json

{
   "non_field_errors": "Channel: <channel_name> <card_name> channel incompatible.",
   "error_code": "bin_number_100_3"
}

```

### `DELETE` BIN​

Path: `/api/v1/bin_numbers/{id}/`

Deletes BIN numbers with the provided ID. Returns status `204` in response.

### `PATCH` Create BIN​

Path: `/api/v1/bin_numbers/{id}/`

Updates the bin\_number information with the provided ID.

```json
{
    "bin_number": "123454",
    "card": 5,
    "is_active": true,
    "channel": 1
}
```

**Response**

```json
{
    "pk": 724,
    "bin_number": "123454",
    "card": 5,
    "is_active": true,
    "bin_number_length": "6",
    "channel": 1,
    "modified_date": "2023-01-16T10:05:53.338918Z",
    "created_date": "2023-01-16T10:03:28.949570Z"
}
```

## Installment

Used for installments with the cards registered on Omnitron. Covers concepts such as the number of installments and late interest. When we enter the details of a card on the Sales Channels > Payment Management > Card Settings page on the Omnitron panel, the bottom of the opened page displays a table with the title “Term Commission Rates”.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

***

### `GET` All Installment Instances

Path: `/api/v1/installments/`

Returns all installment instances.

**Filters**

Filters can be applied via `card`, `installment_count`, `interest_rate` and `is_active`. E.g.: `?card=1`

**Response**

```json
{
   "count": 1,
   "next": "http://{customer_omnitron_url}/api/v1/installments/?page=2",
   "previous": null,
   "results": [
       {
           "pk": 1,
           "card": 1,
           "installment_count": 1,
           "label": "In Advance",
           "interest_rate": "0.000000",
           "is_active": true,
           "config": {},
           "translations": null,
           "modified_date": "2017-02-01T14:18:17.787615Z",
           "created_date": "2017-02-01T14:18:17.787596Z"
       }]
}
```

### `GET` Installment Detail​

Path: `/api/v1/installments/{id}/`

Returns installments with the provided ID.

**Response**

```json
{
   "pk": 1,
   "card": 1,
   "installment_count": 1,
   "label": "In Advance",
   "interest_rate": "0.000000",
   "is_active": true,
   "config": {},
   "translations": null,
   "modified_date": "2017-02-01T14:18:17.787615Z",
   "created_date": "2017-02-01T14:18:17.787596Z"
}
```

### `PUT`-`PATCH` Update Installment

Path: `/api/v1/installments/{id}/`

Updates installments with the provided ID.

```json
{
   "card": 1,
   "installment_count": 1,
   "label": "Spot Price",
   "interest_rate": "0.000000",
   "is_active": true,
   "config": {},
   "translations": null
}
```

**Response**

```json
{
   "pk": 1,
   "card": 1,
   "installment_count": 1,
   "label": "Spot Price",
   "interest_rate": "0.000000",
   "is_active": true,
   "config": {},
   "translations": null,
   "modified_date": "2023-01-16T13:02:55.275401Z",
   "created_date": "2023-01-16T11:35:18.523510Z"
}
```

**Response / 400**

```json

{
   "label": [
       "This field is required."
   ]
}

```

**Response / 406**

```json

{
   "non_field_errors": "Installment: 1 already exists.",
   "error_code": "installment_100_1"
}

```

### `POST` Create Installment

Creates installment objects.

Path: `/api/v1/installments`

```json

{
   "card": 1,
   "installment_count": 99,
   "label": "99 installment",
   "interest_rate": "0.000000",
   "is_active": true,
   "config": {},
   "translations": null
}

```

**Response / 201**

```json

{
   "pk": 74,
   "card": 1,
   "installment_count": 99,
   "label": "99 installment",
   "interest_rate": "0.000000",
   "is_active": true,
   "config": {},
   "translations": null,
   "modified_date": "2023-01-16T11:35:18.523546Z",
   "created_date": "2023-01-16T11:35:18.523510Z"
}

```

**Response / 400**

```json

{
   "label": [
       "This field is required."
   ]
}
```

**Response / 406**

```json

{
   "non_field_errors": "Installment: 1 already exists.",
   "error_code": "installment_100_1"
}

```

### `DELETE` Installment

Path: `/api/v1/installments/{id}`

Deletes installments with the provided ID. Returns status `204` in response.

## Bank Account

A BankAccount instance must be created for payments by bank transfer. When we enter the details of a bank on the Sales Channels > Payment Management > Banks menu on the Omnitron panel, the opened page displays a table with the title *Bank Accounts*.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

***

### `GET` All Bank Accounts

Path: `/api/v1/bank_accounts/`

Lists all registered bank accounts by `sort_order`.

**Filters**

Filtering can be done by ID, bank, IBAN and channel. E.g.: `?channel=1&bank=1`

**Response**

```json

{
   "count": 1,
   "next": null,
   "previous": null,
   "results": [
       {
           "pk": 1,
           "bank": 3,
           "slug": "account",
           "holder_name": "Company Name",
           "iban": "tr00000000000",
           "is_active": true,
           "sort_order": 0,
           "description": "Bank",
           "channel": 1,
           "modified_date": "2023-01-16T13:54:53.704234Z",
           "created_date": "2023-01-16T13:38:30.442930Z"
       }
   ]
}

```

### `GET` Bank Account Detail

Path: `/api/v1/bank_accounts/{id}/`

Returns bank accounts with the provided ID.

**Response**

```json

{
   "pk": 1,
   "bank": 3,
   "slug": "account",
   "holder_name": "Company Name",
   "iban": "tr00000000000",
   "is_active": true,
   "sort_order": 0,
   "description": "Bank",
   "channel": 1,
   "modified_date": "2023-01-16T13:54:53.704234Z",
   "created_date": "2023-01-16T13:38:30.442930Z"
}
```

### `PUT`-`PATCH` Update Bank Account

Updates an existing bank account object with a given body.

Path: `/api/v1/bank_accounts/{pk}/`

**Body**

```json
{
    "bank": 3,
    "slug": "new_slug",
    "holder_name": "New Holder1",
    "iban": "tr00000000000",
    "is_active": true,
    "sort_order": 0,
    "description": "New Bank Account",
    "channel": 1
}
```

or

```json
{
    "holder_name": "New Holder2"
}
```

**Response / 200**

```json
{
    "pk": 1,
    "bank": 3,
    "slug": "new_slug",
    "holder_name": "New Holder1",
    "iban": "tr00000000000",
    "is_active": true,
    "sort_order": 0,
    "description": "New Bank Account",
    "channel": 1,
    "modified_date": "2023-01-16T13:52:30.812893Z",
    "created_date": "2023-01-16T13:38:30.442930Z"
}
```

**Response / 400**

```json
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set.",
       "The fields iban, channel must make a unique set."
   ]
}
```

**Response / 406**

```json
{
   "non_field_errors": "Channel: <channel_name> Bank <bank_name> channel incompatible.",
   "error_code": "bank_account_101"
}
-- OR
{
    "non_field_errors": "Channel: Unified of BankAccount: tr00000000000 cannot change.",
    "error_code": "bank_account_102"
}
```

### `POST` Create Bank Account

Creates a new bank account object.

Path: \`/api/v1/bank\_accounts/\`\`

**Body**

```json

{
   "bank": 3,
   "slug": "new_slug",
   "holder_name": "New Holder",
   "iban": "tr00000000000",
   "is_active": true,
   "sort_order": 0,
   "description": "New Bank Account",
   "channel": 1
}

```

**Response / 201**

```json
{
    "bank": 3,
    "slug": "new_slug",
    "holder_name": "New Holder",
    "iban": "tr00000000000",
    "is_active": true,
    "sort_order": 0,
    "description": "New Bank Account",
    "channel": 1,
    "modified_date": "2023-01-16T13:54:53.704234Z",
    "created_date": "2023-01-16T13:38:30.442930Z"
}
```

**Response / 400**

```json
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set.",
       "The fields iban, channel must make a unique set."
   ]
}
```

**Response / 406**

```json
{
   "non_field_errors": "Channel: <channel_name> Bank <bank_name> channel incompatible.",
   "error_code": "bank_account_101"
}
```

### `DELETE` Bank Account​

Path: `/api/v1/bank_accounts/{id}/`

Updates the `is_active` field of bank accounts with the provided ID to False. Returns status `204` in response.

## Payment Option

Used to create and list payment options for the sales channels on Omnitron. It can be accessed from Sales Channels > Payment Management > Payment Options on the Omnitron panel.

#### **Potential Responses**

```
201 Created
400 Bad Request
404 Not Found
405 Method Not Allowed
406 Not Acceptable
```

### `GET` All Payment Options

Path: `/api/v1/payment_options/`

Returns all payment option objects.

**Filters**

Filtering can be made via the channel, slug, name, `payment_type` and `is_active` fields.\
E.x: ?slug=ödeme-seceneği\&name=ödemeseceneği

Filters are managed via `omnitron.payments.resources.filters.PaymentOptionFilter class`.

**Response**

```json
{
   "count": 2,
   "next": null,
   "previous": null,
   "results": [
       {
           "PK": 2,
           "name": "Credit Card",
           "slug": "credit_card",
           "payment_type": "credit_card",
           "sort_order": 0,
           "is_active": false,
           "config": {},
           "translations": null,
           "channel": 1,
           "modified_date": "2023-01-16T13:54:53.704234Z",
           "created_date": "2023-01-16T13:38:30.442930Z"
       },
       {
           "PK": 3,
           "name": "Remintment",
           "slug": "remintment",
           "payment_type": "funds_transfer",
           "sort_order": 2,
           "is_active": true,
           "config": {
               "pos_slug": "ME",
               "rule": {
                   "params": {},
                   "klass": "omnishop.payments.rules.StoredCardRequiredRule"
               }
           },
           "translations": null,
           "channel": 1,
           "modified_date": "2023-01-16T13:54:53.704234Z",
           "created_date": "2023-01-16T13:38:30.442930Z"
       }
   ]
}
```

### `GET` Payment Option Detail

Path: `/api/v1/payment_options/{id}/`

Returns the payment options with the provided ID.

**Response**

```json

{
   "PK": 2,
   "name": "Credit Card",
   "slug": "credit_card",
   "payment_type": "credit_card",
   "sort_order": 0,
   "is_active": false,
   "config": {},
   "translations": null,
   "channel": 1,
   "modified_date": "2022-03-28T13:33:51.859441Z",
   "created_date": "2017-02-01T14:46:02.110133Z"
}

```

### `PUT`-`PATCH` Update Payment Option

Path: `/api/v1/payment_options/{id}/`

Updates the payment options with the provided ID.

```json
{
   "PK": 2,
   "name": "Debit Card",
   "slug": "debit_card",
   "payment_type": "credit_card",
   "sort_order": 0,
   "is_active": false,
   "config": {},
   "translations": null,
   "channel": 1
}
```

**Response**

```json
{
   "PK": 2,
   "name": "Debit Card",
   "slug": "debit_card",
   "payment_type": "credit_card",
   "sort_order": 0,
   "is_active": false,
   "config": {},
   "translations": null,
   "channel": 1,
   "modified_date": "2023-01-17T06:09:11.965773Z",
   "created_date": "2023-01-17T06:09:11.965748Z"
}
```

**Response / 400**

```json
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set."
   ]
}
```

**Response / 406**

```json
{
    "non_field_errors": "Channel: test of PaymentOption new-option cannot change.",
    "error_code": "payment_option_101"
}
```

### `POST` Create Payment Option

Used to create new payment option objects. HTTP 400 and HTTP 406 responses may be returned if the request body is not compatible.

Path: `/api/v1/payment_options/`

```json
{
   "name": "New Option",
   "slug": "new-option",
   "payment_type": "credit_card",
   "sort_order": 0,
   "is_active": false,
   "config": {},
   "translations": null,
   "channel": 1
}
```

**Response / 201**

```json
{
   "PK": 4,
   "name": "New Option",
   "slug": "new-option",
   "payment_type": "credit_card",
   "sort_order": 0,
   "is_active": false,
   "config": {},
   "translations": null,
   "channel": 1,
   "modified_date": "2023-01-17T06:09:11.965773Z",
   "created_date": "2023-01-17T06:09:11.965748Z"
}
```

**Response / 400**

```json
{
   "non_field_errors": [
       "The fields slug, channel must make a unique set."
   ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.akinon.com/omnitron/channels/payments.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
