# API Requests
This section lists the API request required for the integration with the Inbank e-POS system. The following pages contain charts with demonstrations of the request sequence. The enlisted API requests are used in the following way:
1. Inbank Smart Rent is available only for cart values, product models, etc. that have been configured in agreement with Inbank. This data is retrieved using the [GET /detailed-asset-models](./#operation/getRentalConditions) endpoint. <br><br>
2. The shop retrieves a preliminary monthly payment calculation using the [POST /rental/calculations](./#operation/postCalculations) request. <br><br>
3. The e-shop initiates a payment session using the [POST /pos-sessions](./#operation/postPosSessions) endpoint. The `redirectUrl` from the response indicates the link to which the customer is redirected to complete the rental process.<br><br>
4. The e-shop redirects the customer to the e-POS environment. In e-POS customers are guided through a number of dialogs to complete the rental process. After the e-POS dialogs, customers are redirected back to the e-shop. The `returnUrl` is the one the e-shop included in the [POST /pos-sessions](./#operation/postPosSessions) request.<br><br>
5. As the flow is configured to request partner approval before contract activation, the e-shop waits for the callback indicating that the payment session received the status `granted`. At this point, the partner needs to approve the rental agreement.
This can be done either via the Inbank Partner Portal or via API.<br>

**A. Activate via API**
1. a. The e-shop retrieves the identifier of the contract (contractUuid) using the [GET /pos-sessions](./#operation/getPosSession) request. <br><br>
2. a. To approve the contract via API, the partner system needs to retrieve the required identifier types for the hero device using the [GET /detailed-asset-models](./#operation/getRentalConditions) endpoint or use previously stored value from step 1.<br><br>
3. a. Then, the hero device identifier information needs to be sent to Inbank using the [PATCH /asset-identifiers](./#operation/patchAssetIdentifier) endpoint.<br><br>
4. a. Finally, the rental agreement needs to be activated by the partner using the [POST /activation](./#operation/postContractApproval) endpoint. Ideally, activation should be done only after the customer has received the shipped device (picked it up from the parcel machine or received it by any other means). Alternatively, activation can be done when the device is shipped.<br><br>
5. a. Contract activation can be verified by calling [GET /contracts](./#operation/getContract) request If the contract received status activated, the rental agreement has been successful.

**B. Activate via Inbank Partner Portal**
1. b. The partner representative needs go to Inbank Partner Portal to assign required asset identifiers to hero device of rental contract and approve the rental.<br><br>
2. b. Once the e-shop receives the callback indicating that the payment session received the status completed, the e-shop needs to check the contract status.<br><br>
3. b. The e-shop retrieves the identifier of the contract using the [GET /pos-sessions](./#operation/getPosSession) request.<br><br>
4. b. the e-shop checks the status of the contract using the [GET /contracts](./#operation/getContract) request. If the contract received status activated, the rental agreement has been successful.<br><br>

