Skip to main content
Question

RevenueCat API query for Stripe one-time purchases triggers code 7103 The receipt is not valid


kerryg
Forum|alt.badge.img+7

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
}

7 replies

jazmine
Forum|alt.badge.img+7
  • Dedicated Contributor
  • 122 replies
  • March 4, 2022

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?


kerryg
Forum|alt.badge.img+7
  • Author
  • Member
  • 9 replies
  • March 4, 2022

@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. 


kerryg
Forum|alt.badge.img+7
  • Author
  • Member
  • 9 replies
  • March 4, 2022

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

 

"code": 7225,

"message": "Invalid API Key."


kerryg
Forum|alt.badge.img+7
  • Author
  • Member
  • 9 replies
  • March 4, 2022

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. 


sharif
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 513 replies
  • March 18, 2022

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"
  ...
}

 


Forum|alt.badge.img+1
  • New Member
  • 1 reply
  • May 11, 2022

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é


Forum|alt.badge.img+1

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


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