After a negotiation session finishes, you will be notified by the Nibble Widget nibble-session-end event. In the case of successful negotiations, you can call this API function from a secure server to verify the session details.

HTTP Request

GET https://api.nibble.website/v1/session/nibbleId
Headers:
    X-Api-Key: XXX-XXX
    X-Nibble-Api-Secret: XXXX
    Content-Type: application/json

Header Fields

FieldRequired?Description
X-Api-KeyYesYour API Key, as provided to you by Nibble.
X-Nibble-Api-SecretYesYour API Secret, as provided to you by Nibble.
Content-TypeYesMust be application/json.

Request Path

PathRequired?DescriptionBody
nibbleIdYesReplace with the Nibble ID as provided to the nibble-session-end event. For example, if the sessionId given was AB1934, the request path should be /session/AB1934.None

HTTP Response

HTTP CodeDescription
200The session was created successfully. Response body will be a JSON object that should be passed to the Nibble Widget via your successCallback. See below for JSON content.
400Bad Request. Nibble ID is missing or invalid. Request body will be a JSON object including an error message to help you identify the issue: { "errorMessage": "sessionId must be specified" }
401Unauthorized. The API Key and/or Secret are missing, invalid or expired. Request body will be a JSON object including an error message to help you identify the issue: { "errorMessage": "API Secret is not valid." }
404Not Found. The requested session cannot be found. Tampering may have occurred, or the session may have long since expired. Treat this as an unsuccessful negotiation. Request body will be a JSON object including an error message to help you identify the issue:

JSON Body

{
  "nibbleId": "AB1934",
  "sessionStatus": "successful",
  "productId": "ABCD",
  "variantId": "DEF123",
  "negotiatedPrice": "130.50",
  "retailerSessionId": "XXXX",
  "quantity": 2,
  "additionalProducts": [
    "productId": "ZYXW",
    "negotiatedPrice": "20.00"
  ],
  "nextAction": "checkout"
}
FieldDescriptionNotes
nibbleIdThe Nibble ID, as passed to this API function.
sessionStatusThe status of the negotiation session, either opensuccessful or failed. Only successful negotiations should result in the product being added to basket. You must verify that the status is successful in such cases.
productIdThe ID of the product, as provided to the Nibble Cloud API at time of session creation. You must verify that this matches the product in question, in order to determine that the session has not been hijacked or replayed.
subProductIdThe ID of the variant, colourway or sub-product, as provided to the Nibble Cloud API at time of session creation (if it was provided).If specified
negotiatedPriceThe final negotiated total price, as agreed between Nibble and the user. You should add the product to the user’s basket at this price.Only appears for successful sessions
retailerSessionIdYour Retailer Session ID, as provided to the Nibble Cloud API at time of session creation. You must verify that this matches the user’s session.
quantityThe final negotiated quantity of items agreed on between Nibble and the user. You should set the number of units for the product in the user’s basket equal to this quantity.Only appears for successful sessions
additionalProductsIf Nibble has been configured to offer addon items during a negotiation (for example, free gifts as ‘sweeteners’ or bundle items), and if the user chooses to add one or more of those products, they will be specified here. They should be added to the basket alongside the main product in question, at the price specified in negotiatedPrice.
nextActionThe next action the user requested - either 'continue_shopping' or 'checkout'.
payloadThe cryptographically signed payload of the Nibble’s details.