An empty developer Payload in Google's Notification for Subscription

Hi

I used the following codes to upgrade or downgrade subscription for Google in Unity IAP v2.1.1

But I found the developerPayload was empty in Google’s Server notification when receiving the

auto-renewable subscription of notification.

Please check the following codes and kindly point out the problem.

Dictionary<string, string> payload_dictionary = new Dictionary<string, string>();
payload_dictionary["developerPayload"] = userID;

// Upgrade / Downgrade
Action<string, string> googlePlayCallback = new Action<string, string>(googlePlayStoreExtensions.UpgradeDowngradeSubscription);
SubscriptionManager.UpdateSubscription(newProduct, oldProduct, MiniJson.JsonEncode(payload_dictionary), null, googlePlayCallback);

The empty developerPayload in Google’s Server notification is shown below.

{\"developerPayload\":\"\",\"is_free_trial\":false,\"has_introductory_price_trial\":false,\"is_updated\":true,\"update_subscription_metadata\":\"{\\\"old_sku_remaining_seconds\\\":2678374,\\\"old_sku_price_in_micros\\\":420000000,\\\"old_sku_period_string\\\":\\\"P1M\\\",\\\"new_sku_price_in_micros\\\":120000000}\",\"accountId\":\"\"}

We have aware of this problem and currently investigating it. In addition, could you double-check the IAP version you are using? The lasted IAP version should be 2.1.0 for now. Thanks.

Hi SamOYUnity3D,

I tested it with Unity IAP v2.00 and v2.1.0 and found the same problem.
If you have any update on this issue, please notify me.

Thanks.

Can you describe how you are using the DeveloperPayload? The stores are moving towards removing this feature.

Hi JeffDUnity3D,

I used it for validating Google’s Server Notification on the server-side while having a subscription upgraded or downgraded.

Step:

  1. On the client-side, purchase the subscription A, and then set UserID in DeveloperPayload and upgrade to subscription B.
  2. At the same time, the server will receive Google’s Server Notification when having a subscription upgraded.
  3. The server can carefully validate UserID in DeveloperPayload and purchase token to ensure this userID did purchase a subscription.
  4. The server can update the subscription state properly for this User in DB.

It is better to be able to get UserID from DeveloperPayload in Server Notification because the server does not know the received purchase token in Google’s Server Notification belonging to which user.

Note:
This problem only occurred in upgrade/downgrade subscription while purchasing a subscription is fine.