Question

How to get TRANSFER event?

  • 5 April 2023
  • 3 replies
  • 138 views

Badge +4
Hi there,

My question is this:
 
We have connected webhook events to our app and in the client side we have implemented only the configure part with userId and login method

 

  RNPurchase.configure({
                apiKey: "xxxxxxxxx",
                appUserID: UUID-userIdHere
   });

 

RNPurchase.logIn(userID);

 
 
So our app won't have anonymous users.
 
According to documents, we should not call logOut() method for users because we don’t want anonymous users. However, we should be able to get TRANSFER type of events in the webhooks but we could not received it yet.
 
In this case our users can change users with different logins. We have tried that:
 
1-) User logged in our application, sdk configure and login method is invoked.

2-) Then we have deleted user in our system
 
3-) We have created new user with different userId but belongs to same Google Play user.
 
4-) SDK initialized configure and login method again but never received TRANSFER event.
 
We get all events except TRANSFER events. So how can we get transfer events automatically? We need to understand the user is changed in our backend system.
 
So how can we trigger TRANSFER events?
 
Thanks!

3 replies

Userlevel 3
Badge +7

Hi,

So how can we trigger TRANSFER events?

 

Glad to help. From our docs here,

TRANSFER A transfer of transactions and entitlements was initiated between one App User ID(s) to another.


One way to test it with the default transfer purchases restore behavior, would be to:

  1. Log in with App User ID A

  2. Make a purchase

  3. Switch accounts / log in again on the same device as App User ID B (with the same App/Play Store account still logged in).

  4. Make a call to restore purchases / press the restore button.

  5. This should trigger the TRANSFER event, transferring transactions from A to B.

Badge +4
Hey there,
 
Thanks for your answer.
 
syncPurchases  is only invoked in the migration step right? Can we call this method in the login or register process of our application? Is it ok to do that?
 
Otherwise we should call restorePurchases but this logic should be attached to a button that users should interact with.
 
But we prefer to do this automatically without pressing buttons to restore.
 
Any advice? :)
 
Thanks!
Userlevel 3
Badge +7

syncPurchases  is only invoked in the migration step right?

Right - there are some other edge cases here and there though depending on what needs to be done.

 

Can we call this method in the login or register process of our application? Is it ok to do that?

You really shouldn’t need to call it in the login or register process, but I am not familiar with your use case. For more info here you might want to submit a support ticket. You also may want to consider this part of our identification docs: https://www.revenuecat.com/docs/user-ids#how-to-only-use-custom-app-user-ids

 

Otherwise we should call restorePurchases but this logic should be attached to a button that users should interact with.

But we prefer to do this automatically without pressing buttons to restore.

I see, I just know that in almost all cases calling syncPurchases is not needed, and sometimes leads developers into other unintended edge cases where an unexpected transfer happens. Having a restore button is always recommended, because it is extremely helpful in the support process for customers who lose access to their purchases.

Reply