Skip to main content

Point of sale API v2 (2.0.0)

Download OpenAPI specification:Download

API Support: it@nemuru.com

Introduction

Point-of-sale financing (either in store or remote) is initiated by the merchant: the seller initiates the financing application by selecting a product (consumer loan, credit line, etc.) and setting the conditions (loan principal, term, instalment amount, etc.). After introducing the customer’s contact information, the financing application is generated and the link to the digital onboarding is sent off to the customer. The customer completes the onboarding process, either in-store or remotely, and the financing application is distributed amongst Nemuru’s pool of lenders, thus maximising the approval rate.

To create a financing invitation (Create loan) it is necessary to provide three types of information: loan conditions, contact details about the customer (borrower), and asset details. Prior to this, it might be necessary to check the available loan conditions for an specific amount and term. Your agent id is also required, which you can obtain from the Get agent profile use case, after having obtained an access token using the Login use case. Once a loan is created, it is possible to check its details and status in a couple of ways: (1) get the loan details on demand by calling the Get loan by id use case, or (2) Create a webhook to get notifications about all loan status changes automatically If needed, you can use the Upload documentation use case to upload files and documents for an specific loan.

To sum up, this is the list of requests that are typically needed for integrating Nemuru for in-store / remote financing:

Errors

Nemuru's APIs use HTTP status codes together with error objects to handle errors. When an API call fails, the response will include a 4xx or 5xx status code together with a response body.

The error object MUST contain an exception and an error property. ONLY in case of 400 Bad Request error, the schema_errors property will also be present:

  • The exception is a path referring to the unique and enumerable error that occurred in Nemuru. The intent of this property is that it is machine readable and so that you can act properly on its value.
  • The error is the message that accompanies Nemuru's exception. It's value is a human readable message to aid in debugging.
  • The schema_errors returns an object indicating invalid fields in the request. This property is ONLY available when an API call returns a status 400 Bad Request —the request data do not comply with the scheme validation.

Examples

A few examples of error response bodies:

404 Not Found

{
    "status": "ko",
    "exception": "Nemuru\\Module\\Financial\\Domain\\Loan\\Exception\\LoanNotFoundByIdException",
    "error": "\\Loan\\ with id \\c7d07661-8644-425e-91e0-afdcaef6f8d9\\ not found"
}

Status codes

Code Label Description
200 OK The target resource was successfully found.
201 Created The target resource was successfully created.
204 No content The target resource was successfully modified.
400 Bad Request Some input property does not meet the expected validation.
401 Unauthorized The access token used has expired or is invalid.
403 Forbidden The user’s credentials are not authorized to consume the target service.
404 Not Found The target resource was not found.
409 Conflict There was a conflict with the current state of the target resource.
410 Gone The target resource is no longer available.
500 Internal Error The server encountered an unexpected condition that prevented it from fulfilling the request.
502 Bad Gateway Error The service received an invalid response from the upstream server.
504 Gateway Timeout The service did not get a response in time from the upstream server that it needed in order to complete the request.

Authentication

Login

Retrieve an access token with your username and password, which will be needed in following requests.

Request Body schema: application/json

Login

username
required
string
Example: "username@email.com"

Username

password
required
string
Example: "12345"

Password

Responses

Request samples

Content type
application/json
{
  • "username": "username@email.com",
  • "password": "12345"
}

Response samples

Content type
application/json
{
  • "token_type": "Bearer",
  • "access_token": "1857fdb2-c746-44f9-88a8-507a855fe920",
  • "refresh_token": "f9131f93-5e64-461e-8493-0fb8cb76f31d",
  • "expires_in": 2678400
}

Agent

Get agent profile

Gets the corresponding agent associated to the credentials through the access token from the header.

The id that appears in the payload of the response corresponds to the agent id linked to the access token from which the request was sent. This id can be used to create loans in the name of this agent.

header Parameters
Authorization
required
string

The Authorization header must include Bearer <access_token>. See the authentication section.

Content-Type
string
Default: application/json

Content-Type

Responses

Response samples

Content type
application/json
{
  • "status": "ok",
  • "payload": {
    },
  • "identifier": "urn:nemuru:api_gateway:external:v2:agent:23f4dd4f-79aa-4ed2-ad7d-5c657eb4c7f7"
}

Loan

Create loan

Creates a Loan.

The request must provide a loan id (id), the corresponding agent id (agent_id), and three blocks of information:

  • Loan conditions: currency, term, principal, program, insurance
  • Borrower: email, full name, phone number
  • Asset: type, description, value

Depending on the type of asset, the details within the asset substructure will have more or less data points.

Note that the loan principal amount must be equal or lower than the asset value. For example, financing a car valued at 15,000€, then the loan principal cannot exceed the price of the car.

header Parameters
Authorization
required
string

The Authorization header must include Bearer <access_token>. See the authentication section.

Content-Type
string
Default: application/json

Content-Type

Request Body schema: application/json
id
required
string <uuid>
Example: "e7c52ad3-0473-4fbc-bc36-7eb755b1c18d"

