react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

after invoke "clearTransactionIOS" then app crash said "Cannot finish a purchasing transaction"

Open sbin1211 opened this issue 3 years ago • 5 comments

Please use the Discussion board if you want to get some help. Please use issues to report bugs.

Description

after invoke "clearTransactionIOS" then app crash said "Cannot finish a purchasing transaction" see attaachment

Expected Behavior

Screenshots

Screen Shot 2022-12-12 at 18 55 46

Environment:

  • react-native-iap: 8.0.8
  • react-native:0.86
  • Platforms (iOS, Android, emulator, simulator, device): ios

To Reproduce Steps to reproduce the behavior:

code invoked

await iap.clearTransactionIOS(); await purchaseSubscription(subId).catch((error) => { if (error && error.code !== 'E_USER_CANCELLED') { SubscriptionActions.log({ source: 'purchaseProduct:purchase_error', error, subId }); console.warn('subscribe error', subId, error); } });

and see some crashes on firebase

[Optional] Additional Context

sbin1211 avatar Dec 12 '22 11:12 sbin1211

@andresesfm Did you ever find a solution? I am experiencing this issue.

homiis avatar Aug 14 '23 15:08 homiis

My understanding was that clearTransactionIOS was supposed to be used in debug only. Do you have more information?

andresesfm avatar Aug 14 '23 17:08 andresesfm

@andresesfm That makes sense. The reason I tried calling it is because calling requestPurchase is not doing anything for me on iOS. I was thinking maybe I had to clear pending transactions?. Maybe you can help? Code is below. :')

App.js

  import { initConnection } from 'react-native-iap';

  useEffect(() => {
    initIAP()
  }, [])

  async function initIAP () {
    await initConnection()
  }

PurchaseScreen.js

    const items = Platform.select({
        default: ['quick_boost_ios'],
    });
    
    useEffect(() => {
        setupIAP()
    }, [])

    const setupIAP = async () => {
        getProducts({ skus: items }).then(async (res) => {
            setProducts(res)
        })
    }
    
    purchase = async (sku) => {
        try {
            await requestPurchase({
                sku,
                andDangerouslyFinishTransactionAutomaticallyIOS: false,
              });
            console.log('REQUESTED OVER')
        } catch (err) {
            console.warn(err.code, err.message)
        }
    };

    return (
         products.map((prod, key) => {
              return (
                   <TouchableOpacity onPress={() => this.purchase(prod.productId)}>
                         <Text>Buy Me</Text>
                   </TouchableOpacity>
               )
         })
    )

homiis avatar Aug 14 '23 17:08 homiis

Hey. I have the same issue. Have you fixed it?

gradinar-s avatar Aug 10 '24 12:08 gradinar-s

Also same issue here. Some extra debug information: image

Hibbem avatar Sep 13 '24 09:09 Hibbem

I’m closing all issues reported in versions below 14, as the library now supports the new architecture with NitroModules and has been completely revamped.

hyochan avatar Sep 30 '25 19:09 hyochan