[Solved] Is Apple receipt supports developerPayload ?

Is Apple receipt supports developerPayload ?

I tried to find answer to you question, and it looks like apple doesn’t support developer payload. I found message from year 2014. It says that Apple doesn’t support developer payload, because Apple recommends to use server-side validation. I didn’t find any informations about developer payload in Apple documentation, but maybe there is something about it and I missed it. Check the message from github (2014y):
https://github.com/onepf/OpenIAB/issues/213

But, why would you need this anyway?

we need other specific user information for receipt validation during recovery.

You do validation only locally?

No, we do server validation

Hi @yuewahchan ,

developerPayload is not supported in Apple receipts.

Can you clarify what you mean by “during recovery”? What other specific user information do you need for receipt validation?

So you can just add informations you want to the receipt, and then send it to your server for validation.

When the iOS purchase in AppStore is succeed, but server receipt validation is failed because of network error or server is down. Then it will be retry later (recovery), but iOS receipt is not allowed to add custom data like GooglePlay receipt.

There is a section in our IAP docs about saving purchase data to the cloud and how to handle that:

“If you are saving consumable purchases to the cloud, you must return PurchaseProcessingResult.Pending and call ConfirmPendingPurchase only when you have successfully persisted the purchase.”

I am talking about the different of iOS receipt and GooglePlay receipt.
GooglePlay receipt contain developer payload
iOS receipt don’t contain developer payload.

Hi @yuewahchan

We can only support features that the stores themselves support. You would have to contact Apple to request developer payload be added to their receipt.

In StoreKit, there is a applicationUsername property in SKPayment, can UnityIAP support this ?

Hi @yuewahchan UnityIAP can be updated to support this for the future.

Notice however this will not give you a “developer payload”. Not like how Google Play gives “developer payload”. I want to ensure you have expectations which are accurate.

Apple applicationUsername string is sent to Apple, and Apple uses this to detect fraud. However, Apple never sends the applicationUsername back from their App Store to the iOS Device.

applicationUsername is kept in storekit transactions inside the device. If you reinstall the app, the data is still there.

@yuewahchan I see now, set in SKPaymentQueue’s “-(void) addPayment:” and received in
SKPaymentTransactionObserver’s “-(void)paymentQueue:updatedTransactions:”
Yes, we could add setting the applicationUsername before a transaction. Thanks for your patience while we add this feature request.

Thank you very much.

Any news on adding the applicationUsername? Our game supports an account with several avatars and if we for any reason miss the Unity Purchasing event for a successful transaction, the user could switch between avatars and we’d provision the transaction to the wrong avatar when we finally do process the purchase.

Hi @cpwfx_work ! Thanks for your interest.

Q: How do you plan on extracting the applicationUsername? Is that through the Apple receipt?

We are testing an update to Unity IAP, 1.11.0, with functionality to set the applicationUsername now.

Here’s a brief snippet showing setting, e.g. the variable value of hashedUsername, as the applicationUsername:
extensions.GetExtension().SetApplicationUsername(hashedUsername);

This will be in the next version of Unity IAP.

@yuewahchan - if developerPayload for GooglePlay is interesting, I realized this is supported already. I apologize for the confusion and misinformation.

https://docs.unity3d.com/ScriptReference/Purchasing.IStoreController.InitiatePurchase.html

There are two-parameter variants of IStoreController.InitiatePurchase() which accept developer payload string as the second parameter. Please use this to set developerPayload for GooglePlay.