The Loan id

agent_id
required
string <uuid>
Example: "23f4dd4f-79aa-4ed2-ad7d-5c657eb4c7f7"

The Agent id

currency
required
string
Example: "EUR"

The Loan currency

term
required
number
Example: 30

The Loan term in months (integer)

principal
required
number
Example: 5000

The Loan principal (float)

annual_interest
number
Example: 0.091

The Loan annual interest rate (float, not percentage). No need to provide the annual interest rate unless previously agreed with Nemuru.

program
required
string
Enum: "free_program" "zero_program"
Example: "free_program"

The Loan program reference.

object

The Borrower setup fee

object

The Insurance details, associated with the Loan

required
object

The Borrower details

asset_type
required
string

The Asset type

required
object

The Education asset

Responses

Request samples

Content type
application/json
Example
{
  • "id": "e7c52ad3-0473-4fbc-bc36-7eb755b1c18d",
  • "agent_id": "23f4dd4f-79aa-4ed2-ad7d-5c657eb4c7f7",
  • "currency": "EUR",
  • "term": 30,
  • "principal": 5000,
  • "annual_interest": 0.091,
  • "program": "free_program",
  • "setup_fee": {
    },
  • "insurance": {
    },
  • "borrower": {
    },
  • "asset_type": "education",
  • "asset": {
    }
}

Response samples

Content type
application/json
{ }

Loan actions

Perform a variety of actions on the Loan by indicating the action (op) in the request body.

header Parameters
Authorization
required
string

The Authorization header must include Bearer <access_token>. See the authentication section.

Content-Type
string
Default: application/json

Content-Type

Request Body schema: application/json
id
required
string <uuid>
Example: "e7c52ad3-0473-4fbc-bc36-7eb755b1c18d"

The Loan id

op
required
string <string>
Enum: "cancelLoan" "approveLoan" "sendContract" "signContract" "confirmLoan" "payLoan"
Example: "confirmLoan"

The desired Loan management operation. Some of these operations may requiere additional information to be included in the body of the request (tap the blue buttons above to switch between different operations and use the right-hand side Request samples examples to switch between different examples).

  • cancelLoan: Cancel the loan. The resulting loan status will be status_cancelled.
  • approveLoan: Approve or deny the loan. The resulting loan status will depend on the values passed in the request. Possible resulting loan status: status_analysing, status_lender_has_been_selected, status_denied.
  • sendContract: Send the contract to the Borrower. The resulting loan status will be status_contract_sent.
  • signContract: Sign the contract. The resulting loan status will be status_contract_signed.
  • confirmLoan: Mark the loan as confirmed (formalization). The resulting loan status will be status_docs_approved.
  • payLoan: Mark the loan as paid. The resulting loan status will be status_active_trial.

Responses

Request samples

Content type
application/json
Example
{
  • "id": "e7c52ad3-0473-4fbc-bc36-7eb755b1c18d",
  • "op": "cancelLoan"
}

Response samples

Content type
application/json
{ }

Get loan by id

Get loan by id (loanId).

The loan status represents the current status of the loan.

path Parameters
loanId
required
string <uuid>
Example: e7c52ad3-0473-4fbc-bc36-7eb755b1c18d

Loan Id

header Parameters
Authorization
required
string

The Authorization header must include Bearer <access_token>. See the authentication section.

Content-Type
string
Default: application/json

Content-Type

Responses

Response samples

Content type
application/json
{
  • "status": "ok",
  • "payload": {
    },
  • "identifier": "urn:nemuru:api_gateway:external:v2:loan:e7c52ad3-0473-4fbc-bc36-7eb755b1c18d"
}

Get loan conditions

Gets the loan conditions given an agent id and loan parameters (currency, term, and principal).

This operation does not create a loan, it only simulates and returns the loan conditions available. If the agent (= merchant) has more than one loan program to offer (e.g. 0% APR program, Standard program), the loan conditions will be simulated for each program as long as the input parameters find an available pricing.

query Parameters
agent_id
required
string
Example: agent_id=9286898b-7bb7-4885-9a9b-94c4e880378b

The Agent id

currency
required
string
Example: currency=EUR

The Loan currrency

term
required
number
Example: term=30

The Loan term defined by the user

principal
required
number
Example: principal=5000

The Loan principal amount

header Parameters
Authorization
required
string

The Authorization header must include Bearer <access_token>. See the authentication section.

Content-Type
string
Default: application/json

Content-Type

Responses

Response samples

Content type
application/json
{
  • "status": "ok",
  • "data": [
    ]
}

Webhook

A Webhook (also called a web callback or HTTP push API) is a way for an app to provide other applications with real-time information. A webhook delivers data to other applications as it happens, meaning you get data immediately.

Webhooks are an effective way to get information as it happens, rather than continually polling for that data.

State

Webhooks can be enabled or disabled. By default, webhooks are always enabled.

  • Enabled: 1
  • Disabled: 2

Client

The notification can be sent to an email address (email) or posted to an endpoint (callback).

  • Email: email
  • Callback: callback

