-
-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS in-app purchase failure when payment method added live when there is not payment method already present #307
Comments
Sorry to say this but your code seem to have many syntax error. Please refer to our example project in our repo and compare with your code first. |
@dooboolab
This process works fine if user have already payment method added. When user don't have a payment method added it takes to adding payment method page and amount is charged before reaching the |
Thanks for the detail. Your issue looks clear now. cc @JJMoon |
@zohaibahmed-22 Is this sandbox test case ? |
@JJMoon No, its a real environment case. |
I understand this error happens when the user is in logged out state, or no credit card info. |
@dooboolab and @JJMoon also i think i found the issue when going through our iOS code. In the updatedTransactions method when we receive a failure message in the Since in many cases the |
@anandwahed I agree on you. It's my fault. Sorry for that. |
@anandwahed I guess it's right way to |
I just read the thread 6431 (https://forums.developer.apple.com/thread/6431#14562)
And I learned two things. I suggest you all to read this thread, and return to this issue. I guess, which way you choose (1 or 2), it's on your own. |
@JJMoon does it mean we shouldn't use buyProductWithoutFinishTransaction ? |
@maxs15 I didn't mean that. Sorry for confusing. |
Today, I've tried to debug this issue because I have generated this problem. The payment Let's gather some ideas because I think this is very important to be fixed. I am always getting this error when I attempt the purchase with non sandbox user. |
@hyochan If you connect the real server (yours), whether you are in debug mode or release mode doesn't matter. I guess you have 2 options.
|
@JJMoon Yeah, I've figured that out already but still I couldn't make live purchase testing in ios. Is this stackoverflow true? Then how can I solve this problem? We have to test the live purchase. |
Anyone who is facing this problem, I am sure all of them do, please give us an idea of how to encounter this problem. |
@hyochan No we didn't contact Apple support. |
I think we need to contact |
I've released to |
I've tested this in a live purchase and seems to be working. However, keep in mind that you should only add listener when there was a failure or it may be duplicated with a successful result. |
This is similar feature from react-native-iap(hyochan/react-native-iap#307). Similar issue in current repo #54.
Guys, thank you for investing time in this problem! 🙏 I think the current documentation needs to be clearer around the usage of But I also think this leaves room from improvement to the API. Would you guys be open to discussing a change in the API that can better accommodate the so called 'store kit flow'? Something maybe using RxJS, for example: const observable = RNIap.buyProduct('com.example.coins100')
.subscribe(
purchase => console.log(purchase), // successful payment
err => console.log(err) // err.code and err.message are available
)
Or something different that better hides the additional subscription for iOS? |
@Edgpaez That's great but that will change the behavior of the purchase being done in |
hi @hyochan, AFAICT, we don't need to change the internal behavior of the package, only the public facing interface. We can keep the buyItemByType method resolving promises and simply add a bit of Rx on top of that on index.js. for example, we'd have this in index.js: export const buyProduct = (sku) => Platform.select({
android: () => Observable.of(RNIapModule.buyItemByType(ANDROID_ITEM_TYPE_IAP, sku, null, 0)), // returns an observable that emits when the RNIapModule.buyItemByType promise resolves
ios: ... // ios would do the same but taking into account the usage of addAdditionalSuccessPurchaseListenerIOS
})(); My goal is not this specific implementation but to hide details specific to the 'store kit flow'. |
@Edgpaez Ok. I understand the detail now. However, I feel adding Also, I feel the below would be something different.
If you call
We can't guarantee which one would finish first so I think we should handle this in native to I feel like implementation should look like
Please tell me if there is something I've missed. Lets handle further disccustin in #423 |
Version of react-native-iap
react-native-iap": "^2.3.17
Platforms you faced the error (IOS or Android or both?)
iOS
Expected behavior
Payment should go through only when
finishTransaction
is being calledActual behavior
The amount is being detected after a payment method like credit card is added.
But the
RNIap.buyProductWithoutFinishTransaction(sku)
method reached.Tested environment (Emulator? Real Device?)
Real Device - iPhone 6s
Steps to reproduce the behavior
The text was updated successfully, but these errors were encountered: