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

appAccountToken not returned in purchase of purchaseUpdatedListener

Open CyberTron88 opened this issue 1 year ago • 11 comments

I passed in a uuid to the appAccountToken, this is not returned anywhere inside the purchase of purchaseUpdatedListener. The field is definitely passed in correctly as I see the value inside the notification received under transactionInfo.

I'm passing in as

await requestSubscription({ sku: subscriptionSKU, appAccountToken: user_uuid });

CyberTron88 avatar May 30 '24 01:05 CyberTron88

Ok. I found it inside latest_receipt_info but not in_app inside transactionReceipt.recipe

CyberTron88 avatar May 30 '24 02:05 CyberTron88

hi @CyberTron88

can you please provide full explaination of it, I tried passing userID to appAccountToken but didn't get it in purchaseUpdatedListener or latest_receipt_info. also It would be helpful if you share your code for IAP demo.

thanks for the help.

Malhar62 avatar Aug 09 '24 18:08 Malhar62

@Malhar62 It is working properly if you turn on storykit2 mode:

    if (Platform.OS === 'ios') {
      storekit2Mode();
    }
    initConnection().then(() => {
    // ...
    });

fatidian1 avatar Oct 04 '24 04:10 fatidian1

I found the way, appAccountToken has to be in UUID format then only we will receive it from webhook notification in backend. Not in any random string.

Malhar62 avatar Oct 04 '24 10:10 Malhar62

Yeah, that's the first thing that I did, but in storykit1 mode it wasn't working.

fatidian1 avatar Oct 04 '24 10:10 fatidian1

Oh okay, I am using storekit2, Thank you.

Malhar62 avatar Oct 05 '24 03:10 Malhar62

Have you found any solution for this @Malhar62 ?

Karthik-V26 avatar Oct 09 '24 11:10 Karthik-V26

@Karthik-V26 Can you show me your code? What kind of string is your appAccountToken? What platform are you testing it on?

fatidian1 avatar Oct 09 '24 13:10 fatidian1

@Karthik-V26 Can you show me your code? What kind of string is your appAccountToken? What platform are you testing it on?

@Karthik-V26 the type has to be UUID, apple has mentioned that on official docs otherwise it won't send token if it's in any other form.

Malhar62 avatar Oct 10 '24 04:10 Malhar62

@Malhar62 , You are right, If the type is UUID then I can see it. Thanks for the answer. Could you help me in knowing the advantages of UUID, I actually need some id to send to backend to identify the user. Like to differntiate the two app account users who tries to buy subscription using same appleID to avoid conflicts?

Karthik-V26 avatar Oct 10 '24 11:10 Karthik-V26

@Malhar62 , You are right, If the type is UUID then I can see it. Thanks for the answer. Could you help me in knowing the advantages of UUID, I actually need some id to send to backend to identify the user. Like to differntiate the two app account users who tries to buy subscription using same appleID to avoid conflicts?

On backend you can attach UUID to a user so each will have their unique UUID key, so after purchase backend will get appaccountToken as UUID and can differentiate user by that.

Malhar62 avatar Oct 11 '24 04:10 Malhar62

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 18:09 hyochan