Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions fsp-onboarding-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,23 @@ info:

- `GET` returns the fields the merchant fills in on the terminal. The
Merchant API serves them to the terminal through
`GET /v1/terminals/onboard` in `merchant-pos-api.yaml`.
`GET /v1/terminals/{serialNumber}/onboard` in `merchant-pos-api.yaml`.
- `POST` validates the values the merchant entered. The Merchant API sends
them from `POST /v1/terminals/onboard`, with the terminal's `merchantId`
added.
them from `POST /v1/terminals/{serialNumber}/onboard`, with the
terminal's `merchantId` added.

The FSP owns the fields and the validation rules.

After the FSP accepts the values, the Merchant API gives the terminal an
API key and lets it take payments for the merchant. The Merchant API does
not verify the merchant itself. The FSP decides which proof to ask for, for
example a second factor, and limits the number of attempts.

## One URL

Both operations are served on one URL. The Merchant API holds that full
URL in its `fsp.onboarding_api` setting and calls it as is: `GET` for the
fields, `POST` for validation. The path below is where the testnet wallet
URL in its `fsp.onboarding_api` setting: `GET` for the fields, with
`merchantId` in the query, and `POST` for validation. The path below is where the testnet wallet
backend serves it.

## Authentication
Expand All @@ -38,10 +43,18 @@ paths:
summary: Get the onboarding fields
description: >
Returns the fields the merchant fills in on the terminal, with their
metadata and validation rules.
metadata and validation rules. The fields may differ per merchant.
tags:
- onboarding
security: []
parameters:
- name: merchantId
in: query
required: true
description: The terminal's merchant in the Merchant API. The FSP may ignore it.
schema:
type: string
example: 7c1f4f9a-4b8e-4c7e-9c2a-2c5d4f2a1b3e
responses:
'200':
description: The onboarding fields.
Expand Down Expand Up @@ -131,7 +144,6 @@ components:
summary: Values entered on the terminal
value:
merchantId: 7c1f4f9a-4b8e-4c7e-9c2a-2c5d4f2a1b3e
terminalSerialNumber: SN-AB12-9931
merchantCategoryCode: "5411"
contactEmail: me@interledger.org

Expand Down
72 changes: 58 additions & 14 deletions merchant-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,11 @@ paths:
This call only creates the terminal *record* (serial number,
manufacturer, model, EMV kernel). The supplied manufacturer/model
must already be registered via `POST /v1/manufacturer-models`.
The device does the onboarding with `POST /v1/terminals/onboard`
(see `merchant-pos-api.yaml`). The onboarding submits the merchant
data. The API then links the device to its merchant.
The terminal is created `PROVISIONED`. The device does the onboarding
with `POST /v1/terminals/{serialNumber}/onboard` (see
`merchant-pos-api.yaml`). The onboarding submits the merchant data. The
API then links the device to its merchant, gives it its API key and
makes the terminal `ACTIVE`.

The terminal's `serialNumber` must be unique within the system.
requestBody:
Expand Down Expand Up @@ -481,13 +483,17 @@ paths:

Status transitions are validated:

| From | Allowed transitions |
|-----------|-----------------------|
| `ACTIVE` | `SUSPENDED`, `REVOKED` |
| `SUSPENDED` | `ACTIVE`, `REVOKED` |
| `REVOKED` | *(terminal state)* |

Invalid transitions return `409 Conflict`.
| From | Allowed transitions |
|---------------|------------------------|
| `PROVISIONED` | `REVOKED` |
| `ACTIVE` | `SUSPENDED`, `REVOKED` |
| `SUSPENDED` | `ACTIVE`, `REVOKED` |
| `REVOKED` | *(terminal state)* |

Invalid transitions return `409 Conflict`. Only onboarding makes a
`PROVISIONED` terminal `ACTIVE`, and only
`POST /v1/terminals/{terminalId}/reset` makes a terminal `PROVISIONED`
again. A `REVOKED` terminal's API key stops working.
tags:
- terminal
requestBody:
Expand Down Expand Up @@ -518,7 +524,7 @@ paths:
tags:
- terminal
description: |
Soft-delete a terminal. The associated certificate is revoked
Soft-delete a terminal. Its API key is revoked
and the device will no longer be able to authenticate. Historical
records are preserved for audit purposes.
responses:
Expand All @@ -531,6 +537,36 @@ paths:
'500':
$ref: '#/components/responses/InternalError'

/v1/terminals/{terminalId}/reset:
parameters:
- $ref: '#/components/parameters/TerminalId'
post:
summary: Reset terminal
operationId: resetTerminal
tags:
- terminal
description: |
Return an `ACTIVE` or `SUSPENDED` terminal to `PROVISIONED` and revoke
its API key, so that the device can be onboarded again. Use it when the
key is lost or leaked.

A terminal in another status returns `409 Conflict`.
responses:
'200':
description: Terminal reset; returns the new representation.
content:
application/json:
schema:
$ref: '#/components/schemas/Terminal'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalError'

/v1/webhooks/open-payments:
post:
summary: Receive Open Payments notification
Expand Down Expand Up @@ -1187,7 +1223,7 @@ components:
|-------------|----------------------------------------------------------|
| `ACTIVE` | Terminal is operational and may transact. |
| `SUSPENDED` | Temporarily disabled; can be reactivated. |
| `REVOKED` | Permanently disabled; certificate is revoked. Terminal state. |
| `REVOKED` | Permanently disabled; API key is revoked. Terminal state. |
enum: [ACTIVE, SUSPENDED, REVOKED]
example: SUSPENDED

Expand Down Expand Up @@ -1224,8 +1260,16 @@ components:
status:
type: string
x-go-type: string
description: Current lifecycle status of the terminal.
enum: [ACTIVE, SUSPENDED, REVOKED]
description: |
Current lifecycle status of the terminal.

| Value | Meaning |
|---------------|------------------------------------------------|
| `PROVISIONED` | Registered, not onboarded; has no API key. |
| `ACTIVE` | Onboarded and may take payments. |
| `SUSPENDED` | Temporarily may not take payments; keeps its API key. |
| `REVOKED` | Permanently disabled; API key is revoked. |
enum: [PROVISIONED, ACTIVE, SUSPENDED, REVOKED]
example: ACTIVE
createdAt:
type: string
Expand Down
Loading