Callbacks

In case the response was a callback, the payload for each type of event would vary:

// loan_steps
{
  "id": "e7c52ad3-0473-4fbc-bc36-7eb755b1c18d",
  "event": "loan_steps",
  "step": "status_opened",
  "triggered_at": "2020-06-18T00:00:00+00:00"
}

where:

  • id: the loan id
  • event: the event name (loan_steps by default)
  • triggered_at: timestamp of the event

Loan steps

Step Description
status_initial Agent sends loan proposal to borrower
status_opened Borrower opens the loan invitation
status_kyc_set Borrower accepts T&C and finishes KYC
status_income_set Borrower income is obtained either through Bank Reader or declared manually
status_professional_details_set Borrower submits professional details
status_risk_set Origination risk values are set
status_analysing Borrower finishes onboardin. Loan applications sent to lenders
status_lender_has_been_selected Lender accepts the loan application (pre-approved)
status_contract_sent Contract is sent to borrower
status_contract_signed Borrower signs the contract
status_docs_approved Documentation evaluation by lender finishes successfully and sends transfer order
status_active_trial Funds are sent to merchant (money out)
status_active 14-day grace period finishes and loan is active
status_desisted Borrower desists the loan
status_denied Loan application is denied by lenders
status_expired Loan invitation is expired (not finished before 30 days since status_initial)
status_cancelled Merchant cancels the loan proposal
status_cancelled_test Loan proposal is cancelled as it is a test
status_ended Loan is fully paid by the borrower

Authentication

Webhook callbacks can use multiple authentication methods. The authentication information has to be provided by you at the moment of creating the webhook.

  • No authentication

  • Authorization header: callbacks will include a static authorization token in the header, tipically used for basic authentication applications. Independent of the authentication scheme, the full header has to be provided by you. For example, if you wish to apply a Basic Authorization header, you should provide 'authorization_header': 'Basic bG9sOnNlY3VyZQ==' and 'content_type': 'application/json'.

  • OAuth 2.0: callbacks will use an OAuth 2.0 authentication scheme. For this, a specific user should be created in your resource server and it will be necessary for you to provide the url (= token url), client_id, client_secret, username, and password of the client, at the moment of creating the webhook.

Create webhook

Create a webhook to subscribe to a specific event. Every time there is an event triggered, you will receive a notification that follows this request. For example, if you subscribe to loan_steps event, you will get a notification for any loan status change.

Request Body schema: application/json
client
required
string
Enum: "callback" "email"
Example: "callback"

The type of client (i.e. the type of notification to the Event under subscription)

event
required
string
Value: "loan_steps"
Example: "loan_steps"

The name of the Event under subscription

target
required
string
Example: "https://www.your_web_url.com/endpoint"

The url endpoint or email address to send the notification to

Responses

Request samples

Content type
application/json
Example
{}

Response samples

Content type
application/json
No sample

Get webhooks

Get the list of webhooks you are currently subscribed to (associated to the credentials through the access token from the header).

Responses

Response samples

Content type
application/json
{
  • "status": "ok",
  • "data": [
    ]
}

Get webhook by id

Get webhook by id (webhookId).

Responses

Response samples

Content type
application/json
{
  • "status": "ok",
  • "payload": [
    ],
  • "identifier": "urn:nemuru:sync_and_integration:webhook:408f340c-0f40-4e79-92e9-6af717d4d936"
}

Update webhook by id

Update a webhook by id (specified within the query parameters id).

Request Body schema: application/json
client
required
string
Enum: "callback" "email"
Example: "callback"

The type of client (i.e. the type of notification to the Event under subscription)

event
required
string
Value: "loan_steps"
Example: "loan_steps"

The name of the Event under subscription

target
required
string
Example: "https://www.your_web_url.com/endpoint"

The url endpoint or email address to send the notification to

Responses

Request samples

Content type
application/json
{}

Response samples

Content type
application/json
{ }

Delete webhook by id

Delete a webhook by id (webhookId).

Responses

Response samples

Content type
application/json
{ }

Documentation

Upload files

Upload files for a specific loan (through the loanId in the query parameters).

Files must be encoded in base64 and included in the request via the data field. It is possible to upload more than one file per request, but the maximum size of the request must not exceed 20 megabytes. If not possible, consider sending multiple requests, or contact us.

Request Body schema: application/json
required
Array of objects

The list of Files

Array
name
required
string
Example: "dni-front-borrower.jpeg"

The File name

type
required
string
Enum: "document_id_front" "document_id_back" "driving_permit" "vehicle_inspection_document" "carfax" "payroll" "other"
Example: "document_id_front"

The File type

data
required
string
Example: "aGVsbG8gd29ybGQh"

The File data (encoded in base64)

Responses

Request samples

Content type
application/json
{
  • "files": [
    ]
}

Response samples

Content type
application/json
{ }

Get files

Get the list of all files associated to a specific loan (through the loanId in the query parameters).

Responses

Response samples

Content type
application/json
{
  • "status": "ok",
  • "data": [
    ]
}