Skip to main content
Solved

V1 API not returning sandbox data


Forum|alt.badge.img+8

I have a customer that has purchased a subscription in the sandbox, and when I call the V1 get subscriber endpoint, it does not return this subscription entitlement:

 

{

  "request_date": "2023-12-15T19:43:21Z",

  "request_date_ms": 1702669401141,

  "subscriber": {

    "entitlements": {},

    "first_seen": "2023-12-15T19:32:20Z",

    "last_seen": "2023-12-15T19:32:20Z",

    "management_url": null,

    "non_subscriptions": {},

    "original_app_user_id": "823d3d4b-1760-f789-709a-48e47cf96b4e",

    "original_application_version": "1.0",

    "original_purchase_date": "2023-12-15T19:32:46Z",

    "other_purchases": {},

    "subscriber_attributes": {

      "$attConsentStatus": {

        "updated_at_ms": 1702668767953,

        "value": "notDetermined"

      }

    },

    "subscriptions": {}

  }

}

 

I’m assuming that this is returning the non-sandbox data. This was working as expected before and seems to have started failing recently.

Best answer by Haley Pace

Hi, yes this X-Is-Sandbox: true header is necessary if you are using the StoreKit testing framework in order for us to display the StoreKit test transactions in the subscriber object. One thing to note is that when adding the header you need to put the \ at the end of the previous line, ex:

curl --request GET \
    --url https://api.revenuecat.com/v1/subscribers/app_user_id \
    --header 'X-Platform: ios' \
    --header 'accept: application/json' \
    --header 'authorization: Bearer token'\
    --header 'X-Is-Sandbox: true' 

 

 

View original
Did this post help you find an answer to your question?

6 replies

Forum|alt.badge.img+8
  • Author
  • Helper
  • 6 replies
  • December 18, 2023

For more context, when I go into the customer web UI, the customer exists and has no offerings listed UNTIL I check the “Sandbox Data” checkbox. This, I believe, is working as expected. 


Forum|alt.badge.img+8
  • Author
  • Helper
  • 6 replies
  • December 18, 2023

With another user (47faaeaa-0258-01ce-a1dd-371dec351142) I went into the customers web UI and deleted their customer in both live and sandbox mode. Then, locally via xcode, created a fresh app build and subscribed to a product. Still the API returns no entitlements but the UI shows the entitlement when in sandbox mode.

This feels like a real bug and is hindering local development.

{
  "request_date": "2023-12-18T21:54:24Z",
  "request_date_ms": 1702936464429,
  "subscriber": {
    "entitlements": {},
    "first_seen": "2023-12-18T21:52:41Z",
    "last_seen": "2023-12-18T21:52:41Z",
    "management_url": null,
    "non_subscriptions": {},
    "original_app_user_id": "47faaeaa-0258-01ce-a1dd-371dec351142",
    "original_application_version": "1.0",
    "original_purchase_date": "2023-12-18T21:52:48Z",
    "other_purchases": {},
    "subscriber_attributes": {
      "$attConsentStatus": {
        "updated_at_ms": 1702936370843,
        "value": "notDetermined"
      }
    },
    "subscriptions": {}
  }
}

 


Forum|alt.badge.img+8
  • Author
  • Helper
  • 6 replies
  • December 21, 2023

I just got a reply from RevenueCat customer support:
 

We just recently made a change that excludes Xcode transactions from the GET /subscribers endpoint unless you add the X-Is-Sandbox: true header to your request. Once we see that header, we'll also return those transactions.

 

I don’t think I’ve seen this documented anywhere. Hope it helps others.


Forum|alt.badge.img+8
  • RevenueCat Staff
  • 432 replies
  • Answer
  • December 21, 2023

Hi, yes this X-Is-Sandbox: true header is necessary if you are using the StoreKit testing framework in order for us to display the StoreKit test transactions in the subscriber object. One thing to note is that when adding the header you need to put the \ at the end of the previous line, ex:

curl --request GET \
    --url https://api.revenuecat.com/v1/subscribers/app_user_id \
    --header 'X-Platform: ios' \
    --header 'accept: application/json' \
    --header 'authorization: Bearer token'\
    --header 'X-Is-Sandbox: true' 

 

 


  • New Member
  • 1 reply
  • August 5, 2024

Is it expected that the Secret API key should return sandbox purchases if ‘X-Is-Sandbox: true’ is passed in the headers of those requests? It is not working at the moment, and requesting the customer after a webhook is supposedly the official way to handle incoming event hooks. Which means we can’t really do end-to-end testing in the sandbox with webhooks.

For now I’m going to use my Public App-specific API key from the backend, but that seems wrong. Please let me know if I should do something else here, thanks!


Forum|alt.badge.img+1
zac wrote:

Is it expected that the Secret API key should return sandbox purchases if ‘X-Is-Sandbox: true’ is passed in the headers of those requests? It is not working at the moment, and requesting the customer after a webhook is supposedly the official way to handle incoming event hooks. Which means we can’t really do end-to-end testing in the sandbox with webhooks.

For now I’m going to use my Public App-specific API key from the backend, but that seems wrong. Please let me know if I should do something else here, thanks!

I have the same problem 


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