HomeGuidesAPI Reference
Log In

Order History SDK Embedded

Getting your SDK Key


To get an API key, book a meeting with us and sign the license agreement. Book a meeting by visiting here.

Example images

Required parameters: name and userId

Your name is passed with the api query parameter. This will be the name of your company. The userId is the userId that is used when creating the order.

For example:

https://sdk.mealme.ai/order-history?api=YOUR_NAME&userId=xxxxx

Example embed:

<iframe 
	src="<https://sdk.mealme.ai/order-history?api=YOUR_NAME&userId=xxxxx>" 
	allow="geolocation; payment" 
	title="Mealme Web SDK" 
	style="border: none;height: 100vh;margin-bottom: 0px;position: relative;z-index: 100;margin-top: 40px;width: 100%;">
</iframe>

Example card for sandbox orders

Example card that works for the sandbox checkout: 4242 4242 4242 4242, date: 11/24, csv: 123

Optional parameters

  • startDate- If passed, only orders after this will be returned. The format is MM/DD/YYYY, for example startDate=12/21/2023
  • endDate - If passed, only orders before this will be returned. The format is MM/DD/YYYY, for example endDate=12/22/2023

Capturing events

We fire events that you can catch if you want to read the data.

The events fired from menu-search checkout are the following:

  • Checkout success
  • Checkout failure

If you want to capture events while having the SDK in an App, please follow these instructions, instead of the web examples given below.

Success event

Code to capture success event

window.onmessage = (event) => {
  if (event.data.id === "mealme-checkout-success") {
    // Your code using event.data
  }
}; 

Example data for success event:

{
  success: true,
  orderId: "123",
  items: [
    {
      product_id: "gAAA",
      item_name: "NESCAFÉ Dark Roast Instant Coffee",
      image: "https://cdn-img.mealme.ai/...",
      description: "",
      category: "Coffee",
      price: 1299,
      formatted_price: "$12.99",
      upc_codes: [],
      unit_size: 10.5,
      unit_of_measurement: "oz",
      should_fetch_customizations: true,
    },
    {
      product_id: "gAAAA",
      item_name: "Lactaid Whole Milk",
      image: "https://cdn-img.mealme.ai/...",
      description: "",
      category: "Milk",
      price: 579,
      formatted_price: "$5.79",
      upc_codes: [],
      unit_size: 0.5,
      unit_of_measurement: "gal",
      should_fetch_customizations: true,
    },
  ],
  trackingLink: "https://tracking.mealme.ai/tracking?tracking_id=123",
};

Fail event

Code to capture fail event

window.onmessage = (event) => {
  if (event.data.id === "mealme-checkout-fail") {
    // Your code using event.data
  }
}; 

Example data for success event:

{
  success: false,
  message: "Something went wrong",
}