Stripe and RevenueCat integration

  • 19 April 2022
  • 7 replies

Badge +1

Hey guys,

I’ve followed the docs on how to integrate Stripe with RC, however something doesn’t seem to be working.

I’m receiving the webhook from Stripe for the purchase (customer.subscription event).

I’m trying to use the endpoint in order to sync Stripe and RC, however I keep getting {"code":7103,"message":"The receipt is not valid."}
I’ve went over each and every ID field on Stripe’s webhook, and got the same message for all of them.

What am I missing here?



Best answer by doron 19 April 2022, 22:06

View original

7 replies

Userlevel 1
Badge +7

I just went through this process. Can you post what you’re using (minus your API key)?

The trick for subscriptions is to use the subscription ID (i.e. sub_H8g9sZfabexttH) and for one time purchases to use the Stripe Checkout Session ID (ie. cs_live_a1oVfRH1c5IWToSONBZvYuRoLXCNO4nC4tfflQsiQERjmcsiYW9poeadU3)

Badge +1

Thanks Kerryg for the response,
I’m sending this:
curl -X POST \ \
  -H 'Content-Type: application/json' \
  -H 'X-Platform: stripe' \
  -H 'Authorization: Bearer <RevenueCat-api-key>' \
  -d '{ "app_user_id": "",
  "fetch_token": "sub_1KqK9dFvB1IRaUegY9uCBQsr"

Userlevel 1
Badge +7

HI Doron,


I suspect the app_user_id as a email address may be the issue - but this is just a guess. I would try a non-email formatted UID (i..e 0101010101001) and see if that has an impact. Here’s an example curl that works from our implementation:

"product_id": "com.chimani.subscription.yearly",
"price": 29.99,
"currency": "USD",
"is_restore": "false",
"app_user_id": "SJIfxyBPwrgvZnE797xujkWWSCk2",
"fetch_token": "sub_1KV4IhEwxMCNONa5SGSXXdLu",
"introductory_price": 14.99


Also, make sure your RC API key is Stripe specific, if you haven’t already done so. 



Badge +1

Thanks again Kerry,

I’ve tried replacing the email with stripe’s customer-id, still doesn’t work. Also tried using your user-id, just in case. Same result.


But what you mentioned about the RC API key to be Stripe specific - that part I didn’t do. 

When I set up a new API key, it’s being set up as a secret API key, and then I get a response “saying Secret API keys should not be used in your app”.

Can you direct me to where you’ve set up the Stripe specific API key?
I also can’t seem to find where I set up the Stripe Webhook endpoint in Revenue cat.

Badge +1

Kerry thank you so much!
You made me think of it again, and I’ve noticed I’m only Administrator on our RC project, so I’ve asked the owner to see if he has that option.
Turns out the API key was the problem all along.

Userlevel 1
Badge +7

Within Revenuecat → Projects -> you want to have created a Stripe app. Within the Stripe App, you can get your public Stripe API key and where you input your Stripe webhook and secret.

Userlevel 2
Badge +3

@kerryg I have a related question about the fetch_token. I am using Stripe Checkout to allow users to start a subscription and I am not able to find a subscription_id, but I am able to find a Checkout Session ID. For subscriptions, do you have to use a subscription_id? If so, how could I find that id?


EDIT: Nevermind, I think I figured it out.