Why the same transaction get twice update notify?

I only call the following code once


[[SKPaymentQueue defaultQueue] addTransactionObserver:self];


but on iOS 10.0.1 sometimes I can get twice notify in


- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions


to be noted, not two transactions at the same time, but get one then the other in the following 2~3 seconds.


Followd by my log,


// the first time get updateTransactions
2017-03-22 14:22:31.519416 Log get update transactions in paymentQueue:updateTransactions:
(
    "<SKPaymentTransaction: 0x170017d30>"
)


2017-03-22 14:22:31.697127 Log Transaction 1000000283812553 of product com.tencent.pay.test1 has been finished


// the second time get updateTransactions
2017-03-22 14:22:33.992336 Log get update transactions in paymentQueue:updateTransactions:
(
    "<SKPaymentTransaction: 0x17001b130>"
)


2017-03-22 14:22:34.073377 Log Transaction 1000000283812553 of product com.tencent.pay.test1 has been finished


We can notice that ,we got different SKPaymentTransaction objects, which have different memory addresses, but the transactionIdentifier and productIdentifier is the same, even after I've called finishTransaction: after I've got the first notify.


Why is that ? Anyone has the same problem here?

either

1) The first one has a value of transaction.transactionState of SKPaymentTransactionStatePurchasing and can be ignored.

or

2) if you are already ignoring transactionState purchasing then the first transaction is from a left over transaction for which you did not call finishTransaction.

We're sure that it's not an SKPaymentTransactionStatePurchasing state transaction.


When there is an unfinished trasaction of a product identifier of p1, should p1 not allowed to make another new purchase, insteading, an alert box will show the user that it will be restored freely? So there might not be two transactions with same transaction identifier of the same product identifier.


So, it may now disabey the princeples of In App Purchase.

p1?

So, it may now disabey the princeples of In App Purchase.?????



You can have multiple failed transactions followed by a purchased transaction. You can have multiple purchased transactions for a consumable. You can have multiple users.....

But here we got two transactions with the same product identifier , and the same transaction identifier, and the same transaction receipt, which means, I should send the receipt twice to our backend, is this normal?

What are their SKPaymentTransactionState's?

If the first is "failed" and the second is "purchased" that's a user who had to update their credit card information. You can ignore the first since it is "failed".

Both state of the two transactions is SKPaymentTransactionPurchased😕

See above:

2) if you are already ignoring transactionState purchasing then the first transaction is from a left over transaction for which you did not call finishTransaction.

I'm afraid not, the first time when we fail to deliver game coins according to transaction receipt, we shouldn't finish transactions, we just wait the App next launch then waiting notify in paymentQueue:transactions:, most of times it did act normal, in which case only 1 transaction notify wound have been received. But some times, we receive twice notify, like I was said.

You wrote:


>we shouldn't finish transactions


Are you sure?

Maybe I haven't made my self clear.


What I mean we shouldn't finish transaction is that when we fail to deliver product to user, we should rely on IAP's notification mechnism and don't have to finish the transaction, just wait the next App launch to deliver product again, then if we deliver it successfully, we finish the transaction.

You absolutely have not made yourself clear as I indicated in my second post.

If you have multiple calls to updatedTransactions then search for code conditions under which you did not call finishTransactions.

Yes, you may rely upon StoreKit to clean up your apps failure to fully respond to a transaction - Apple thinks tht's a good idea, I respectfully disagree.

Expect two transactions when the user has to update their credit card information and then makes a purchase - one failed followed by one purchased.

You said at a former post that 'If the first is "failed" and the second is "purchased" that's a user who had to update their credit card information. You can ignore the first since it is "failed".', but here we got two transactions with the same product identifier , the same transaction identifier, the same transaction receipt, and the most important, with the same transaction state of PaymentTransactionPurchased.


Btw, this is in sandbox environment. Don't know if this will happend in production environment.

Why the same transaction get twice update notify?
 
 
Q