I am creating an iPhone application that should process subscriptions through an in app purchase. When I receive a receipt from Apple in my application, I want to save the receipt on my own server and on my server, I also want to check receipt with the Apple server. It is very important that this connection with my server is made, as this saves the user information that will be needed later.
In my SKPaymentTransactionObserver, now I'm trying to call my server on SKPaymentTransactionStatePurchased. The problem is that on SKPaymentTransactionStatePurchased there seems to be a standard βThank youβ warning and that the purchase is complete. Since the application must contact my server, this standard warning is displayed before the call to my server is completed, and what happens if the user leaves the application here, he thinks that the purchase is completed as she said? When should I contact my server? And if I want to show a warning to the user when my server call is completed, when should I do it?
This is the code I'm using:
//This is called on "SKPaymentTransactionStatePurchased" - (void) completeTransaction: (SKPaymentTransaction *)transaction { [self saveAndVerifyOnServer:transaction]; [[SKPaymentQueue defaultQueue] finishTransaction: transaction]; }
source share