SKPayment.applicationUsername is null

Hello.

If user has no credit card linked to his appstore account.

Inside of application we receive purchase statuses as:


1. Purchasing

2. Failed

3. User input credit card information and confirm purchase

4. Purchasing

5. Purchased


In this case statuses 1, 2 and 4,5 reated to two different transactions as i see.

The problem is we are using applicationUsername field and in this case during second transaction we are loosing information from applicationUsername field bcuz this transation was initiated by apple server.


Question: is my purchase statuses flow correct? if yes, any advice how to not to loose info from applicationUsername field.


Thanks, Alex

Post not yet marked as solved Up vote post of Sasha111ua Down vote post of Sasha111ua
7.3k views

Replies

Just to verify, it appears that you are describing the StoreKit flow scenario, where the addPayment method results in both a failed, then a successful transaction result because of the interruption in the payment process to handle the credit card update / confirm purchase process. As this situation is not one that is reproducible in the sandbox, an application can only demonstrate this case in the production environment. If you are finding that the SKPayment.applicationUsername field is not being maintained at the transaction.payment when the updatedTransactions delegate method is called for the successful transaction, this would seem to be a bug report.


Does your application currently log the applicationUsername field? It would be helpful to include the console log for your app taken when this issue occurs. One way to replicate the StoreKit flow scenario is to install the app, then delete the credit card info associated with the user account. Then run the app and attempt the in app purchase. You can submit the bug report using the Apple Developer Bug Report web page - http://bugreport.apple.com. After submitting the bug report, please send the bug report number to my personal account as listed in my signature, and I'll make sure to forward it to the StoreKit engineers for their review.


rich kubota - rkubota@apple.com

developer technical support CoreOS/Hardware/MFI

As I said in response to your other post, applicationUsername is something you provide to Apple for their use. They do not provide it back to you in the receipt. It would be a great feature - even better if they provided a hash of the applicationUsername (device specific) with some sort of shared secret that only the app and Apple knew; then a receipt could actually be used to securely verify the purchase.

Thanks for your answer. Actually, they provide applicationUsername back in scope of one transaction. But in case i described before, applicationUsername is missing.

applicationUsername is NOT provided as a "field" as you originally wrote - a field is a JSON entry in the receipt.

You are correct though, applicationUsername is a "property" of the payment object which is included as a property of the transaction in the array transactions returned in updatedTransactions. I believe that payment object is not "returned" from StoreKit but rather is a copy of what you entered into the payment object when you registered a paymentRequest - I could be wrong though. The question is, what are you trying to do with the applicationUsername? If it is security I don't think it will work. For many other prucvposes the transactionID or originalTransaction.transactionID serves many useful purposes.

I add applicationUsername value. Send my server for valide the recipe ,after complete in purchase. My server receive appstore valide info,but can not include applicationUsername filed. Are you sure that applicationUsername is returned in valide recipe?

I am sure that applicationUsername field is NOT provided in the receipt.

I have the same problem. second transfication,applicationUsername is nil, how to solve? anyone help me,thanks

I have the same problem too. Sometimes transaction.applicationUserName is nil.Have you solved it?Please help me,thanks