Processing AppStore auto renewable subscriptions in PHP

in-app-purchases

First all be aware of Apple's policy as for auto renewable subscription and application types that could use it (your app could be rejected if reviewers will decide you that you are missusing subscriptions).

11.15 Apps may only use auto renewing subscriptions for periodicals (newspapers, magazines), business Apps (enterprise, productivity, professional creative, cloud storage) and media Apps (video, audio, voice), or the App will be rejected

Auto renewable subscriptions flow

Basically it works as all AppStore in-app purchases - iOS makes purchase on client side, receives Receipt and gives it server for validation. An issue appears when you need to renew subscription - unfortunately there is no something like IPN in PayPal and AppStore does not "push inform" us about prolongation or cancellation of subscription (as PayPal do). We need to do it ourselves.

As for auto-renew subscriptions we should make such steps:

  • Take initial receipt, validate it on server side (what should be validated except Apple response - is a topic for another big post)
  • Store initial receipt in DB (assign to user internally and save renew date)
  • CRON job should make periodic check of records by renew date (frequency depends on your logic, but once in 1-6 hours could be fine)
  • If it is time to check some subscription - take previously saved Receipt and make a validate request to Apple server as usually
  • If subscription was continued and money booked from user - you will receive response with new Receipt (and old one also), if not renewed - you will receive "Expired" response.
  • If subscription was continued and success response received - save it to DB, and use in next subscription validation round
  • If not - process your app logic on expired subscription (close some services for this user or something)

Read more ...

How to install Elance Tracker in latest Ubuntu 14.04 (Linux Mint 17)

Elance Tracker

Elance Tracker app uses Adobe Air and as Adobe has stopped Air support for Linux (the latest supported version is 2.6) - it became problematic to run Air apps on Linux.
You can find a lot of manual allover the Web how to solve different issues and install Air on Linux (like linking libgnome-keyring.so etc.), but with Ubuntu each new version brings less compatibility.
On Ubuntu 13.10 for a long time I was not able to install Adobe Air in any way. Only one manual from tkalin.com helped me to figure it out.

My previous manual using Wine was not correct. Sorry for that, with Wine you can install and run Tracker, but time and screenshots are not being tracked. So it is useless.

  • Here is one quick script. Save it as install_adobe_air.sh
#!/bin/bash
apt-get install libgtk2.0-0:i386 libstdc++6:i386 libnss3-1d:i386 lib32nss-mdns libxml2:i386 libxslt1.1:i386 libcanberra-gtk-module:i386 gtk2-engines-murrine:i386
cd /tmp
apt-get download libgnome-keyring0:i386
dpkg-deb -R libgnome-keyring0_3.8.0-2_i386.deb gnome-keyring
cp gnome-keyring/usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/i386-linux-gnu/
ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/i386-linux-gnu/libgnome-keyring.so.0
ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0 /usr/lib/libgnome-keyring.so.0
ln -s /usr/lib/i386-linux-gnu/libgnome-keyring.so.0.2.0 /usr/lib/libgnome-keyring.so.0.2.0
wget http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRInstaller.bin
chmod a+x AdobeAIRInstaller.bin
./AdobeAIRInstaller.bin
rm ./AdobeAIRInstaller.bin
rm /usr/lib/libgnome-keyring.so.0
rm /usr/lib/libgnome-keyring.so.0.2.0
  • Make it executable sudo chmod a+x install_adobe_air.sh
  • And run sudo ./install_adobe_air.sh (during running Abode Air wizard will appera, you should go through it)
  • Then download Elance Tracker for Linux as usual and install it in normal way

Read more ...

Fix MariaDB install issue "libmysqlclient18 which has multiple installed instances" on Ubuntu

I have faced this issues couple times on different Ubuntu versions while trying to install MariaDB (fully compatible MySQL replacement DB)

dpkg: error processing /var/cache/apt/archives/libmysqlclient18_5.5.33a+maria-1~raring_amd64.deb (--unpack):
 libmysqlclient18:amd64 5.5.33a+maria-1~raring (Multi-Arch: no) is not co-installable with libmysqlclient18 which has multiple installed instances

as I understand "old" version of libmysqlclient18 is already installed and for some reason system can't resolve what to do with current lib as some other soft depends on it.

Fix

Open /var/lib/dpkg/status search for a line with Package: libmysqlclient18 and remove block of text till lines "Original-Maintainer: ..." this text block could appear couple times there, remove all appearances. after that run apt-get -f install

Such "hack" helped with some other libs also, whenyou are sure that you have installed correct version of library or you have a PPA with needed version, but apt-get does not see it. Try do the same manual cache clean for this lib.


Upgrade Linux Mint 15 to Linux Mint 16

Linux Mint 16

Try LiveCD before update

Before making an update to new version it could be a good approach to download an ISO, to make a LiveCD and try that new distribution works in LiveCD mode well on your hardware.

If you already have installed Linux Mint 15 and want just to update your current installation to latest version do the following (but always backup any critical data even before proven update operations).

Replace distro codename in sources.list files raring => saucy and olivia => petra

$ sudo sed -i 's/raring/saucy/' /etc/apt/sources.list
$ sudo sed -i 's/olivia/petra/' /etc/apt/sources.list
$ sudo sed -i 's/raring/saucy/' /etc/apt/sources.list.d/official-package-repositories.list
$ sudo sed -i 's/olivia/petra/' /etc/apt/sources.list.d/official-package-repositories.list

These are 2 required files, but if you had installed some PPA or repos review them manually in /etc/apt/sources.list.d folder and do the same.

Then run update

$ sudo apt-get update && sudo apt-get dist-upgrade
$ sudo apt-get upgrade

Read more ...

Ubuntu - I'll be back, but meanwhile hello Linux Mint !

Ubuntu Mint Cinnamon

I am not Unity hater at all and really like the main idea and general look&feel of latest Ubuntu interface, I don't even care about these "privacy" flame around their "smart scopes".
Hey, I even use Ubuntu font in this blog :)

But the problems are in tiny aspects of usability (speaking about Ubuntu 13.10).


Read more ...
Ievgen
Kuzminov "iJackUA"
Web Team Lead
at MobiDev (Kharkiv, Ukraine)
Code in Ruby and Elixir, but still love PHP. Explore ES6 and Vue.js. Explore databases, use Ubuntu and MacOS, think about IT people and management

Notes


Animista - is a place where you can play with a collection of ready to use CSS animations, tweak them and download only those you will actually use.



Staticman - handles user-generated content for you and transforms it into data files that sit in your GitHub repository, along with the rest of your content.