Client & Server UDP Integration Feedback

Hi, I recently integrated UDP into a Unity project, so I thought I'd share some feedback about some pain points in the process.

Integrating the SDK was very simple with the Unity Package Manager, and the client-side code was also very simple because of how similar it was to the Google In-App Billing logic, which we had implemented previously.

The one thing that caused trouble here was that I was getting AndroidJavaException and a game crash on app launch after integrating the SDK. It turns out that I needed to add this to my proguard file:

-keep class com.unity.udp.** { *; }

I know this is mentioned in the FAQ section, but it seems like either a specific troubleshooting page, or a mention of this in the integration doc would be helpful. I spent a decent chunk of time searching around before I found this bit hiding in the FAQ page.

It would also be great to document what classes need to be added to the proguard file. It wasn't super clear, and I actually had to unzip the AAR files in the package and use a JAR explorer to figure out that the code was in the "com.unity.udp" namespace.

The server-side verification wasn't too bad at all, but the documentation left a few things to be desired:

  • I really appreciated that the docs mentioned what client side PurchaseInfo fields correlated to the request parameters. One small thing is that it mentions the orderQueryToken must be base64 encoded, which makes it sound like I needed to encode it before sending. But actually, the token returned by the client SDK is already encoded, so nothing needs to be done.

  • The documented response parameters are all shown as lowerCamelCase, but I found that the actual service returned UpperCamelCase keys. Using Java, this is case-sensitive, so I had to change my code after trying to test it out. To be fair, the example response later on in the doc does show UpperCamelCase.

  • The documented field "PaidTime" does not seem to have been returned when I was testing. I'm not sure if this field is only returned in production and not sandbox?

  • Some more documentation on the "ChannelType" field would be great. I'm not sure what the valid values are for this. When testing with the sandbox, I got back "Udp" as the value, but I'm not sure what it will return in production. For example, I'm planning to release in the Huawei store, and I don't know if the returned value will be "HUAWEI" or "APPGALLERY" or "HUAWEIAPPGALLERY" or what.

One final thing that might be handy for the server-side docs is recommended logic for validating a purchase. I ended up checking the status order ID, client ID, and product ID fields in the response. It seems like maybe checking channel type and paid time would also be valuable, but I'm not sure if I can use those.


Great thanks for the feedback, I'll share this with our team.