How to force Subscriber attributes sync with Revenuecat servers
According to Revenuecat documentation:
“Subscriber attributes are only synced with RevenueCat servers on app launch, app backgrounded, and when purchases are made or restored.”
However, we want to sync these attributes to RevenueCat servers without app being sent to background.
As you can see from the attached pictures of code I tried, and debug logs, I could never force subscriber attributes to be synced to revenuecat servers without app being sent to background.
They are also synced if there is a purchase, but after purchase event. However, we need to use them for before purchase event. Because they are missing with the initial purchase event webhook we are receiving from revenuecat.
Any help would be greatly appreciated, thanks
Page 1 / 1
There is not a way to force a sync of Subscriber Attributes with RevenueCat servers from the Purchases SDK, but they are synced when a purchase is made so they will be available with an INITIAL_PURCHASE webhook.
If you need a more realtime datastore it’s probably worth looking into hosting your own database.
Hi Ryan, thank you for your fast response.
My only problem is that they are missing with initial_purchase webhook. I do not expect anymore realtime than seeing them with the initial_purchase webhook.
They are only missing with initial_purchase but exist with all other future events. Any tips/ideas why this could happen?
We are using Purchases.purchasePackage() function to make purchase.
@ryan Here are example event screenshots from user below
Please observe that initial_purchase is missing skoove_id attribute, which actually is set at an earlier time than initial_purchase event when timestamps are also examined on the renewal event.
I’d highly appreciate your comment on this. thanks
Thanks for the extra info, I’m taking a closer look. Would it be possible to attach a .txt file of everything that the debug logs output from initialization through purchase? It will help me see some timestamps of when the set attributes call is being called by the SDK, when the purchase is occurring, and when the subscriber attribute actually gets synced. Also, SDK version should be in the debug logs but that would be good to know too.
Hello Ryan, I worked together with Halid, follow the internal logs, as you can check we are facing 2 strange issues: - The restore Purchases are not sync the Restore Purchase - And the ERROR: There was an unknown backend error, when the SDK tries to POST without any user id.
When we do a Purchase the attributed is synced, and sometimes the INITIAL_PURCHASE event is faster than then the saved attribute.
Thank you
I am seeing the same issue on the “NON_RENEWING_PURCHASE” webhook. We use the custom attributes on the webhook event to do some stuff in our BE. This the above mean that we can not rely on the webhook not having the must up-to date attributes?
Hello,
I’m trying to set attributes with the setAttributes method.
I thought you could use the syncAttributesAndOfferingsIfNeeded method to sync with the server.
Is that still the case that the attributes would be set only at Purchase time?
Thanks for your help
I'm with the same issue.
I can't next with my process, cause we don't receive the custom data using setAttribute method.
Does anyone have the solution?
Hey @gnsdevelop,
So I sorted this out in my app, not sure if that’s your problem as well, but the reason why I was not seeing the data in Revenue Cat is very simple, I was using the fields reserved for Revenue Cat. The grey fields are not writable, only readable.
So you need to come up with your own dedicated field names.
Here’s a screemshot of Revenue Cats meta data for a customer, I was trying to insert the email in E-Mail but as you can see it’s grey and reserved to RC only.
When I create a customer with the ID: "teste_123", and put some information in the Purchases.setAttributes method, everything works normally. I can see this attribute information both in the webhook and in the platform.
However, if I cancel this subscription and make a new one with the same customer, the information is no longer set in the attributes.
Oh ok, yes quite different, I suppose this would more of a Revenue Cat staff to answer this one.
To make sure, if unsubscribe your customer, do you see the attributes deleted straight away? Like the webhook, they are not here? Or is only when you subscribe again?
I’m just wondering if there’s a logic that would be cleaning up the attributes in the case of a new subscription.
In the cancellation webhook, I can see the attributes normally.
However, if I create a new subscription, where the appUserID is the same, the attributes are no longer passed.
[Edit] Ok, interesting, and last test: after you unsubscribe, if you go in the RevenueCat backend and before you subscribe again for the same appUserId, can you see the Attributes?
Yes, I can see it, the problem really only occurs when I create a new subscription with the same userAppId.
I actually tested it with Reserved attributes, and I have the same problem.
Ok, definitely sounds like a RevenueCat staff should have a look at this. This does not sounds like a wanted behaviour.
Anyone from Revenue Cat to let us know if this is normal behaviour? that RC is erasing the attributes when a new subscription occurs after having an unsubscribed with the same AppUserId?