React-native-iap: buyProduct() second time when the first time error

Created on 19 Aug 2018  ·  6Comments  ·  Source: dooboolab/react-native-iap

Version of react-native-iap

"react": "16.4.1",
"react-native": "0.56.0",
"react-native-iap": "^1.4.0",

Platforms you faced the error (IOS or Android or both?)

iOS only

Expected behavior

I want to start a new purchase, not recover, whatever success or failure before.
what should I do?

Actual behavior

in fact, IAP shows:
You have purchased this in-app purchase.
This project will be free to recover.

Tested environment (Emulator? Real Device?)

Real Device in sandbox purchase

Steps to reproduce the behavior

first time :

RNIap. buyProductWithoutFinishTransaction(sku).then(receipt => {
// some error code in callback,so the process did not continued.
// but it seemed like APPLE IAP server record this purchase.
})

I found I used wrong api , cause I didn't understand the api instructions.
so i changed the code.

second time:

RNIap.buyProduct(sku).then(receipt => {
// it shows 
// You have purchased this in-app purchase.
// This project will be free to recover.
})

image

📱 iOS 🙏 help wanted

Most helpful comment

@dooboolab very good man!

All 6 comments

@12343954 I've described here about the difference between buyProductWithoutFinishTransaction and buyProduct. I will try to manage the docs soon. I am trying to release version 2.0.0 these day, so it may take time.

You should use finishTransanction method after buyProductWithoutFinishTransaction to finish up the purchase you've made otherwise that purchase may get lost 😰. Let me assign some reviewer here to help you out if possible.

@dooboolab very good man!

Also finding this. The exact English message is:
"This In-App Purchase has already been bought. It will be restored for free."

As a result, the promise for RNIap.buyProduct(..) and RNIap.buyProductWithoutFinishTransaction(..) never resolves.

@jamsch you may face this error when you callbuyProductWithoutFinishTransaction and not finishing it with finishTransaction or you may result in harmful behavior. If you've done that, you may try some solution like this one.

I guess this is not the other issue which blocks purchasing afterwards.
This looks like 'preventing duplicate purchasing of non-consumable products'.
So, the first purchase actually succeeded ??

257 #259 Closing it for dupe issue.

Was this page helpful?
0 / 5 - 0 ratings