# Loans

2 of 2 supported
Source: https://plasapi.com/features/patron/loans/

Let patrons keep track of what they have borrowed and when it is due, and renew loans themselves.

## 2.4.1 View loans — Supported

Show the patron's current loans and when each one is due.

### What you can build

An overview that makes the loans that need attention stand out: overdue, due today or due soon. Each loan tells whether it can be renewed, so the client can offer renewal next to it.

### Typical flow

1. The client fetches the loans with `GetPatronLoans`.
2. Each loan is shown with its publication and due date, and the client marks loans that are overdue or due soon.
3. The patron opens a loan to see the details or renew it (2.4.3).

### What the API provides

- `dueDate` is the latest date the loan must be returned. `createdTime` is when the loan was made.
- `renew.state` is `renewable`, `not_renewable`, `renewable_later` or `unknown`. `renew.count` is how many renewals are left, when it is known.
- `acquiredFrom` tells whether the loan comes from `local_circulation` or an `interlibrary_loan`, or is `unknown`.
- `publicationMetadata` is only fallback data, for when the provider cannot serve the publication through `GetPublications`, for example for interlibrary loans.

### Calls in the API

Requires: 2.2.1

- [GET /patron/{patronId}/loan](https://plasapi.com/provider/v0.6.7/patron-loan/#GetPatronLoans) — Get patron loans

## 2.4.3 Renew loan — Supported

Extend a loan instead of returning the material.

### What you can build

Patrons renew from the loan list or from the loan itself. When a renewal is refused, the response gives the reason, so the client can tell the patron why.

### Typical flow

1. The client reads `renew.state` for each loan from `GetPatronLoans`.
2. The patron chooses a loan that can be renewed.
3. The client calls `RenewPatronLoan` with the loan's `id`.
4. On success, the response is the renewed loan with its `dueDate`.

### What the API provides

- Always check `status` in the response: `success`, or a reason such as `too_many_renewals`, `reservation_blocked_renewal`, `renewal_blocked_by_fees`, `user_blocked` or `denied`.
- A loan cannot be renewed when another patron has reserved the material. Some libraries only allow renewal a set number of days before the due date.
- `RenewPatronLoan` renews one loan. Renewing several means one call per loan.

### Calls in the API

Requires: 2.2.1

In this order

1. [GET /patron/{patronId}/loan](https://plasapi.com/provider/v0.6.7/patron-loan/#GetPatronLoans) — Get patron loans
2. [PUT /patron/{patronId}/loan/{loanId}](https://plasapi.com/provider/v0.6.7/patron-loan/#RenewPatronLoan) — Renew loan
