To place an order request, businesses must send payment details, technical specifications, and the amount to be paid to the online payment server. If the process is successful, the customer should be redirected to the online payment page at the `redirect` address returned to the `_link` parameter to complete the payment.

### Header parameters

- `Content-Type` — application/json, required

- `Authorization` — Basic <base64>, required

  `Bearer <jwt_token>`, where `jwt_token` is the token returned in the `access_token` parameter of the authentication method response.

- `Idempotency-Key` — UUID v4

  The Idempotency-Key parameter should be unique for each new API request.
  Subsequent requests to the same API endpoint with the same Idempotency-Key header will result in the server returning the same status code and response body as the initial request.
  This functionality is particularly useful to ensure consistent outcome in scenarios where network issues or retries may lead to duplicate requests.

- `Accept-Language` — string

  The language of the interface that the customer will see when redirected to the online payment page. The possible values are:
  - `ka` - Georgian (default)
  - `en` - English.

- `Theme` — string

  The theme of the interface that the customer will see when redirected to the online payment page. The possible values are:
  - `light` - Light (default)
  - `dark` - Dark.

### Body parameters

- `application_type` — "web" | "mobile"

  Defines the type of application from which the order was created. This parameter is used specifically when an order is created using Apple Pay, directly from the merchant's webpage or mobile application. `application_type` has two values:

  - `web` - For orders created from a webpage.
  - `mobile` - For orders created from a mobile application.

- `buyer` — object

  Information about the buyer.

  - `buyer.full_name` — string

    The buyer's name and surname.

  - `buyer.masked_email` — string

    The buyer's masked email address.

  - `buyer.masked_phone` — string

    The buyer's masked phone number.

- `callback_url` — string, required

  The web address of the business (must be HTTPS), which will be automatically called by the bank upon completion of the payment to provide the business with the payment details (via Callback).

- `external_order_id` — string

  The payment identifier from the business's system. The first 25 characters of the provided value will be reflected in the payment description, both on the payer's bank statement and in the description of the transaction when the funds are credited to the company's account.

- `capture` — "automatic" | "manual"

  The transaction type takes two values:

  - `automatic` - creation of a standard order, payment will be made without pre-authorization, and the amount will be immediately withdrawn from the customer’s account.
  - `manual` - after payment, the amount on the customer’s account will be blocked and will not be available for the customer. To complete the payment, it is necessary to use the pre-authorization completing method and confirm/reject the transaction. If this operation is not performed within 30 days, the amount will be automatically unblocked and will be available again for the customer. This feature can only be used when paying through Apple Pay, Google Pay or by a card.

- `purchase_units` — object, required

  The purchase information.

  - `purchase_units.basket` — array, required

    A basket of products or services purchased within a given payment in a business.

    - `purchase_units.basket[].product_id` — string, required
      The purchased product/service identifier in the business system.

    - `purchase_units.basket[].description` — string
      The name (description) of the purchased product/service.

    - `purchase_units.basket[].quantity` — number, required
      The quantity (volume) of each product/service. The minimum value is 1.

    - `purchase_units.basket[].unit_price` — number, required
      The purchased product/service unit price.

    - `purchase_units.basket[].unit_discount_price` — number
      The volume of the deducted amount on the product/service unit in case of discount payment.

    - `purchase_units.basket[].vat` — number
      The value added tax (VAT) of the purchased product/service.

    - `purchase_units.basket[].vat_percent` — number
      The percentage of value added tax (VAT) of the purchased product/service.

    - `purchase_units.basket[].total_price` — number
      The total price of the purchased product/service.

    - `purchase_units.basket[].image` — string
      The web address of the product/service image.

    - `purchase_units.basket[].package_code` — string
      The product code of the purchased product/service.

    - `purchase_units.basket[].tin` — string
      The taxpayer identification number (TIN).

    - `purchase_units.basket[].pinfl` — string
      The personal identification number of an individual (PINFL).

    - `purchase_units.basket[].product_discount_id` — string
      Product discount identifier. If a discount promotion is registered in the bank with the provided value, taking into account the terms of the discount, the corresponding promotion will be applied to the order.

  - `purchase_units.delivery` — object

    Information about the delivery service.

    - `purchase_units.delivery.amount` — number
      The delivery fee.

  - `purchase_units.total_amount` — number, required
    The full amount is to be paid.

  - `purchase_units.total_discount_amount` — number
    The reduced amount in case of payment with a discount.

  - `purchase_units.currency` — string

    The currency in which payment is made:
    - `GEL` - Georgian Lari (default)
    - `USD` - US dollar
    - `EUR` - Euro
    - `GBP` - British pound.

