Question

GetOfferings does not work well

  • 2 April 2022
  • 3 replies
  • 143 views

Badge +1

I am trying with UnityPlugin.

I checked on my IOS device and the "GetOfferings" callback is not being called.
What is the cause?

 

purchases.GetOfferings((offerings, error) =>
{
if (error != null)
{
LogError(error);
}
else
{
Debug.Log("offerings received " + offerings.ToString());
var yOffset = 0;

foreach (var package in offerings.Current.AvailablePackages)
{
Debug.Log("Package " + package);
if (package == null) continue;
var label = package.PackageType + " " + package.Product.priceString;
CreateButton(label, () => ButtonClicked(package), 500 + yOffset);
yOffset += 70;
}
}
});

 


3 replies

Userlevel 6
Badge +8

Hey @sifon!

Are you still encountering this issue? If so, debug logs might be a good first step for figuring out what’s happening here.

You can enable debug logs by following this guide. After they're enabled you'll see logs like this in the console:
 

[Purchases] - DEBUG: No cached entitlements, fetching
[Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID> 200
[Purchases] - DEBUG: Purchaser info updated, sending to delegate


Please ensure the debug logs include the entire app life-cycle, including the messages printed during initialization of the SDK. The more information you include here, the better we'll be able to help.

 

Let me know if you have any questions!

Badge +1

Thank you for your reply.
I have not yet been able to solve this problem.

 

The following log will be displayed.


2022-04-08 22:37:22.748570+0900 world[11209:1758748] [Purchases] - DEBUG: ℹ️ Debug logging enabled
2022-04-08 22:37:22.748962+0900 world[11209:1758748] [Purchases] - DEBUG: ℹ️ SDK Version - 3.14.1
2022-04-08 22:37:22.749115+0900 world[11209:1758748] [Purchases] - DEBUG: 👤 Initial App User ID - aaaaa
2022-04-08 22:37:22.756948+0900 world[11209:1758748] [Purchases] - DEBUG: ℹ️ Sending latest PurchaserInfo to delegate.
2022-04-08 22:37:22.759019+0900 world[11209:1758748] [Purchases] - DEBUG: ℹ️ Delegate set
2022-04-08 22:37:22.760005+0900 world[11209:1758748] [Purchases] - DEBUG: ℹ️ Requesting products from the store with identifiers: {(

...

2022-04-08 22:37:23.394074+0900 world[11209:1758930] [Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request GET /subscribers/aaaaa
2022-04-08 22:37:23.394143+0900 world[11209:1758930] [Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/aaaaa
2022-04-08 22:37:23.394849+0900 world[11209:1758930] [Purchases] - DEBUG: ℹ️ There's a request currently running and 0 requests left in the queue, queueing GET /subscribers/aaaaa/offerings
2022-04-08 22:37:23.921869+0900 world[11209:1758929] [Purchases] - DEBUG: ℹ️ Products request finished.
2022-04-08 22:37:23.921969+0900 world[11209:1758929] [Purchases] - DEBUG: 💰 Retrieved SKProducts:
2022-04-08 22:37:23.922060+0900 world[11209:1758929] [Purchases] - DEBUG: 💰 **************** - <SKProduct: 0x282f97d70>
2022-04-08 22:37:23.922129+0900 world[11209:1758929] [Purchases] - DEBUG: ℹ️ 1 completion handlers waiting on products

...

2022-04-08 22:37:25.030631+0900 world[11209:1758930] [Purchases] - DEBUG: ℹ️ API request completed with status: GET /v1/subscribers/aaaaa 304
2022-04-08 22:37:25.037976+0900 world[11209:1758930] [Purchases] - DEBUG: ℹ️ Serial request done: GET /subscribers/aaaaa, 1 requests left in the queue
2022-04-08 22:37:25.038307+0900 world[11209:1758930] [Purchases] - DEBUG: ℹ️ Starting the next request in the queue, <RCHTTPRequest: httpMethod=GET
path=/subscribers/aaaaa/offerings
requestBody=(null)
headers={
Authorization = "Bearer *****";
}
retried=0
>
2022-04-08 22:37:25.040242+0900 world[11209:1758930] [Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request GET /subscribers/aaaaa/offerings
2022-04-08 22:37:25.040488+0900 world[11209:1758930] [Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/aaaaa/offerings
2022-04-08 22:37:25.396062+0900 world[11209:1758929] [Purchases] - DEBUG: ℹ️ API request completed with status: GET /v1/subscribers/aaaaa/offerings 304
2022-04-08 22:37:25.397527+0900 world[11209:1758929] [Purchases] - DEBUG: ℹ️ Serial request done: GET /subscribers/aaaaa/offerings, 0 requests left in the queue

 

Thanks for the report. Revenuecat is returning HTTP/2 304 to a request such as:

https://api.revenuecat.com/v1/subscribers/$RCAnonymousID%xxxxxxxxxxxxxxxxxxxxxxx/offerings

It seems to be intermittent.

304 means "not modified" and it has to do with caching. I was able to manually force a 200 response by removing the "'X-RevenueCat-ETag" header in the request.

 

Maybe replacing this call with:

https://api.revenuecat.com/v2/projects/{project_id}/offerings

 

Could also help

Reply