Skip to main content

I am trying to prepare an import script for adding our one-time (i.e. Lifetime) historically purchases from Stripe into RC. I am able to successfully use the API to create annual subscription but have not figured out how to get passed the "{"code":7103,"message":"The receipt is not valid."}" error I keep getting for my one-time purchase query. I am using the Stripe checkout key at the fetch_token and Postman to get test the syntax structure first. Here's my code:

header 'Accept: application/json'
header 'Authorization: Bearer stripe_secret_key]'
header 'Content-Type: application/json'
header 'X-Platform: stripe'
{
"product_id": "prod_HMezcIkru867vf",
"price": 99.99,
"currency": "USD",
"is_restore": "false",
"app_user_id": "ZOVwTCYttQagvnO0ALT7vhmoYWf2",
"fetch_token": "ch_3K8UhVEwxMCNONa5180XDbh7",
"introductory_price": 49.99
}

Hey @kerryg :wave:

 

This issue might be related to your curl request and the fetch token. You will need to use your Stripe Public API key when posting receipts. Additionally your  fetch token looks in a different format than I usually see. Can you confirm that it’s correct?


@jazmine Thank for your response.

To clarify, you’re saying I should use the public Stripe key, and not our secret key for the curl? I have been using our secret Stripe key to process all our subscriptions without a problem.

As for the fetch_token, when I reached out to RC support, @Sharif said I need to use the “Stripe Checkout Session ID” for the fetch_token, (i.e. ch_3K8UhVEwxMCNONa5180XDbh7), which is what I did. 


A quick follow-up, when I use the public Strip key I get the following:

 

"code": 7225,

"message": "Invalid API Key."


Just a suggestion, but it would be helpful if RC shared some insight into the API import script that you use for the one-time purchase imports.

I’m sure I and other could figure it out with a working example but unfortunately there is no public documentation in the RevenueCat REST API section of the website for one-time purchases and the RC API. 


Hey Kerry! It seems we’ve resolved this specific issue via our ticketing system, but to fill in others who may have the same issue, RevenueCat supports only Stripe Checkout sessions for lifetime purchases. We need the Stripe Checkout session ID in the "fetch_token" property, which will look something like this in your request:

{
...
"fetch_token": "cs_live_a13H869Lkx0xSSkZWMTeo8Inv6qs0kxXhcX3W4pulsv5iwApAMQpA0A4QX"
...
}

 


Hey @sharif ,

thanks for your reply. Just tried that out. One-time-purchase with Stripe Checkout Session ID results in a 7110 Internal Server Error.

Any idea, what could be causing this? Am I missing any additional params?

POST /v1/receipts

>
"app_user_id" => "EaA9tVC3UxxgjHD4FzvbpgQte32ayzD1dlHTT"
"fetch_token" => "cs_test_abcxyz"
"price" => 99.0
"currency" => "USD"
"attributes" => ]
]

Thanks for your help!

André


POST /v1/receipts

headers: {  "Authorization": 'Bearer $strip_key',  "Content-Type": "application/json",  "X-Platform": "stripe",  "Accept": "application/json",},
body: jsonEncode({  "is_restore": "false",  "fetch_token": "$sessionId",  "app_user_id": "$userId",}),


i got same error please help. error like {code: 7110, message: Internal server error.} 


Reply