Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IAP backend best practice

I've just made iOS app with IAP to purchase virtual coins(Consumable). And the backend is Ruby on Rails. I have some concerns for now about the whole solution.

My current IAP process describes as following:

  • STEP 1 - iOS Client sends request to our backend and get product ids.
  • STEP 2 - Client retrieve product list through Store Kit with ids from step1
  • STEP 3 - User click buy and client sends a payment request to Store Kit
  • STEP 4 - When finish transaction the client send the receipt token to our backend
  • STEP 5 - Server verifies the receipt first to make sure it's a valid verification
  • STEP 6 - Server calls App Store to verify the receipt and deal with the exchange(Recharge account in DB)
  • STEP 7 - Client gets the response back and displays account balance

I worked on e-commerce/payment solutions before, and IAP takes the other way, though usually the payment gateway will send the receipt server-to-server for verification. And we always have message queue sort of solutions to make sure all transactions are stable and maintainable.

My questions are:

  1. What's the best practice to verify IAP receipt? How to avoid the interruption of verification from our server? (e.g., User spend money and finish the transaction on the client, but fails when verify the receipt on server. No IAP restore transaction support.)

  2. Apple IAP more likely a perfect client solution. Especially in my case, after user's payment, he wants to receives the coins immediately, and not the case we tell him the transaction is processing and his account will be fulfilled soon. To have responsive UX on mobile device is prioritized. Do you still use message queue stuff on server?

Thanks for your time.

like image 664
chagel Avatar asked Mar 24 '13 06:03

chagel


1 Answers

You might find http://helios.io/ useful. It combines four useful iOS related gems, one of which is https://github.com/mattt/rack-in-app-purchase

like image 89
Alex Ghiculescu Avatar answered Sep 22 '22 10:09

Alex Ghiculescu