chirag04 / react-native-in-app-utils

A react-native wrapper for handling in-app payments
MIT License
890 stars 185 forks source link

No callback registered for transaction with state purchased. #203

Open kbennoune opened 5 years ago

kbennoune commented 5 years ago

I'm using the library to enable subscription purchases. I'm still developing the app so I'm using the sandbox. When I purchase the product I get the "You're all set. Your purchase was successful." dialog but the app itself isn't running the callback and the console is printing the warning "No callback registered for transaction with state purchased." When I start the purchase and cancel instead of entering the sandbox account password I see the warning "No callback registered for transaction with state failed."

Here's the react code I'm using for the purchase.

      InAppUtils.purchaseProduct(productIdentifier, (error, response) => {
        if (response) {
          const { transactionIdentifier,  productIdentifier: responseProductIdentifier, transactionReceipt, transactionDate } = response

          store.dispatch( { type: 'SUBSCRIBED_TO_SERVICE', productIdentifier, transactionIdentifier, transactionReceipt, transactionDate })
        } else {
          store.dispatch({ type: 'SUBSCRIBE_TO_SERVICE_FAILED', error })
        }
      });

I'm using ios 12.1.3.

Any ideas about what's going on?