Knowledgebase/API/The Vend API

Introduction to the Vend API

Vaughan Rowsell
posted this on February 01, 2012 16:52

Does Vend have an API?  Well, Yes!  Yes we do.

Actually two.

We have a server side API and a merchant payment API that you can use to integrate custom payments or loyalty into the Vend POS.

Server side API

The Vend API is implemented as JSON over HTTPS using the verbs GET, PUT, POST and DELETE.  Or more simply, it lets your web developer (or you if you are a web developer) build cool custom stuff for Vend.

You can create, view and modify most objects in Vend, like customers, products, sales and so on.

http://docs.vendhq.com/index.html

Sample code

Merchant Payments API

The Vend payments API allows you to build your own custom payments integrations in the Vend sell screen.  

To do this, create your own custom payment type in the Vend account setup, and under "advanced configuration" you can supply a URL for the hosted payments page.  Vend will load this page when this payment type is selected in a sale.

Screen_Shot_2012-03-07_at_6.12.32_PM.png

Vend will pass information about the sale using the HTML5 postMessage API (see docs below).  You can also update information about the sale using the same API.  

http://docs.vendhq.com/client/payment.html

 

We will be adding to these APIs over time.  We welcome any suggestions on how we can help 3rd parties build add-on software for Vend.  Please let us know your thoughts.

 

Comments

User photo
Kyle Clarke
Vendhq

In Addition...

Although the docs are titled preliminary, the methods listed have been in used in the production environment for sometime now. For example, the Vend sell screen exclusively uses the Vend API to post all sales to the application. We have a new set of API documentation and code in examples in our future work queue to help with your API implementations.

If you already have an active account with Vend (of any sized plan), you already have access to the API - simply use your default Username & Password credentials. Or you can create an API specific user from your setup screen. Don't have an account, https://secure.vendhq.com/signup.

Also note that all API responses are returned as JSON so be sure that for all of your requests, you set the Headers Content-Type to application/json.

 Happy Coding!

February 02, 2012 09:03
User photo
Vincent Cohen

I have a question regarding the API.

I am able to succesfully authenticate and fetch products.

However I need to be able to get products by category, it is not listed in the documentation. Is this even possible? I wonder how this is done with Shopify.

February 04, 2012 01:18
User photo
Vincent Cohen

I wrote a php class for using Vend, I am not very familiar with php's curl. But I thought i'd share it for other developers who have never done things like this.

You can view the code here http://vincentcohen.nl/wordpress/32-using-vendhqs-api/ comments are more then welcome as I am just a beginner.. 

February 04, 2012 03:35
User photo
Bob Brown - Turboweb

By the way something to watch out for - not sure if it's been fixed - is that if the Vend API returns an error response the string isn't valid JSON because it uses single quotes instead of double quotes. In PHP if I can't decode the JSON then I do a $result = str_replace( "'", '"', $result ) and then try decoding it again. Hope this saves someone a bit of time.

March 15, 2012 09:10
User photo
Kyle Clarke
Vendhq

Hi Bob, good spotting! - I have rectified this - thanks

Kyle

March 19, 2012 10:20
User photo
Alaina Driscoll

Hi Vincent-- your link isn't working. I wonder if you could re-post because it sounds like it would be extremely helpful for me. Thanks!

September 12, 2012 01:26
User photo
Paul The Seer

Can I hire someone to link my pdq machine, I am with Elavon and the machine is an Optimum 4220, also how do I link the machine to the pc, I want to use Vend but this is holding me up if I can't link the pdq it seems pointless.

 

thanks

Paul

September 14, 2012 21:06
User photo
Paul The Seer

Actually it looks like it is more complicated as we use one merchant for online and one for offline ... looks like a timely and costly exercise to link it all together.

September 14, 2012 21:26
User photo
Bruce Aldridge
September 15, 2012 21:04
User photo
anna deltsheva

Hi, i'm trying to filter register sales json by customer id, but it's not working for me. Can you give me an example how can i do it?

Thanks

Anna

September 20, 2012 01:04
User photo
Kyle Clarke
Vendhq

Hi Anna, at this stage we don not filter register sales on a customer_id - though I will add to our ticket queue to look at implementing this.

Kyle

September 20, 2012 11:04
User photo
Damian Funnell
Choice Technology

Hi guys, is it possible to retrieve product tags for existing sales via the API?  In the API doc it does not appear that product tags are returned by GET /api/register_sales/#{register_sale_id}?


October 04, 2012 15:19
User photo
Damian Funnell
Choice Technology

Same question for product type chaps.

October 04, 2012 15:21