Solved

V1 API not returning sandbox data

  • 15 December 2023
  • 4 replies
  • 110 views

Badge +7

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.

icon

Best answer by Haley Pace 22 December 2023, 00:20

View original

4 replies

Badge +7

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. 

Badge +7

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": {}
}
}

 

Badge +7

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.

Userlevel 4
Badge +8

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'

 

 

Reply