Skip to main content
Question

API for client/app to set current offering?


Forum|alt.badge.img+6

I’m integrating RevenueCat into an app with a custom configuration and AB testing system. I can mirror some of what my app does in RevenueCat by setting up different offerings in RC. Then RC can report its transaction centric view segmented by the cohorts that my custom client side code creates. But to achieve this I need the client/app to call a RC API to set the users current offering. Is there a way to do this?

 

 

This post has been closed for comments

3 replies

Jens
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • 187 replies
  • August 24, 2022

Hi @FocusedApps, yes, there is a REST API endpoint for that: Override a Customer's Current Offering (revenuecat.com)

Please note that this API endpoint requires a secret API key, and should not be called directly from your app for security reasons (because secret API keys can do all sorts of things, including deleting subscribers or granting promotional access), so you should only make calls to this API endpoint from your own backend (or a serverless function, e.g., a Firebase Cloud Function, if you don’t have your own backend).


Forum|alt.badge.img+6
  • Author
  • Dedicated Member
  • 15 replies
  • August 24, 2022

OK Thanks Jens. I think I can achieve what I need to do (an AB test) by toggling the current offering between A and B. But this will only work if a users offering works a particular way. Your docs are a little light here. Does it work like so:

  • new user gets assigned the current offering as per the project offerings setup
  • that offering is saved for this user,
  • ‘current’ offering for that user will NOT change, even if current offering in the project setup is changed. (that effects new users going forward, but not old users who already got assigned offering).
  • When a transaction occurs, the users current offering is saved with the transaction. 

Thanks.
 


Jens
RevenueCat Staff
Forum|alt.badge.img+7
  • RevenueCat Staff
  • 187 replies
  • August 24, 2022

the second and third point of your bullets are not correct. the current offering will change for all customers unless it was manually overridden. So if you want this to behave this way, you need to manually assign the current offering for all customers, regardless of whether they were in the control or the treatment group.

 

truth be told, though, you don’t even need to necessarily use offerings to achieve what you are trying to achieve. you could just have an object in the app like the following:

{

  "controlProducts": {

    "monthly": "monthly_product_v1",

    "annual": "annual_product_v1"

  },

  "treatmentProducts": {

    "monthly": "monthly_product_v2",

    "annual": "annual_product_v2"

  }

}

… and then just look up the products based on your experiment assignment, and then call .purchaseProduct() with the respective product, instead of .purchasePackage(). That of course means more client-side logic, and the inability to change what products are being sold through our dashboard, but on the other hand it means you don’t have to write code on your backend for this.

 

Lastly: we are working on a new A/B testing feature that will probably achieve a lot of what you are trying to achieve, and will launch in beta in the next couple of weeks – if you’re interested, feel free to drop an email to the support team and we’d be happy to include you in the beta.

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings