Solved

Cross-platform subscription management

  • 15 August 2022
  • 1 reply
  • 188 views

Badge +4

Hello everybody!

I've been working on a react-native project which already has a subscription flow that uses stripe on it's web version. The subscription is currently being managed in our back-end and basically, what we do, is to link an entity User (this one is generated in the register flow) to an entity Customer that is responsible for storing the payments data (this one is generated after a purchase is made through stripe). To keep the subscriptions status up to date, we have an endpoint that receives webhooks events from stripe and updates the data in our database.

 

with that being said, the problem I'm facing right now is: As I'm using the revenuecat lib to perform the in-app purchase, how can I match each new purchase with a customer of my database?

  • I've tried using the apple server notification service, which is working fine, but I don't know how to link the received payload to a user or a customer. If there is any data in there that I can link to Revenuecat, please let me know because I did not find it in the documentation. (I'm attaching apple's webhook payload below)
    {
    "transactionId": "",
    "originalTransactionId": "",
    "webOrderLineItemId": "",
    "bundleId": "",
    "productId": "",
    "subscriptionGroupIdentifier": "",
    "purchaseDate": ,
    "originalPurchaseDate": ,
    "expiresDate": ,
    "quantity": 1,
    "type": "Auto-Renewable Subscription",
    "inAppOwnershipType": "PURCHASED",
    "signedDate": ,
    "environment": "Sandbox"
    }

     

  • I've tried looking into the response after completing a purchase but there is nothing related to apple in there, only revenuecat data.

 

I know I could use Revenuecat's webhooks and perform a Purchases.logIn(my_backend_userId) before making a purchase but since I do not have the approval for paying the basic plan right now, I'm trying to find an alternative solution for it. Any suggestions on that?

 

If you need more details about this implementation, please let me know.

 

Kind regards,

 

icon

Best answer by Jens 22 August 2022, 16:03

View original

1 reply

Userlevel 5
Badge +7

The solution to share entitlements across platforms is definitely to use logIn(). In terms of keeping your backend up to date, the best solution is obviously webhooks, but if you can't use them, instead your client could after purchasing call an endpoint in your backend which then in turn pulls the up to date purchase information from the RevenueCat REST API.

Reply