記錄一下App自動串接流程
Apple In-App流程
驗證的狀態碼
Status Code
|
Description
|
---|---|
21000
|
The App Store could not read the JSON object you provided.
|
21002
|
The data in the
receipt-data property was malformed or missing. |
21003
|
The receipt could not be authenticated.
|
21004
|
The shared secret you provided does not match the shared secret on file for your account.
|
21005 |
The receipt server is not currently available.
|
21006
|
This receipt is valid but the subscription has expired. When this status code is returned to your server, the receipt data is also decoded and returned as part of the response.
Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions.
|
21007
|
This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead.
|
21008
|
This receipt is from the production environment, but it was sent to the test environment for verification. Send it to the production environment instead.
|
21010
|
This receipt could not be authorized. Treat this the same as if a purchase was never made.
|
21100-21199
|
Internal data access error.
|
Apple自動訂閱通知
可以自訂api讓apple傳送自動訂閱資訊
Google In-APP流程
申請服務帳號
在Google Play Console的 API 存取權,新增一個服務帳戶,並指定財經的角色權限
https://codeday.me/bug/20180810/215717.html
https://codeday.me/bug/20180810/215717.html
OAuth驗證
Receipt驗證API
https://www.googleapis.com/androidpublisher/v3/applications/{{GOOGLE_PUBLISHER_PACKAGE_NAME}}/purchases/subscriptions/{{GOOGLE_PUBLISHER_SUB_ID}}/token
s/{{GOOGLE_PUBLISHER_TOKEN}}
GOOGLE_PUBLISHER_PACKAGE_NAME
GOOGLE_PUBLISHER_SUB_ID
GOOGLE_PUBLISHER_TOKEN
Receipt訂閱資訊
{"packageName":"com.rex.billingtest","acknowledged":false,"orderId":"transactionId.android.test.purchased","productId":"android.test.purchased","developerPayload":"","purchaseTime":0,"purchaseState":0,"purchaseToken":"inapp:com.rex.billingtest:android.test.purchased"}
{"orderId":"GPA.3380-9023-5860-65305","packageName":"com.cupola.cupola360","productId":"sub_month_01","purchaseTime":1562753803599,"purchaseState":0,"purchaseToken":"opbbhlabpbpjdeombpgnadel.AO-J1OzUpM2j8a3jxX5DjbjfI0_Z6iAfKs7kWuC5Ssq24UI5pEPflxurbEdlRK_bWgr5fKnFDyVCqmCGThyRR-fSSsqcT-sJrWSMzVcGavjHmh3to2mO5hIkj-WKqSFqdAYLJmhKGANg","autoRenewing":true}
參考資料
https://cg2010studio.com/2018/05/24/ios-iap-%E9%A9%97%E8%AD%89%E7%99%BC%E7%A5%A8-iap-verify-receipt/
https://www.cnblogs.com/shycie/p/5499186.html
https://alexdisler.com/2016/03/20/validating-cordova-in-app-purchases-on-ios-and-android-using-nodejs/
https://www.appcoda.com.tw/in-app-purchase-tutorial/
https://cheesecakelabs.com/blog/google-play-iap-first-setup-test-sandbox/
https://codeday.me/bug/20180810/215717.html
官方Apple
https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html
https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html
https://developer.apple.com/documentation/storekit/in-app_purchase/enabling_status_update_notifications
https://help.apple.com/app-store-connect/#/dev0067a330b
官方GooglePlay
https://developer.android.com/google/play/billing/billing_overview.html
https://github.com/googleapis/google-api-nodejs-client#service-to-service-authentication
https://alexdisler.com/2016/03/20/validating-cordova-in-app-purchases-on-ios-and-android-using-nodejs/
沒有留言:
張貼留言
留個話吧:)