hyochan / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.hyo.dev
MIT License
2.82k stars 643 forks source link

Unable to get product from testflight IOS #2797

Open Rohit-vinfotech opened 3 months ago

Rohit-vinfotech commented 3 months ago

Hello Team, I need some help in IAP, I have setup IAP in react native for IOS and working fine with xcode locally but when I want to validate receipt it gives me 21002 from real device. Now I want test it from Testflight but unable to get products, I am using storeKit file. I have run IAP locally and getting product through getProduct method but when I upload it to Testflight it gives me empty array.

My react native 0.70.3 and IAP(react-native-iap) 12.15.1

I have done below things

  1. Setup product for "Ready to Submit"
  2. Sandbox tester added and logged in my device with sandbox tester id
  3. I've called initConnection befor getProduct
  4. Enabled "In-App Purchase" in Xcode "Capabilities"
  5. StoreKit file setup in Edit scheme -> run debug -> options

May I know if anything else required for IAP for IOS in react native

please help me for this to complete my IAP with validate receipt

Thank You in advance :) I hope someone reply quickly

alexandrepalagem commented 3 months ago

Ensure your Tax Information and Banking information are filled out. Once I agreed to the terms and added banking info, everything started working fine.

You can find these agreements in App Store Connect > Business > {Select Own Business}. Make sure you have the Agreements, Bank Accounts, and Tax Forms filled out correctly. Hope this helps.

Rohit-vinfotech commented 3 months ago

Hello Alexandre,

I done "Ensure your Tax Information and Banking information are filled out." and I am getting products and do purchase but getting malformed receipt and status code { "status": 21002} I also test it from testflight but got same result can you please help me , I also used setup({ storekitMode: 'STOREKIT2_MODE' });

const validateReceipt = async (receipt, purchase) => { const requestBody = { 'receipt-data': receipt, 'password': '31ca*****' // if applicable }; console.log('requestBody is valid:', requestBody);

const validateReceiptIos = await IAP.validateReceiptIos(requestBody, true)

console.log("validateReceiptIos==>", receipt, validateReceiptIos) alert(JSON.stringify(validateReceiptIos)) try { const response = await fetch('https://sandbox.itunes.apple.com/verifyReceipt ', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(requestBody) });

console.log('response is valid:', response); const jsonResponse = await response.json(); alert("response" + JSON.stringify(jsonResponse)) if (jsonResponse.status === 0) { // Valid receipt console.log('Receipt is valid:', jsonResponse); } else { // Invalid receipt console.info('Invalid receipt:', jsonResponse); } setTimeout(async () => { const finishTransaction = await IAP.finishTransaction({ purchase, isConsumable: true }); } }, 2000); } catch (error) { console.error('Error validating receipt:', error); } };

On Tue, Jul 9, 2024 at 7:03 AM Alexandre Palagem @.***> wrote:

Ensure your Tax Information and Banking information are filled out. Once I agreed to the terms and added banking info, everything started working fine.

You can find these agreements in App Store Connect > Business > {Select Own Business}. Make sure you have the Agreements, Bank Accounts, and Tax Forms filled out correctly. Hope this helps.

— Reply to this email directly, view it on GitHub https://github.com/dooboolab-community/react-native-iap/issues/2797#issuecomment-2216071671, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCCY76CUB2L44T22B3EJ56DZLM4XZAVCNFSM6AAAAABKQGCYSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJWGA3TCNRXGE . You are receiving this because you authored the thread.Message ID: @.***>

Rohit-vinfotech commented 4 weeks ago

Hello Team,

I am facing an issue with consumable product purchases. When a user purchases an item and kills the app before receiving a response, the payment is completed, but the data is not retrieved from the available purchases and purchase history.

Case: When a user clicks on the "Buy Item" button with UPI, it opens the UPI app. After entering the UPI PIN, the payment is successful, and I immediately close both the payment app and my app. After some time, I reopen the app and do not get the purchase info from the purchase history and available purchases. When I attempt the payment again, I receive a popup saying, "You already own this item."

How can I resolve this programmatically?

I hope for a quick response.

Best regards,

On Thu, Jul 11, 2024 at 4:09 PM Rohit Jaat @.***> wrote:

Hello Alexandre,

I done "Ensure your Tax Information and Banking information are filled out." and I am getting products and do purchase but getting malformed receipt and status code { "status": 21002} I also test it from testflight but got same result can you please help me , I also used setup({ storekitMode: 'STOREKIT2_MODE' });

const validateReceipt = async (receipt, purchase) => { const requestBody = { 'receipt-data': receipt, 'password': '31ca*****' // if applicable }; console.log('requestBody is valid:', requestBody);

const validateReceiptIos = await IAP.validateReceiptIos(requestBody, true)

console.log("validateReceiptIos==>", receipt, validateReceiptIos) alert(JSON.stringify(validateReceiptIos)) try { const response = await fetch(' https://sandbox.itunes.apple.com/verifyReceipt', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(requestBody) });

console.log('response is valid:', response); const jsonResponse = await response.json(); alert("response" + JSON.stringify(jsonResponse)) if (jsonResponse.status === 0) { // Valid receipt console.log('Receipt is valid:', jsonResponse); } else { // Invalid receipt console.info('Invalid receipt:', jsonResponse); } setTimeout(async () => { const finishTransaction = await IAP.finishTransaction({ purchase, isConsumable: true }); } }, 2000); } catch (error) { console.error('Error validating receipt:', error); } };

On Tue, Jul 9, 2024 at 7:03 AM Alexandre Palagem @.***> wrote:

Ensure your Tax Information and Banking information are filled out. Once I agreed to the terms and added banking info, everything started working fine.

You can find these agreements in App Store Connect > Business > {Select Own Business}. Make sure you have the Agreements, Bank Accounts, and Tax Forms filled out correctly. Hope this helps.

— Reply to this email directly, view it on GitHub https://github.com/dooboolab-community/react-native-iap/issues/2797#issuecomment-2216071671, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCCY76CUB2L44T22B3EJ56DZLM4XZAVCNFSM6AAAAABKQGCYSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJWGA3TCNRXGE . You are receiving this because you authored the thread.Message ID: @.***>

Rohit-vinfotech commented 4 weeks ago

Hello Team,

I am facing an issue with consumable product purchases. When a user purchases an item and kills the app before receiving a response, the payment is completed, but the data is not retrieved from the available purchases and purchase history.

Case: When a user clicks on the "Buy Item" button with UPI, it opens the UPI app. After entering the UPI PIN, the payment is successful, and I immediately close both the payment app and my app. After some time, I reopen the app and do not get the purchase info from the purchase history and available purchases. When I attempt the payment again, I receive a popup saying, "You already own this item."

How can I resolve this programmatically?

I hope for a quick response.

Best regards,