iOS/Android課金実装

iOS
Verify Receipt
- Receive Payload from the Frontend (FE):
- Upon successful completion of a transaction on the mobile app, send a payload containing the transaction details (including the transactionId and other details like the product identifier, quantity, etc.) to server (BE).
- Invoke the App Store API:
- Using the transactionId from the payload you received, make a call to the App Store's API to retrieve the TransactionInfo.
- https://developer.apple.com/documentation/appstoreserverapi/get_transaction_info
- Compare the Data:
- Once receive data from the App Store, compare the information from TransactionInfo with the payload sent by the FE. Ensure that all details such as product identifier, quantity, etc. match.
- Confirm or Reject the Transaction:
- If all the details match, validate the transaction and update the status in database.
If there are any discrepancies, reject the transaction and send an appropriate response back to the mobile app.
- If all the details match, validate the transaction and update the status in database.
Necessary stuffs to call App store api
- in-app purchase key
- For generate key file and download it
- https://developer.apple.com/documentation/appstoreserverapi/creating_api_keys_to_use_with_the_app_store_server_api
- KeyID
- private key ID from App Store Connect (Ex: 2X9R4HXF34)
- BundleID
- app's bundle ID
- IssuerID
- issuer ID from the Keys page in App Store Connect (Ex: "57246542-96fe-1a63-e053-0824d011072a")
App Store Server Notifications
Details
Upgrade / Downgrade
Upgrade
ユーザが現在登録しているサブスクリプションより、高いレベルのサブスクリプションに切り替える場合。切り替える前の低いレベルのサブスクリプションから比例配分された金額が、元の支払い方法で返金されます。その後、高いレベルのサブスクリプションに対する料金が請求され、当該サブスクリプションが直ちに適用されます。アップグレードを行なった日付が、新しいレベルのサブスクリプションの更新日となります。
Downgrade
ユーザが現在登録しているサブスクリプションより、低いレベルのサブスクリプションに切り替える場合。低いレベルのサブスクリプションに対する料金は、次回更新日に請求されます。
Crossgrade
ユーザが現在登録しているサブスクリプションと、同じレベルのサブスクリプションに切り替える場合。サブスクリプションの期間が異なる場合、クロスグレードは次回更新日から適用されます。サブスクリプションの期間が同じ場合、切り替える前のサブスクリプションから比例配分された金額が、元の支払い方法で返金されます。その後、新しいサブスクリプションに対する料金が請求され、当該サブスクリプションが直ちに適用されます。クロスグレードを行なった日付が、新しいレベルのサブスクリプションの更新日となります。
Promote subscription on App store
Can do it from here.
To promote this subscription on the App Store, add a 1024 x 1024 pixel promotional image below. It'll appear on your app's product page and when a customer redeems an offer code. Promotional images may also appear in search results or be featured by the editorial team. You can promote up to 20 in-app purchases at a time. Make sure your app supports the required StoreKit APIs. Learn More
Library for Golang

Android
Overview
Details
Verify receipt
- Call this api
Google Realtime Developer Notifications
How to call Google Play Developer API
play services api key is necessary to call api.
this oauth secret might not be necessary?
Library for Golang

Reference