[PYTHON] Unity IAP implementation method summary

Introduction

For those who have decided to implement billing processing using Unity IAP From the state where you do not understand the mechanism of billing processing, understand the mechanism of billing processing and leave the procedure from implementation to implementation.

Procedure to implementation

  1. First, understand how Unity IAP works
  2. Use, extend and implement the Purchaser.cs script implemented for the demo

What you can do through this article

--Implementation of billing process in local environment using Unity IAP --Receipt verification on client terminal using Unity IAP --Introduction overview of receipt verification on server (Python)

1. Follow the steps in the official documentation

Unity-Manual: Unity IAP Setup IAP test items are skipped if a test account has already been created

2. Read the cross-platform chapter of the official documentation

Unity-Manual: Unity IAP Cross-Platform

Here is a summary of what you need to know in order to implement billing processing.

(* If there are multiple billing items, you need to create your own script to recognize multiple items)

3. Read the receipt verification chapter of the official documentation

Read it because it is essential knowledge to verify the receipt information on the server side. Unity-Manual: Unity IAP Purchase Receipt

4. Implement by referring to the materials of Unite2016 Tokyo

How to use Unity IAP --SlideShare Unite2016TokyoWS01 - Github Very helpful for implementing Purchaser.cs in this Github repository Now, based on the knowledge gained in 1 and 2, read the source code ** carefully **.

5. Receipt verification on the server

[Android] Perform receipt verification on the server side with Android item billing Signature verification of Google Play billing receipt with Golang For json in the purchase receipt of Unity IAP on Android The two keys, json and signature, are the receipt data sent from Google Play. Verification of public key and signature defined in Google Developer Console = Verification of receipt.

In Python I used M2Crypto.

[IOS] POST to the following URL with receipt-data as the key and receipt data (the value that can be obtained with the payload key for Unity IAP) as the value. https://buy.itunes.apple.com/verifyReceipt If the response is 21007, send it to the sandbox URL again for verification https://sandbox.itunes.apple.com/verifyReceipt

In Python I used ʻurllib2`.

References

What I thought about using Unity IAP

We would like to take this opportunity to thank all the people involved in the Unity2016Tokyo conference.

Recommended Posts

Unity IAP implementation method summary
Gradient method implementation 1
Stackful coroutine implementation summary
Summary of test method
7-line interpreter implementation summary
Kaggle Kernel Method Summary [Image]
Ensemble learning summary! !! (With implementation)
Random forest (implementation / parameter summary)
[Recommendation] Summary of advantages and disadvantages of content-based and collaborative filtering / implementation method
[Linux] [C / C ++] backtrace acquisition method summary
Summary of basic implementation by PyTorch
Einsum implementation of value iterative method
1D-CNN, 2D-CNN scratch implementation summary by Pytorch
Anomaly detection introduction and method summary