Question

Need more documentation about API usage

  • 22 February 2024
  • 3 replies
  • 78 views

Badge

I went backand forth inside documentation about how my backend with in shole flow.

Please add explanation on how my backend register user id and check payment/subscription status

As far as I understand 

  1. frontend app need to get RevenueCat customer id via SDK 
  2. Send that ID to backend to save. Assuming RevenueCat customer ID does not change, Our backend should keep track of it.
  3. When user does action All kind of Webhook will send request to my backend.
  4. Somehow we have to figure out RevenueCat customer ID from webhook request params. ( which I could not do )
  5. Then we have to call REST API /subscriptions. https://www.revenuecat.com/docs/customers/customer-info#web-apps But it is not documented 

About step 1, here answer says webhook is suggestion. Is there any other ways?

About step 2, link mention send customer id everytime to backend. But no documentation about why. Does it change everytime?. Can’t we just save it first time?. What about my backend cronjobs? they can’t take this id from frontend …

 

About step 4 also there is no documentation about how we get customer id from Webhook.

About step 5, I tried it Webhook have something like this, app_user_id: "$RCAnonymousID:09488af8a5de45******4e17f76e2f4b". Why there is  RCAnonymousID should we send it to /subscribers endpoint as it is? I tried sending CURL, 

❯ curl --request GET \
--url https://api.revenuecat.com/v1/subscribers/$RCAnonymousID:09488af8a5*****9c394e17f76e2f4b \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer appl_hrtnJxTH******AgknhnanEoQWh'

response was object with empty subscriptions.

{"request_date":"2024-02-22T08:00:43Z","request_date_ms":1708588843368,"subscriber":{"entitlements":{},"first_seen":"2024-02-22T07:59:51Z","last_seen":"2024-02-22T07:59:51Z","management_url":null,"non_subscriptions":{},"original_app_user_id":":09488af8a5de45469c394e17f76e2f4b","original_application_version":null,"original_purchase_date":null,"other_purchases":{},"subscriptions":{}}}

I know there is a subscription for this user because that is how i get `$RCAnonymousID:09488af8a5*****9c394e17f76e2f4b` value from webhook.

 

So many mysteries to solve, Just to get user status on backend we need to wrestle with community questions and spend many hours. 

Please add explanation on how Mobile App + RevenueCat SDK works with Backend + RevenueCat API

Also documentation about this Webhook and REST API customer ID difference. SDK gives some ID, Wenhook Gives 2 type of ID. how they are different which is connected to what?


This post has been closed for comments

3 replies

Badge

Oh also, as today’s state, v2 does not have a /subscribers endpoint, Only v1 have. ( v1 is marked LEGACY. That made me think if I am using v2 then I don’t need v1. ) which took quiet amount of time when i first search /subscribers endpoint. Somehow by pure luck I saw this page and figured out it was v1 link. whatever this link was pointing it is now just jumping to Overview page. If your v1 is not fully merged to v2 please don’t mark it as LEGACY

Badge

Small detail 

https://www.revenuecat.com/docs/customers/customer-info#web-apps
here curl code is like this

curl --request GET \
--url https://api.revenuecat.com/v1/subscribers/app_user_id \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer PUBLIC_API_KEY'



Please change /app_user_id part to /{app_user_id}. it is confusing
https://www.revenuecat.com/docs/api-v1-spec#tag/customers/operation/subscribers

 

Userlevel 3
Badge +8

Hi,

I’ll edit the docs to make the points in your last two comments more clear.

As for this:

  1. frontend app need to get RevenueCat customer id via SDK 
  2. Send that ID to backend to save. Assuming RevenueCat customer ID does not change, Our backend should keep track of it.
  3. When user does action All kind of Webhook will send request to my backend.
  4. Somehow we have to figure out RevenueCat customer ID from webhook request params. ( which I could not do )
  5. Then we have to call REST API /subscriptions. https://www.revenuecat.com/docs/customers/customer-info#web-apps But it is not documented 

 

You can create a customer ID in your backend and use it to log in with the SDK. You shouldn’t assume the ID will never change unless you take steps like this. The /subscribers endpoint you mentioned has an `original_app_user_id` parameter you can use (customer ID).