Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restoring subscribed purchase for Auto-Renewable Subscriptions

When I purchase a previously purchased "Auto-Renewable Subscriptions" in my app, it said

You're currently subscribed to this...

When I clicked the OK, in the delegate of the payment queue..

- (void) paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
    for (SKPaymentTransaction * transaction in transactions)
    {
        switch (transaction.transactionState)
        {
            case SKPaymentTransactionStatePurchased:
                [self completeTransaction:transaction];
                break;
            case SKPaymentTransactionStateFailed:
                [self failedTransaction:transaction]; // Why this is called?
                break;
            case SKPaymentTransactionStateRestored:
                [self restoreTransaction:transaction];
            default:
                break;
        }
    }
}

The transaction.transactionState returned is SKPaymentTransactionStateFailed instead of SKPaymentTransactionStateRestored, is it normal?

So how do I handle this correctly?

like image 444
Howard Avatar asked Jan 27 '12 14:01

Howard


People also ask

How do I restore my subscription?

Make sure the device is logged in with the Google Play Store Account that made the original purchase. - Tap on the Menu, accounts, then Subscriptions. Make sure the device is logged in with the Google Play Store Account that made the original purchase. Tap on the ''Restore Purchases'' button.

What are auto-renewable subscriptions?

Auto-renewable subscriptions provide access to content, services, or premium features in your app on an ongoing basis. They automatically renew at the end of their duration until the user chooses to cancel.

What time does Apple renew subscriptions?

The subscription renewal process begins in the 10 days before the expiration date. During those 10 days, the App Store checks for any billing issues that might delay or prevent the subscription from being automatically renewed, for example, whether: The customer's payment method is active.


2 Answers

I have the same issue and I don't think there's any way to distinguish this event from other errors (it returns error code SKErrorPaymentCancelled). I think the only way you can handle it is by having a "Restore Purchases" button, and call [[SKPaymentQueue defaultQueue] restoreCompletedTransactions] when the user presses it.

like image 183
dwyw Avatar answered Oct 11 '22 14:10

dwyw


Actually, you can't determine if the user is already subscribed. You should have Subscribe button that new users use to subscribe, and Restore button for already subscribed users.

And when you get SKPaymentTransactionStateFailed you can show a message that suggests to use Restore button in case the user is already subscribed.

like image 37
Hejazi Avatar answered Oct 11 '22 14:10

Hejazi