- `redirect_urls` — object

  The business web addresses that customers can be redirected to from the online payment system upon completion of the payment.

  - `redirect_urls.success` — string

    The web address in the case of successful completion of the transaction. If it is empty, the customer will remain on the online payments page and a corresponding receipt will be shown.

  - `redirect_urls.fail` — string

    The web address in the case of unsuccessful completion of the transaction. If it is empty, the customer will remain on the online payments page and a corresponding receipt will be shown.

- `ttl` — number

  Specifies the duration of the order lifespan in minutes (the number of minutes a customer will be able to pay). The logic of this parameter can vary depending on the business's industry. The minimum value is 2 minutes, and the maximum is 1440 minutes (24 hours). If this parameter is left empty, the system defaults to 15 minutes.

- `payment_method` — array

  The payment methods that a customer can use to pay for the order. The business must have all the methods it provides here activated. If the parameter is left empty, upon redirecting a customer to the online payment page, they will be able to use all the payment methods available for the business. The possible values are:

  - `card` - payment by a bank card
  - `google_pay` - payment through Google Pay and by a bank card (in the case of providing this option, the customer will be able to pay both by Google Pay and a bank card. The Business must have both payment methods activated)
  - `apple_pay` - payment through Apple Pay and by a bank card (in the case of providing this option, the customer will be able to pay both by Apple Pay and a bank card. The Business must have both payment methods activated)
  - `bog_p2p` - transferring by the BoG, internet, or mobile bank user
  - `bog_loyalty` - payment by the BoG MR/Plus points
  - `bnpl` - payment with Buy Now Pay Later plan
  - `bog_loan` - standard bank installment plan
  - `gift_card` - payment with a gift card

- `config` — object

  Configuration of a specific payment.

  - `config.loan` — object

    Payment configuration. Transmission of a parameter is necessary if you wish the payment to be made only by installment plan ("payment_method":["bog_loan"]) or only by bnpl ("payment_method":["bnpl"]).

    - `config.loan.type` — string

      Discount code of the installment/bnpl (the value of the discount_code parameter returned by the calculator).

    - `config.loan.month` — number

      Duration of the installment/bnpl in months (the value of the month parameter returned by the calculator).

  - `config.campaign` — object

    Duration of the installment/bnpl in months (the value of the month parameter returned by the calculator).

    - `config.campaign.card` — string

      A card type, to which the discount applies to:

      - `visa` - Visa
      - `mc` - MasterCard
      - `solo` - SOLO card

    - `config.campaign.type` — string

      Discount type:

      - `restrict` - card type restriction
      - `client_discount` - discount on a specific card type

  - `config.google_pay` — object

    Payment configuration. Transmission of a parameter is necessary if you wish to make Google Pay payment from your own webpage.

    - `config.google_pay.google_pay_token` — string
      Full string representing the encrypted Google Pay payment details. It must include all nested fields as received from the Google Pay SDK without modification or truncation.

    - `config.google_pay.external` — boolean

      - `true` - payment is initiated from the Google Pay button on business' webpage
      - `false` - Payment is initiated from the bank's webpage (default).

  - `config.apple_pay` — object

    Payment configuration. This parameter is necessary if you wish to enable Apple Pay payments from your own webpage.

    - `config.apple_pay.external` — boolean

      - `true` -Payment is initiated from the Apple Pay button on the business's webpage.
      - `false` - Payment is initiated from the bank's webpage (default).

  - `config.account` — object

    Payment configuration: This object is necessary if you have configured multiple e-commerce POS terminals in the same currency. It allows you to group payments based on business needs or settle payments on different business bank accounts.

    - `config.account.tag` — string

      E-commerce POS identifier. If provided tag does not match with POS configuration or tag was not provided, the operation will default to the default POS terminal and its corresponding payment account. Note: It is important to agree upon tag values when configuring additional ecommerce POS terminal.

  - `config.split` — object

    The configuration object for split payments. This parameter is required if you want the order amount to be automatically split into specified amounts or percentages and transferred to the corresponding IBAN accounts. For more details, see [Split Payment Details](../split-payment).

    - `config.split.split_payments` — array

      An array of split payment transactions. Each object contains the details for a single transfer.

    - `config.split.split_payments[].iban` — string, required

      The recipient's account number in IBAN format where the split amount should be transferred.

    - `config.split.split_payments[].amount` — number, required

      The specific amount to be transferred. The sum of all amounts must not exceed the total order amount.

    - `config.split.split_payments[].percent` — number, required

      The percentage of the total order amount to be transferred. The sum of all percentages must not exceed 100. Only positive numerical values from 1 to 100 are allowed.

    - `config.split.split_payments[].description` — string

      A description for the transfer.

  :::note
  Providing both `amount` and `percent` fields in the same object is not permitted.

  Each object in the `split_payments` array must contain the `iban` field and either the `amount` or `percent` field.
  :::

