iZettle for Titanium Appcelerator

Yesterday I was bored and by browsing the web I found iZettle.
So I decided to make a Titanium library for mobile application payments. It wasn’t complicated and I was surprised that no one created this before me (at least I didn’t find anything).

I really like the idea of iZettle. It’s actually a copy of Square for Europe. Unfortunately it doesn’t work in my country, so I was unable do end to end testing. But I am convinced that it will work out of the box because it is very very simple.

Basically what you need is to open iZettle app from your app with parameters like: price, payment title, callback urls. After iZettle processes payment, it will call your app with callback url. So your app only needs to now how to call iZettle app and have some sort of url listener for callback calls from iZettle app.

My library wraps this whole process and does everything for you. You only need to include my library and pass parameters to payment method. And thats it 🙂

Sample usage

Check the example app to see it in action. It is ridiculously simple. You will need a api key from iZettle.

//initialize module
var iZettle = new (require('modules/izettle'))({
	sourceUrl : 'izettlepoc', //your app URL scheme
	apiKey : 'MY_SECRET_DEV_KEY', //your api key from iZettle
	quiet : false, //debuging on=false/off=true
});

//create some button
var pay = Ti.UI.createButton({
	title : 'Pay with iZettle'
});
//do some action...
pay.addEventListener('click', function() {
	//iZettle call application with paym,ent options
	iZettle.payment({
		price : inputPrice.getValue(),
		title : inputDescription.getValue(),
		currency : 'EUR',
		reference : 'REFERENCE_STRING',
		success : function(m) {
			//success callback
			alert('SUCCESS: ' + JSON.stringify(m));
		},
		failure : function(m) {
			//failure callback 🙁
			alert('FAILURE: ' + JSON.stringify(m));
		}
	});
}); 

Demo App

iZettle_demo_app

Repository on github.com

All code is open source and dual licensed under GPL and MIT. Feel free to use it.
If you have any question feel free to ask.

5 thoughts on “iZettle for Titanium Appcelerator

  1. Pingback: This Week in Titanium Mobile Development: 31 Dec 2012 | Titanium Development

  2. .

    Also consider using SumUp’s API for mobile payments. SumUp is basically the Square of continental Europe, being market leader in Germany, Spain, Italy, France and so on and so forth while iZettle is mostly present in the Nordics..

    sumup.com/api

    Reply
    1. Miroslav Magda Post author

      Api looks very similar to api from iZettle. I will definitely create a library for SumUp.
      Thanks for letting me know.

      Reply
  3. Pingback: This Week in Titanium Mobile Development: 31 Dec 2012 | TiDev

Leave a Reply

Your email address will not be published. Required fields are marked *