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)
Thanks Kerryg for the response,
I’m sending this:
curl -X POST \
https://api.revenuecat.com/v1/receipts \
-H 'Content-Type: application/json' \
-H 'X-Platform: stripe' \
-H 'Authorization: Bearer <RevenueCat-api-key>' \
-d '{ "app_user_id": "doron@cyrus-security.com",
"fetch_token": "sub_1KqK9dFvB1IRaUegY9uCBQsr"
}'
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.
Regards,
Kerry
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.
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.
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.
@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.