Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8034175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:55:40+00:00 2026-06-05T01:55:40+00:00

This problem has been giving me headaches for a while now. My app operates

  • 0

This problem has been giving me headaches for a while now.

My app operates on an auto-renewable subscription model. I have an SKPaymentQueue transactionObserver that is notified when a purchase is successfully completed through Apple, and at this point I send the Apple receipt to my server to verify on my end. Once I verify it, I send a success call back to my app which provides the content to the user and subsequently calls finishTransaction: on the transaction (which according to the docs is the proper course of actions).

The problem is, I’m afraid waiting this long to call finishTransaction: after Apple expects it to be called (3-4 seconds) is prohibiting the transaction from actually “finishing”. If I successfully make a purchase within my app (and finishTransaction: has been called), and then terminate my app (“stop” in Xcode) and run it again, immediately on startup there will be one, two, three, and sometimes four or five transactions in the SKPaymentQueue before the UI has even loaded.

Here is the call to my server which takes place after the transaction is completed with Apple
:

-(void)completeTransaction:(SKPaymentTransaction *)transaction
{
    NSLog(@"complete transaction");
    [self sendReceiptToServer:transaction];
}

-(void)sendReceiptToServer:(SKPaymentTransaction*)transaction
{
    NSString *rawReceiptData = [[NSString alloc] initWithData:transaction.transactionReceipt encoding:NSUTF8StringEncoding];
    NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:rawReceiptData, @"receipt", [[UserSingleton sharedInstance] memberID], @"member", nil];

    NSMutableURLRequest *request = [[HTTPRequestSingleton sharedClient] requestWithMethod:@"POST" path:cFunctionAddCredits parameters:params];   
    AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {

        NSLog(@"%@", JSON);
        NSString *creditsString = [JSON valueForKey:@"limit"];
        int numberOfCredits = [creditsString intValue];
        [self provideContent:transaction.payment.productIdentifier withNumberOfCredits:numberOfCredits];
        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];

    } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON) {
        NSLog(@"failed to send receipt to server");  
        [[NSNotificationCenter defaultCenter] postNotificationName:cFailedToSendReceiptToServer object:transaction];
        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];

    }];

    [operation start];
}

As you can see, [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; gets called within the success or failure blocks of the request to my server. Could this be problematic somehow?

*EDIT*
It seems this issue does not occur if I call SKPaymentQueue:finishTransaction: BEFORE sending the receipt to my server for verification, which leads me to believe that calling it within the network request blocks is indeed causing the problem. But this is not the correct way to handle things, so I’m still stuck.

*EDIT 2*
Turns out the transactions sometimes still get “revived” when starting up the app, even if I make the finishTransaction: call before sending the receipt to my server. What’s going on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:55:42+00:00Added an answer on June 5, 2026 at 1:55 am

    After weeks of “phantom” purchases, I’ve finally realized what is going on. It wasn’t the fault of finishTransaction: or AFNetworking.

    The transactions that were occurring at app launch were actually part of the auto-renewal process that Apple was performing. The life of a 1 month subscription in the Apple Sandbox is 5 minutes, so I would have 1, 2, or 3 transactions in the queue when launching my app depending upon whether it has been 5, 10, or 15 minutes since I launched it last.

    I had to tweak some server-side settings to make sure the renewals weren’t being treated the same as fresh subscriptions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This Jquery problem has been bugging me for a while now. I developed a
I have been stuck with this problem for a while now, and I just
This problem has been confusing me for days now. I have an NSString, 'spriteType'.
This problem has bugged me so many times and i have now decided to
So this Python problem has been giving me problems since I've tried refactoring the
This has been a real problem for me with sed. I have an original
This problem has been solved! Thanks a lot to Brad, Denis and junkie! You're
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
UPDATE It looks like this problem has been quietly fixed in iOS 4.3. Up
Edit : The bug that caused this problem has been fixed. The @version tag

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.