**Standard Order**

```bash
curl -X POST 'https://api.bog.ge/payments/v1/ecommerce/orders' \
-H 'Accept-Language: ka' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
--data-raw '{
    "callback_url": "https://example.com/callback",
    "external_order_id": "id123",
    "purchase_units": {
        "currency": "GEL",
        "total_amount": 1,
        "basket": [
            {
                "quantity": 1,
                "unit_price": 1,
                "product_id": "product123"
            }
	    ]
    },
    "redirect_urls": {
        "fail": "https://example.com/fail",
        "success": "https://example.com/success"
    }
}'
```

**With Account Tag**

```bash
curl -X POST 'https://api.bog.ge/payments/v1/ecommerce/orders' \
-H 'Accept-Language: ka' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
--data-raw '{
    "callback_url": "https://example.com/callback",
    "external_order_id": "id123",
    "purchase_units": {
        "currency": "GEL",
        "total_amount": 1,
        "basket": [
            {
                "quantity": 1,
                "unit_price": 1,
                "product_id": "product123"
            }
        ]
    },
    "redirect_urls": {
        "fail": "https://example.com/fail",
        "success": "https://example.com/success"
    },
    "config": {
        "account": {
            "tag": "category1"
        }
    }
}'
```

**With Split Payment**

```bash
curl -X POST 'https://api.bog.ge/payments/v1/ecommerce/orders' \
-H 'Accept-Language: ka' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
--data-raw '{
    "callback_url": "https://example.com/callback",
    "external_order_id": "id123",
    "purchase_units": {
        "currency": "GEL",
        "total_amount": 1,
        "basket": [
            {
                "quantity": 1,
                "unit_price": 1,
                "product_id": "product123"
            }
        ]
    },
    "redirect_urls": {
        "fail": "https://example.com/fail",
        "success": "https://example.com/success"
    },
    "config": {
        "split": {
            "split_payments": [
                {
                    "amount": 0.30,
                    "iban": "GE00BG0000000000000123",
                    "description": "Split1"
                },
                {
                    "amount": 0.20,
                    "iban": "GE00BG0000000000000321",
                    "description": "Split2"
                }
            ]
        }
    }
}'
```

**With Installment**

```bash
curl -X POST 'https://api.bog.ge/payments/v1/ecommerce/orders' \
-H 'Accept-Language: ka' \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/json' \
--data-raw '{
    "callback_url": "https://example.com/callback",
    "external_order_id": "id123",
    "purchase_units": {
        "currency": "GEL",
        "total_amount": 45,
        "basket": [
            {
                "quantity": 1,
                "unit_price": 45,
                "product_id": "product123"
            }
        ]
    },
    "redirect_urls": {
        "fail": "https://example.com/fail",
        "success": "https://example.com/success"
    },
    "payment_method": [
        "bog_loan" //"bnpl"
    ],
    "config":{
        "loan":{
            "type":"standard", //"zero" for bnpl
            "month":3
        }
    }
}'
```

### Response

- `id` — string
  Order identifier.

- `_links` — object

  The web resource addresses are used in the further stages of the payment process. At the moment two resources are returned:

  - `_links.details.href` — string

    The address of the payment details can be used to obtain information on the online payment.

  - `_links.redirect.href` — string

    The web page address, which a customer shall be redirected to in order to enter a plastic card or online banking details and complete the process.

**RESPONSE**

```json
{
    "id": "{order_id}",
    "_links": {
        "details": {
            "href": "https://api.bog.ge/payments/v1/receipt/{order_id}"
        },
        "redirect": {
            "href": "https://payment.bog.ge/?order_id={order_id}"
        }
    }
}
```
