I.A.P ios iap in react native - fantasy0107/notes GitHub Wiki
react-native-iap
react-native-in-app-utils 套件
流程文章
測試
為了測試 iap 你必須要在實機上跑. 使用 ios 模擬器會 fail 因為模擬器無法連線到 iTunes Store (apple store connect). 但是你可以做特定的任務像是 loadProducts 不需要用到實機
問題
遺失元資料(miss meta data)
解法
mac 中調整圖片大小
圖片拖到下方預覽程式 -> 上方工具列 - 工具 -> 調整大小
影像不得含有 Alpha 色頻或透明度
預覽程式 -> 上方工具列 - 檔案 -> 輸出 不要勾選 alpha
在審查資料中上傳圖片(有寬高限制)
- iOS requires at least 640 x 920 pixels.
- tvOS requires 1920 x1080 pixels.
- macOS requires 1280 x 800 pixels.
更改完成後產品從 遺失元資料
變成 準備提交
無法取得商品
解法 => apple store connect 中填好銀行帳戶和稅務和聯絡資訊
相關的資料後
當 App Store Connect 中的 協議,稅務與銀行業 底下的 付費應用程式
狀態顯示 啟用(綠燈) 就可以抓到商品了
購買商品
再 device 改變測試帳號
設定 -> itunes and app store -> sandbox 帳號登入
驗證 apple store 的 receipt 是正確的
Sandbox: https://sandbox.itunes.apple.com/verifyReceipt
Production: https://buy.itunes.apple.com/verifyReceipt
從 apple store 購買成功回傳的格式
{
"productIdentifier": "item.id",
"transactionDate" : '1550000000000',
"transactionReceipt" : 'encoded code',
"transactionIdentifier" : 'transaction id'
}
驗證這個交易是否合法需要傳過去的 data
{
"receipt-data" : $data['transactionIdentifier'] //transactionIdentifier value
}
//驗證後回傳格式
{
"receipt": {
"original_purchase_date_pst": "2019-01-01 00:11:11 America/Los_Angeles",
"purchase_date_ms": "1552000000000",
"unique_identifier": "aaaaaaaaaaaa",
"original_transaction_id": "1000000000000000",
"bvrs": "1000000000",
"transaction_id": "1000000000000000",
"quantity": "1",
"unique_vendor_identifier": "FDDDDDDD-FFFF-AAAA-BBBB-BBBBBBBBBBBB",
"item_id": "1000000000",
"version_external_identifier": "0",
"bid": "abc.example.ouo", // 應用程式 id
"is_in_intro_offer_period": "false",
"product_id": "apple store product id", //商品 id
"purchase_date": "2009-04-01 08:35:47 Etc/GMT",
"is_trial_period": "false",
"purchase_date_pst": "2009-01-01 00:35:47 America/Los_Angeles",
"original_purchase_date": "2019-01-01 08:35:47 Etc/GMT",
"original_purchase_date_ms": "1552000000000"
},
"status": 0
}
問題
https://github.com/dooboolab/react-native-iap/issues/124#issuecomment-386593185
Do's
1)Create sign apk for your application.
2)Upload your apk on Google play store.
3)Create product for your application.
4)wait for 6-12 hour for update item's on store.
5)Give Billing permissions in Manifest.xml
Don't
1)Don't use emulator for testing its does not support Billing Services.
2)Don't use unsigned apk for Billing services.
The sku was not found. Please fetch products first by calling getItems
商品ID錯誤可能多了空格之類的