The Order API is used for handling an order after the customer has completed the purchase and the order is confirmed. It is used for all actions you need to manage your orders. Examples being: capturing, reading and refunding an order.
Any capture (shipment) or refund must refer to one or more lines of the cart through their identifiers (item IDs). For this reason, it is necessary to first obtain the order information and retrieve the item IDs from the cart. Check the Order section for more information on how to read the order details.
On another note, bear in mind that not all lenders process captures or refunds in real time. For this reason, you will request a capture or refund and you will receive a server-side callback once the action is processed and confirmed by the corresponding lender. For more information, check the Capture and Refund section on this document.
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:
400 Bad Request
{
"status": "ko",
"exception": "Nemuru\\SharedKernel\\Domain\\Exception\\SchemaValidatorException",
"error": "Schema validation failed",
"schema_errors": {
"/product": "The product you selected is not a valid. Possible choices: {'split_pay', 'instalments'}.",
"/merchant/notification_auth": "The required properties (content_type) are missing",
"/customer/birth_date": "The data must match the 'date-time-atom' format",
"/customer/logged_in": "The data (string) must match the type: boolean",
"/cart": "The required properties (currency) are missing"
}
}
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. |
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
- Payload
{- "username": "username@email.com",
- "password": "12345"
}
Response samples
- 200
{- "token_type": "Bearer",
- "access_token": "1857fdb2-c746-44f9-88a8-507a855fe920",
- "refresh_token": "f9131f93-5e64-461e-8493-0fb8cb76f31d",
- "expires_in": 2678400
}
Create order
Create order. If successful, within the response headers you'll find the order_id
(key Id
), needed in other requests / widgets.
header Parameters
Authorization required | string Example: Bearer 1857fdb2-c746-44f9-88a8-507a855fe920 The Authorization header must include |
Request Body schema: application/json
Order object
product required | string Enum: "split_pay" "instalments" Example: "instalments" Financial product. Allowed values for this field will depend on the commercial agreement; please contact us when in doubt. |
period | integer Example: 3 Optional Loan's period in months. If informed, this value will be presented to the customer as the default period in the Checkout widget. If not informed, the default period will be the largest period available for the selected product, thus minimizing the monthly payment. In any case, the customer will be able to change the period in the Checkout widget. Allowed values for this field will depend on the commercial agreement; please contact us when in doubt. |
purchase_country | string Enum: "ESP" "FRA" Example: "ESP" Optional purchase country of the customer. If not informed, the default value will be the default merchant's purchase country. |
client_id | string Example: "26241e4c-d179-484f-8a43-bf827423df32" Optional |
required | object (Merchant) Merchant information |
required | object (Customer) Customer information |
object (Shipping) Shipping information | |
object (Billing) Billing information | |
required | object (ProductArticleRequest) Product cart information |
Responses
Request samples
- Payload
{- "product": "instalments",
- "merchant": {
- "order_reference_1": "7QuHQ5WVQQqyWVPW",
- "order_reference_2": "14-922-1039",
- "store_reference": "Store BCN - Av. Diagonal",
- "seller_reference": "Seller 1",
- "notification_auth": {
- "authorization_header": "Basic bG9sOnNlY3VyZQ==",
- "content_type": "application/json"
}, - "notification_additional_payload": {
- "cart": "h12837hg"
}, - "max_interval_in_minutes_for_confirm": 1440,
- "max_interval_in_minutes_for_capture": 15
}, - "customer": {
- "first_name": "Alba",
- "last_name": "Martinez Laguna",
- "title": "ms",
- "email": "alba.martinez@gmail.com",
- "phone_number": "+34659723349",
- "document_number": "55593310X",
- "document_expiration_date": "2024-02-27T12:00:00+01:00",
- "birth_date": "1982-11-03T12:00:00+01:00",
- "nationality": "ESP",
- "logged_in": false,
- "locale": "es-ES",
- "ip_address": "192.0.2.146",
- "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
}, - "shipping": {
- "name": "SEUR24",
- "method": "home",
- "first_name": "Alba",
- "last_name": "Martinez",
- "company": "EL DON TRESILLO CATALAN SL",
- "email": "alba.martinez@gmail.com",
- "phone_number": "+34659723349",
- "address": {
- "street_address": "Pl. de Pau Vila, 1",
- "street_address_2": "Planta 1A",
- "postal_code": "08003",
- "city": "Barcelona",
- "country": "ESP"
}
}, - "billing": {
- "first_name": "Alba",
- "last_name": "Martinez",
- "company": "EL DON TRESILLO CATALAN SL",
- "corporate_id_number": "A35628221",
- "email": "alba.martinez@gmail.com",
- "phone_number": "+34659723349",
- "address": {
- "street_address": "Pl. de Pau Vila, 1",
- "street_address_2": "Planta 1A",
- "postal_code": "08003",
- "city": "Barcelona",
- "country": "ESP"
}
}, - "cart": {
- "reference": "76t7y7sau8y398y",
- "total_price_with_tax": 875,
- "currency": "EUR",
- "items": [
- {
- "article": {
- "name": "KIVIK 3-seat sofa",
- "type": "product",
- "category": "physical",
- "reference": "4912345678904",
- "unit_price_with_tax": 875,
- "description": "3-seat sofa, with chaise longue/Hillared anthracite",
- "brand": "the-ikea-brand",
- "mpn": "AD6654412-334.22",
}, - "units": 1,
- "total_discount": 0,
- "total_price_with_tax": 875,
- "auto_shipping": true
}
]
}
}
Confirm or put on hold
Confirm or put on hold the Order
path Parameters
order_id required | string <uuid> Example: d0f39699-fd10-4da2-a622-be6714dadaf9 Order ID |
header Parameters
Authorization required | string Example: Bearer 1857fdb2-c746-44f9-88a8-507a855fe920 The Authorization header must include |
Request Body schema: application/json
Order object
status required | string Enum: "confirmed" "on_hold" Example: "confirmed"
|
product required | string Enum: "split_pay" "instalments" Example: "instalments" Financial product. Allowed values for this field will depend on the commercial agreement; please contact us when in doubt. |
required | object (Merchant) Merchant information |
required | object (Customer) Customer information |
object (Shipping) Shipping information | |
object (Billing) Billing information | |
required | object (ProductArticleRequest) Product cart information |
Responses
Request samples
- Payload
{- "status": "confirmed",
- "product": "instalments",
- "merchant": {
- "order_reference_1": "7QuHQ5WVQQqyWVPW",
- "order_reference_2": "14-922-1039",
- "notification_auth": {
- "authorization_header": "Basic bG9sOnNlY3VyZQ==",
- "content_type": "application/json"
}, - "notification_additional_payload": {
- "cart": "h12837hg"
}, - "max_interval_in_minutes_for_confirm": 1440,
- "max_interval_in_minutes_for_capture": 15
}, - "customer": {
- "first_name": "Alba",
- "last_name": "Martinez Laguna",
- "title": "ms",
- "email": "alba.martinez@gmail.com",
- "phone_number": "+34659723349",
- "document_number": "55593310X",
- "document_expiration_date": "2024-02-27T12:00:00+01:00",
- "birth_date": "1982-11-03T12:00:00+01:00",
- "nationality": "ESP",
- "logged_in": false,
- "locale": "es-ES",
- "ip_address": "192.0.2.146",
- "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
}, - "shipping": {
- "name": "SEUR24",
- "method": "home",
- "first_name": "Alba",
- "last_name": "Martinez",
- "company": "EL DON TRESILLO CATALAN SL",
- "email": "alba.martinez@gmail.com",
- "phone_number": "+34659723349",
- "address": {
- "street_address": "Pl. de Pau Vila, 1",
- "street_address_2": "Planta 1A",
- "postal_code": "08003",
- "city": "Barcelona",
- "country": "ESP"
}
}, - "billing": {
- "first_name": "Alba",
- "last_name": "Martinez",
- "company": "EL DON TRESILLO CATALAN SL",
- "corporate_id_number": "A35628221",
- "email": "alba.martinez@gmail.com",
- "phone_number": "+34659723349",
- "address": {
- "street_address": "Pl. de Pau Vila, 1",
- "street_address_2": "Planta 1A",
- "postal_code": "08003",
- "city": "Barcelona",
- "country": "ESP"
}
}, - "cart": {
- "reference": "76t7y7sau8y398y",
- "total_price_with_tax": 790.49,
- "currency": "EUR",
- "items": [
- {
- "article": {
- "name": "KIVIK 3-seat sofa",
- "type": "product",
- "category": "physical",
- "reference": "4912345678904",
- "unit_price_with_tax": 875,
- "description": "3-seat sofa, with chaise longue/Hillared anthracite",
- "brand": "the-ikea-brand",
- "mpn": "AD6654412-334.22",
}, - "units": 1,
- "total_discount": 0,
- "total_price_with_tax": 875,
- "auto_shipping": true
}, - {
- "article": {
- "name": "SEUR24",
- "type": "product",
- "category": "shipping_fee",
- "reference": "4912341239122",
- "unit_price_with_tax": 2.99
}, - "units": 1,
- "total_price_with_tax": 2.99,
- "auto_shipping": true
}, - {
- "article": {
- "name": "Voucher code 10% off",
- "type": "product",
- "category": "discount",
- "reference": "4912345217116",
- "unit_price_with_tax": -87.5
}, - "units": 1,
- "total_price_with_tax": -87.5,
- "auto_shipping": true
}
]
}
}
Get order details
Get order details by order_id
.
path Parameters
order_id required | string <uuid> Example: d0f39699-fd10-4da2-a622-be6714dadaf9 Order ID |
header Parameters
Authorization required | string Example: Bearer 1857fdb2-c746-44f9-88a8-507a855fe920 The Authorization header must include |
Responses
Response samples
- 200
{- "status": "ok",
- "payload": {
- "id": "d0f39699-fd10-4da2-a622-be6714dadaf9",
- "created_at": "2022-08-29T21:38:47+00:00",
- "updated_at": "2022-08-29T21:39:51+00:00",
- "status": "captured",
- "total_order_amount": 875,
- "total_captured_amount": 700,
- "total_refunded_amount": 620,
- "currency": "EUR",
- "conditions": {
- "product": "instalments",
- "term": 12,
- "principal_amount": 875,
- "annual_interest": 0,
- "setup_fee_type": "type_fixed_amount",
- "setup_fee_amount": 132,
- "grace_period": 0,
- "apr": 0.371,
- "downpayment_amount": 72.92,
- "downpayment_fee_amount": 11,
- "downpayment_total_amount": 83.92,
- "instalment_amount": 72.92,
- "instalment_fee_amount": 11,
- "instalment_total_amount": 83.92,
- "total_interest_amount": 0,
- "total_fee_amount": 132,
- "total_amount": 1007,
- "lender": "sequra"
}, - "order": {
- "id": "788e7599-5102-4f6c-9b96-fea016b1cd7f",
- "status": "confirmed",
- "reference": "27e8d67b-e2d0-4e71-8683-8ed10cc5b4f4",
- "merchant_order_reference1": "30747156-351b-40c0-9b19-54734f9ff0e1",
- "merchant_order_reference2": "14-922-1039",
- "total_price_with_tax": 875,
- "items": [
- {
- "id": "3ebdbe8f-1060-4ded-8090-44d1bd116d51",
- "total_discount": 0,
- "total_price_with_tax": 500,
- "units": 1,
- "article": {
- "type": "product",
- "name": "KIVIK 3-seat sofa",
- "category": "physical",
- "reference": "4912345678904",
- "description": "3-seat sofa, with chaise longue/Hillared anthracite",
- "brand": "the-ikea-brand",
- "mpn": "AD6654412-334.22",
- "unit_price_with_tax": 500
}
}, - {
- "id": "cd7f9a46-3f49-434b-b9f0-7ae83f186980",
- "total_discount": 0,
- "total_price_with_tax": 200,
- "units": 1,
- "article": {
- "type": "product",
- "name": "EKEDALEN / EKEDALEN Bar table and 4 bar stools",
- "category": "physical",
- "reference": "5930423178914",
- "description": "Bar table and 4 bar stools, white/Ramna light grey120 cm",
- "url": null,
- "brand": null,
- "mpn": null,
- "image_url": null,
- "unit_price_with_tax": 200
}
}, - {
- "id": "dac7e320-6100-465f-91b7-8db2d9070ec9",
- "total_discount": 0,
- "total_price_with_tax": 180,
- "units": 1,
- "article": {
- "type": "product",
- "name": "Stoense",
- "category": "physical",
- "reference": "4919757867890",
- "description": "Rug, low pile, 200x300 cm",
- "brand": null,
- "mpn": null,
- "image_url": null,
- "unit_price_with_tax": 180
}
}, - {
- "id": "036604a7-e6bd-4125-81ff-5838a357e13c",
- "total_discount": 0,
- "total_price_with_tax": 25,
- "units": 1,
- "article": {
- "type": "product",
- "name": "SEUR24",
- "category": "shipping_fee",
- "reference": "3a257628f13c",
- "url": null,
- "brand": null,
- "mpn": null,
- "image_url": null,
- "unit_price_with_tax": 25
}
}, - {
- "id": "0978b917-cee7-41f7-bd74-89dfba3d9417",
- "total_discount": 0,
- "total_price_with_tax": -30,
- "units": 1,
- "article": {
- "type": "product",
- "name": "Discount voucher HKS12J",
- "category": "discount",
- "reference": "88fd5867f70e",
- "url": null,
- "brand": null,
- "mpn": null,
- "image_url": null,
- "unit_price_with_tax": -30
}
}
]
}, - "captures": [
- {
- "id": "2180668d-1d28-4a50-b5a8-a0db92bd39c7",
- "created_at": "2022-08-29T21:40:36+00:00",
- "updated_at": "2022-08-29T21:40:51+00:00",
- "status": "confirmed",
- "amount": 200,
- "description": null,
- "item_ids": [
- "cd7f9a46-3f49-434b-b9f0-7ae83f186980"
]
}, - {
- "id": "263739ac-520f-4b6e-9134-530562c30293",
- "created_at": "2022-08-29T21:39:57+00:00",
- "updated_at": "2022-08-29T21:40:03+00:00",
- "status": "confirmed",
- "amount": 500,
- "description": "Capture auto-generated by auto shipping",
- "item_ids": [
- "3ebdbe8f-1060-4ded-8090-44d1bd116d51"
]
}
], - "refunds": [
- {
- "id": "7538f937-79f3-4b9b-a8ab-4e2be4fc57fb",
- "created_at": "2022-08-29T21:41:47+00:00",
- "updated_at": "2022-08-29T21:41:54+00:00",
- "status": "confirmed",
- "amount": 120,
- "description": null,
- "item_ids": [ ]
}, - {
- "id": "f853ac33-fc5c-4ec4-9424-5ae16b2d8e45",
- "created_at": "2022-08-29T21:40:17+00:00",
- "updated_at": "2022-08-29T21:40:23+00:00",
- "status": "confirmed",
- "amount": 500,
- "description": null,
- "item_ids": [
- "3ebdbe8f-1060-4ded-8090-44d1bd116d51"
]
}
], - "shipping": {
- "id": "c2db8436-1ec1-4cca-a2ea-030455c902b4",
- "name": "SEUR24",
- "customer": {
- "name": {
- "first": "Alba",
- "last": "Martinez Laguna"
}, - "email": "alba.martinez@gmail.com",
- "phone": "+34659723349"
}, - "address": {
- "street_address": "Pl. de Pau Vila, 1",
- "street_address_2": "Planta 1A",
- "city": "Barcelona",
- "country": "ESP",
- "postal_code": "08003"
}, - "method": "home",
- "business_name": "EL DON TRESILLO CATALAN SL"
}, - "billing": {
- "id": "90707845-125c-4fb6-a343-7f44ec0be59d",
- "customer": {
- "name": {
- "first": "Alba",
- "last": "Martinez Laguna"
}, - "email": "alba.martinez@gmail.com",
- "phone": "+34659723349"
}, - "address": {
- "street_address": "Pl. de Pau Vila, 1",
- "street_address_2": "Planta 1A",
- "city": "Barcelona",
- "country": "ESP",
- "postal_code": "08003"
}, - "business_name": "EL DON TRESILLO CATALAN SL",
- "corporate_id_number": "A35628221"
}
}
}
Capture
Initiate a capture.
Nemuru processes the capture request with the corresponding lender.
Upon completion, Nemuru will notifiy you about the lender confirmation by sending a order_capture_created
notification event (see notification documentation here).
The capture can be optionally accompanied by a description.
Capture by items
Specify which items you wish to capture.
Prior to initiating a capture, call the order details endpoint to get the item ids and include them within the captured_item_ids
key.
Transactional
To avoid asynchronies (awaiting the order_capture_created
notification), you can initiate and process the capture transactionally with the lender by making use of the transactional
field within the request.
path Parameters
order_id required | string <uuid> Example: d0f39699-fd10-4da2-a622-be6714dadaf9 Order ID |
header Parameters
Authorization required | string Example: Bearer 1857fdb2-c746-44f9-88a8-507a855fe920 The Authorization header must include |
Request Body schema: application/json
Capture object
description | string Example: "This is an optional description for this capture" Optional description about the capture |
captured_item_ids required | Array of strings <uuid> Example: ["16d63625-1390-4401-9427-fe5dd1de981c"] List of item IDs to be captured (cart lines) |
transactional | boolean Use this field if you need to avoid any asynchronies. If
|
Responses
Request samples
- Payload
{- "description": "Optional description for transactional capture",
- "captured_item_ids": [
- "16d63625-1390-4401-9427-fe5dd1de981c"
], - "transactional": true
}
Capture full order
Initiate a full order capture, which will capture all the items included within the order.
Nemuru processes the capture request with the corresponding lender.
Upon completion, Nemuru will notifiy you about the lender confirmation by sending a order_capture_created
notification event (see notification documentation here).
The capture can be optionally accompanied by a description.
Transactional
To avoid asynchronies (awaiting the order_capture_created
notification), you can initiate and process the capture transactionally with the lender by making use of the transactional
field within the request.
path Parameters
order_id required | string <uuid> Example: d0f39699-fd10-4da2-a622-be6714dadaf9 Order ID |
header Parameters
Authorization required | string Example: Bearer 1857fdb2-c746-44f9-88a8-507a855fe920 The Authorization header must include |
Request Body schema: application/json
Capture object
description | string Example: "This is an optional description for this capture" Optional description about the capture |
transactional | boolean Use this field if you need to avoid any asynchronies. If
|
Responses
Request samples
- Payload
{- "description": "Optional description for transactional capture",
- "transactional": true
}
Refund
Initiate a refund of a captured order.
Nemuru processes the refund request with the corresponding lender.
Upon completion, Nemuru will notifiy you about the lender confirmation by sending a order_refund_created
notification event (see notification documentation here).
The refund can be optionally accompanied by a description.
Refund by items
Specify which items you wish to refund.
Prior to initiating a refund by items, call the order details endpoint to get the item ids and include them within the refunded_item_ids
key.
Important: the refunded items must have been previously captured.
Refund by amount
If you opt for refunding an amount, instead of specific items in the cart, you can do so by excluding the refunded_item_ids
key and including the refunded_amount
key within the request body, specifying the amount to refund.
Important: the refunded amount must not be higher than the total captured amount.
Transactional
To avoid asynchronies (awaiting the order_refund_created
notification), you can initiate and process the refund transactionally with the lender by making use of the transactional
field within the request.
path Parameters
order_id required | string <uuid> Example: d0f39699-fd10-4da2-a622-be6714dadaf9 Order ID |
header Parameters
Authorization required | string Example: Bearer 1857fdb2-c746-44f9-88a8-507a855fe920 The Authorization header must include |
Request Body schema: application/json
Refund object
description | string Example: "This is an optional description for this refund" Optional description about the refund |
refunded_item_ids required | Array of strings <uuid> Example: ["16d63625-1390-4401-9427-fe5dd1de981c"] List of item IDs to be refunded (cart lines). |
refunded_amount | number Example: 200 Amount to be refunded. You must exclude the |
transactional | boolean Use this field if you need to avoid any asynchronies. If
|
Responses
Request samples
- Payload
{- "description": "Optional description for transactional refund by items",
- "refunded_item_ids": [
- "16d63625-1390-4401-9427-fe5dd1de981c"
], - "transactional": true
}
Notification
Nemuru sends notifications to your notification_url
, specified by you when creating the order,
in order to let your systems know about the following events:
- Order status changes (
order_status_changed
) - Capture confirmed by the lender (
order_capture_created
) - Refund confirmed by the lender (
order_refund_created
)
Request Body schema: application/json
Notification object
order_id | string <uuid> Example: "e60fb9d8-97d4-4653-bc7e-d49b203a6980" The order ID |
order_reference_1 | string Example: "76t7y7sau8y398y" Identifier of the order in your (the merchant) environment. |
event | string Enum: "order_status_changed" "order_capture_created" "order_refund_created" Example: "order_status_changed" Name of the event |
triggered_at | string Example: "2022-06-30T09:42:15+00.00" Timestamp when the event was created (valid 8601 timestamp format) |
status | string Enum: "approved" "on_hold" "confirmed" "denied" "cancelled" "expired" "desisted" Example: "approved" Order status |
Responses
Request samples
- Payload
{- "order_id": "e60fb9d8-97d4-4653-bc7e-d49b203a6980",
- "order_reference_1": "76t7y7sau8y398y",
- "event": "order_status_changed",
- "triggered_at": "2022-06-30T09:42:15+00.00",
- "status": "approved"
}