how to manage RC App user ID and User ID in our database and transaction ID from Apple

  • 2 December 2022
  • 1 reply
  • 166 views

Badge +4

Sorry I am new here, building an app with some questions needed help :)

My app has a subscription monthly with 7 days trial, and you have to subcribe to register an account.

I am a bit confusing between 3 kinds of IDs: The user ID we create in our database, the App User ID provided by RC and how to know which user has paid in transaction from App Store Server Notifications.

 

For UserID and RCID, at the first load when I call Purchases.configure(), RC will create a new random ID. Then in paywall screen, after subscribe successfully, I will register a new account in backend, and store this RCID. Now I have a pair of RCID-UserID, when user login to my app by UserID, I will use RCID to login to RC by Purchases.logIn("RCID"), so I can get the right info of getCustomerInfo(). so question is: am I on the right way? :)

 

On the next month when subscription need to be renewal, if purchasing is successful, Apple will send to backend a transaction via “App Store Server Notifications”, so how I know this transaction is for who? (then I can set 1 more month using app for this user in databse). The transaction won’t have data of RCID nor UserID. I research that I can use transaction_id or original_transaction_id, but they are not trustable because they can be changed, is it true?

 

Sorry for my bad English, have a good day :)


1 reply

Userlevel 6
Badge +8

Hey @Mensur!

For UserID and RCID, at the first load when I call Purchases.configure(), RC will create a new random ID. Then in paywall screen, after subscribe successfully, I will register a new account in backend, and store this RCID. Now I have a pair of RCID-UserID, when user login to my app by UserID, I will use RCID to login to RC by Purchases.logIn("RCID"), so I can get the right info of getCustomerInfo(). so question is: am I on the right way? :)

 

Yeah, it sounds like you’re on the right track here. We’ll automatically generate an anonymous user ID when you call `configure` if you don’t provide a custom ID at that point. You can log in at any time with your own user ID to sync transactions to that user ID (like once the user registers for your app and you have your own ID).

On the next month when subscription need to be renewal, if purchasing is successful, Apple will send to backend a transaction via “App Store Server Notifications”, so how I know this transaction is for who? (then I can set 1 more month using app for this user in databse). The transaction won’t have data of RCID nor UserID. I research that I can use transaction_id or original_transaction_id, but they are not trustable because they can be changed, is it true?

 

Server notifications should be configured to send to RevenueCat automatically, then we will send webhook events with user identity details and other related customer info, so you don’t need to manually make this connection with Apple’s events.

Reply