# Order Request ⚠️(Deprecated)

By calling this method an Online Shop sends the payments details, technical parameters, and a payment amount to an Installment Loan Server. To proceed further in case of the successful operation, a customer should be redirected to an Online Payment Webpage as per a `REDIRECT` URL returned in a `links` parameter

### Header

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

- `Authorization` — Bearer <jwt_token>, required

  `Bearer <jwt_token>`, where the jwt_token is a value returned in an access_token parameter from the Authentication Method Response

### Body

- `intent` — string, required

  defines which payment method is used by the customer for payment. When using the Installment Loan Integration `LOAN` value should be always passed in this element

- `installment_month` — string, required

  An installment loan duration in months selected by the customer.
  To receive the installment loan duration in months and type you should use a [loan calculator](get-discounts.md) service

- `installment_type` — string, required

  An installment loan type selected by the customer

- `shop_order_id` — string, required

  A Payment Identifier from an Online Shop system (i.e.: An ID of a shopping Basket).

- `success_redirect_url` — string, required

  An address (URL) of a webpage of the Online Shop to which a customer will be redirected on the successful activation of the installment loan. After the activation of the installment loan, a callback is sent to a Merchant which should return a `200` HTTP code and upon receiving this code a customer will be redirected to the success_redirect_url. A customer will be redirected to the `reject_redirect_url` if the Merchant returns a code other than 200 HTTP as a response on a callback. In this case, the status will remain ‘success’ and Merchant should call an Installment [Loan Details](installment-details.md) Service to retrieve an updated status

- `fail_redirect_url` — string, required

  An address (URL) of a webpage of the Online Shop to which a customer will be redirected if the activation of the installment loan fails

- `reject_redirect_url` — string, required

  An address (URL) of a webpage of the Online Shop to which a customer will be redirected in case of a failure other than the activation of the installment loan or if Merchant returns a code other than 200 HTTP as a response on a callback, or if a callback has a timeout response

- `validate_items` — boolean

  Based on this parameter a total amount of the products cost from the cart is compared to a total amount of an order. Value if omitted: `true`

  -	`true` a total amount of the products cost from the cart will be compared to a total amount of an order and an error will occur in case of difference
  -	`false` a total amount of the products cost from the cart will not be compared to a total amount of an order, but the cost of each product from the cart should be greater than 0

- `locale` — ka

  defines the language of the Online Installment Loan Webpage on which a customer will be redirected. At the moment it may have only a `ka` – Georgian value

- `purchase_units` — array, required

  contains information about the Installment Loan Amount and currency

  - `amount` — object, required

    An Installment Loan Amount object

    - `currency_code` — string, required

    An Installment Loan currency

    - `value` — number, required

    An Installment Loan Amount value

- `cart_items` — array, required

  A list of the products purchased in the Online Shop within the given payment which contain a following attributes

  - `total_item_amount` — string, required

    A total cost of products. E.x. if a product price is 50 GEL and a quantity is 2, then 100 should be passed in this parameter

  - `item_description` — string, required

    A name of the purchased product (description)

  - `total_item_qty` — number, required

    A quantity of the purchased products

  - `item_vendor_code` — string, required

    An ID of the purchased product in the Online Shop System

  - `product_image_url` — string

    A URL of the product image

  - `item_site_detail_url` — string

    A product page URL on the Online Shop webpage

**request**

```api
POST /v1/installment/checkout
Content-Type: application/json
Authorization: Bearer <jwt_token>
```

```json
{
  "intent": "LOAN",
  "installment_month": 6,
  "installment_type": "STANDARD",
  "shop_order_id": "123456",
  "success_redirect_url": "https://demo.ipay.ge/success",
  "fail_redirect_url": "https://demo.ipay.ge/fail",
  "reject_redirect_url": "https://demo.ipay.ge/reject",
  "validate_items": true,
  "locale": "ka",
  "purchase_units": [
    {
      "amount": {
        "currency_code": "GEL",
        "value": "500.00"
      }
    }
  ],
  "cart_items": [
    {
      "total_item_amount": "10.50",
      "item_description": "test_product",
      "total_item_qty": "1",
      "item_vendor_code": "123456",
      "product_image_url": "https://example.com/product.jpg",
      "item_site_detail_url": "https://example.com/product"
    }
  ]
}
```

### Response

- `status` — string

  A status of the online installment loan

- `links` — array

  URLs that are used on the further steps of the installment loan process.
  Currently, the `links` parameter may return one of these two resources:
  -   An installment loan details URL allows retrieving information regarding the installment loan (the ‘rel’ parameter of this resource has a value ‘self’)
  -	A URL on which a customer should be redirected to enter the credentials of the online banking and finalize the installment loan process (the ‘rel’ parameter of this resource has a value ‘target’)

  - `href` — string

    A Web resource Address

  - `rel` — string

    A Web resource unique name

  - `method` — string

    An HTTP method that should be used to redirect on the web resource (GET, REDIRECT…)

- `order_id` — string

  An unique identifier of the online installment loan order

**response**

```json
{
  "status": "CREATED",
  "links": [
      {
          "href": "https://installment-test.bog.ge/v1/installment/checkout/{order_id}",
          "rel": "self",
          "method": "GET"
      },
      {
          "href": "https://installment-test.bog.ge/?order_id={order_id}&locale=ka",
          "rel": "target",
          "method": "REDIRECT"
      }
    ],
  "order_id": "{order_id}"
}
```
