Link an in-app purchase to user apple account












3















I'm looking for a way to link an in-app purchase (non-renewable subscription) to the user apple account, because my app doesn't have account system, and obviously I want the user to keep his subscription.



I read that we can't get the Apple ID, but I think there is a way to do it because most of iOS apps can save datas with your Apple account.



Thanks for your answers.










share|improve this question























  • what do you mean link in-app? you just linked with your apple iTunes connect account with current app identifier.

    – Nitin Gohel
    Sep 11 '15 at 10:45











  • I already created in-app purchases in itunes connect, I mean save purchases when user buy an object.

    – Karz
    Sep 11 '15 at 11:21











  • Are you asking about restoring purchases?

    – Pascal
    Sep 11 '15 at 14:03
















3















I'm looking for a way to link an in-app purchase (non-renewable subscription) to the user apple account, because my app doesn't have account system, and obviously I want the user to keep his subscription.



I read that we can't get the Apple ID, but I think there is a way to do it because most of iOS apps can save datas with your Apple account.



Thanks for your answers.










share|improve this question























  • what do you mean link in-app? you just linked with your apple iTunes connect account with current app identifier.

    – Nitin Gohel
    Sep 11 '15 at 10:45











  • I already created in-app purchases in itunes connect, I mean save purchases when user buy an object.

    – Karz
    Sep 11 '15 at 11:21











  • Are you asking about restoring purchases?

    – Pascal
    Sep 11 '15 at 14:03














3












3








3








I'm looking for a way to link an in-app purchase (non-renewable subscription) to the user apple account, because my app doesn't have account system, and obviously I want the user to keep his subscription.



I read that we can't get the Apple ID, but I think there is a way to do it because most of iOS apps can save datas with your Apple account.



Thanks for your answers.










share|improve this question














I'm looking for a way to link an in-app purchase (non-renewable subscription) to the user apple account, because my app doesn't have account system, and obviously I want the user to keep his subscription.



I read that we can't get the Apple ID, but I think there is a way to do it because most of iOS apps can save datas with your Apple account.



Thanks for your answers.







ios iphone in-app-purchase






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 11 '15 at 10:37









KarzKarz

251317




251317













  • what do you mean link in-app? you just linked with your apple iTunes connect account with current app identifier.

    – Nitin Gohel
    Sep 11 '15 at 10:45











  • I already created in-app purchases in itunes connect, I mean save purchases when user buy an object.

    – Karz
    Sep 11 '15 at 11:21











  • Are you asking about restoring purchases?

    – Pascal
    Sep 11 '15 at 14:03



















  • what do you mean link in-app? you just linked with your apple iTunes connect account with current app identifier.

    – Nitin Gohel
    Sep 11 '15 at 10:45











  • I already created in-app purchases in itunes connect, I mean save purchases when user buy an object.

    – Karz
    Sep 11 '15 at 11:21











  • Are you asking about restoring purchases?

    – Pascal
    Sep 11 '15 at 14:03

















what do you mean link in-app? you just linked with your apple iTunes connect account with current app identifier.

– Nitin Gohel
Sep 11 '15 at 10:45





what do you mean link in-app? you just linked with your apple iTunes connect account with current app identifier.

– Nitin Gohel
Sep 11 '15 at 10:45













I already created in-app purchases in itunes connect, I mean save purchases when user buy an object.

– Karz
Sep 11 '15 at 11:21





I already created in-app purchases in itunes connect, I mean save purchases when user buy an object.

– Karz
Sep 11 '15 at 11:21













Are you asking about restoring purchases?

– Pascal
Sep 11 '15 at 14:03





Are you asking about restoring purchases?

– Pascal
Sep 11 '15 at 14:03












3 Answers
3






active

oldest

votes


















1














If you don't have your own account system (where the user can login etc), you can check the user's purchases for your app from the purchase receipt:



https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Introduction.html



Getting personal information like AppleID etc is not possible from the SDK.






share|improve this answer
























  • It seems to be very difficult with encryption, thank you for your answer

    – Karz
    Sep 11 '15 at 11:21



















0














You should keep track of already purchased products in your app yourself. I usually use [[NSUserDefaults standardUserDefaults] setBool:YES forKey:productIdentifier] for this.



The problem arises when your users reinstalls your app or buys a new device. In this case you must implement a way to restore the purchased products.



The In-App Purchase Programmering Guide states that one way to implement this is by calling [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]. This sends a request to the App Store to restore all of your app’s completed transactions.



Then paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions of your transaction observer will be called and transactions holds the restored products. My function usually looks something like this:



- (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];
break;
case SKPaymentTransactionStateRestored:
[self restoreTransaction:transaction];
default:
break;
}
};
}`


Complete the restoration process (providing content, update NSUserDefaults etc.) in restoreTransaction.






share|improve this answer
























  • Thanks for your help, but the problem is that I want to know if the user already bought products without going in the in-app view controller

    – Karz
    Sep 11 '15 at 12:57











  • The code for checking if the product is already bought or not shouldn't have anything to do with the view controller. It may be located in the view controller but most developers agree that it's good practice to separate the code that present the view from the business logic. That said, the code in the answer could/should be in its own class (together with the rest of the in-app purchase logic) and you should be able to use its features from anywhere in your code. Even before going into the view controller.

    – Markus
    Sep 11 '15 at 15:05





















0














For non-renewal subscription you have to manually store the expiry date somewhere because Apple does not manages it for non-renewal.



I had implemented this feature in one of my application where after subscription I used to store the expire date on server and app will check for expire date while accessing paid features.



If found expired, app will ask to purchase subscription again.



Reference link:
https://developer.apple.com/library/mac/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/CreatingInAppPurchaseProducts.html#//apple_ref/doc/uid/TP40013727-CH3-SW1



https://www.progressconcepts.com/blog/non-renewing-subscription-app-purchases-ios/



Hope this helps.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32521454%2flink-an-in-app-purchase-to-user-apple-account%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    If you don't have your own account system (where the user can login etc), you can check the user's purchases for your app from the purchase receipt:



    https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Introduction.html



    Getting personal information like AppleID etc is not possible from the SDK.






    share|improve this answer
























    • It seems to be very difficult with encryption, thank you for your answer

      – Karz
      Sep 11 '15 at 11:21
















    1














    If you don't have your own account system (where the user can login etc), you can check the user's purchases for your app from the purchase receipt:



    https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Introduction.html



    Getting personal information like AppleID etc is not possible from the SDK.






    share|improve this answer
























    • It seems to be very difficult with encryption, thank you for your answer

      – Karz
      Sep 11 '15 at 11:21














    1












    1








    1







    If you don't have your own account system (where the user can login etc), you can check the user's purchases for your app from the purchase receipt:



    https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Introduction.html



    Getting personal information like AppleID etc is not possible from the SDK.






    share|improve this answer













    If you don't have your own account system (where the user can login etc), you can check the user's purchases for your app from the purchase receipt:



    https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Introduction.html



    Getting personal information like AppleID etc is not possible from the SDK.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 11 '15 at 10:47









    VrasidasVrasidas

    1,82611119




    1,82611119













    • It seems to be very difficult with encryption, thank you for your answer

      – Karz
      Sep 11 '15 at 11:21



















    • It seems to be very difficult with encryption, thank you for your answer

      – Karz
      Sep 11 '15 at 11:21

















    It seems to be very difficult with encryption, thank you for your answer

    – Karz
    Sep 11 '15 at 11:21





    It seems to be very difficult with encryption, thank you for your answer

    – Karz
    Sep 11 '15 at 11:21













    0














    You should keep track of already purchased products in your app yourself. I usually use [[NSUserDefaults standardUserDefaults] setBool:YES forKey:productIdentifier] for this.



    The problem arises when your users reinstalls your app or buys a new device. In this case you must implement a way to restore the purchased products.



    The In-App Purchase Programmering Guide states that one way to implement this is by calling [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]. This sends a request to the App Store to restore all of your app’s completed transactions.



    Then paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions of your transaction observer will be called and transactions holds the restored products. My function usually looks something like this:



    - (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];
    break;
    case SKPaymentTransactionStateRestored:
    [self restoreTransaction:transaction];
    default:
    break;
    }
    };
    }`


    Complete the restoration process (providing content, update NSUserDefaults etc.) in restoreTransaction.






    share|improve this answer
























    • Thanks for your help, but the problem is that I want to know if the user already bought products without going in the in-app view controller

      – Karz
      Sep 11 '15 at 12:57











    • The code for checking if the product is already bought or not shouldn't have anything to do with the view controller. It may be located in the view controller but most developers agree that it's good practice to separate the code that present the view from the business logic. That said, the code in the answer could/should be in its own class (together with the rest of the in-app purchase logic) and you should be able to use its features from anywhere in your code. Even before going into the view controller.

      – Markus
      Sep 11 '15 at 15:05


















    0














    You should keep track of already purchased products in your app yourself. I usually use [[NSUserDefaults standardUserDefaults] setBool:YES forKey:productIdentifier] for this.



    The problem arises when your users reinstalls your app or buys a new device. In this case you must implement a way to restore the purchased products.



    The In-App Purchase Programmering Guide states that one way to implement this is by calling [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]. This sends a request to the App Store to restore all of your app’s completed transactions.



    Then paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions of your transaction observer will be called and transactions holds the restored products. My function usually looks something like this:



    - (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];
    break;
    case SKPaymentTransactionStateRestored:
    [self restoreTransaction:transaction];
    default:
    break;
    }
    };
    }`


    Complete the restoration process (providing content, update NSUserDefaults etc.) in restoreTransaction.






    share|improve this answer
























    • Thanks for your help, but the problem is that I want to know if the user already bought products without going in the in-app view controller

      – Karz
      Sep 11 '15 at 12:57











    • The code for checking if the product is already bought or not shouldn't have anything to do with the view controller. It may be located in the view controller but most developers agree that it's good practice to separate the code that present the view from the business logic. That said, the code in the answer could/should be in its own class (together with the rest of the in-app purchase logic) and you should be able to use its features from anywhere in your code. Even before going into the view controller.

      – Markus
      Sep 11 '15 at 15:05
















    0












    0








    0







    You should keep track of already purchased products in your app yourself. I usually use [[NSUserDefaults standardUserDefaults] setBool:YES forKey:productIdentifier] for this.



    The problem arises when your users reinstalls your app or buys a new device. In this case you must implement a way to restore the purchased products.



    The In-App Purchase Programmering Guide states that one way to implement this is by calling [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]. This sends a request to the App Store to restore all of your app’s completed transactions.



    Then paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions of your transaction observer will be called and transactions holds the restored products. My function usually looks something like this:



    - (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];
    break;
    case SKPaymentTransactionStateRestored:
    [self restoreTransaction:transaction];
    default:
    break;
    }
    };
    }`


    Complete the restoration process (providing content, update NSUserDefaults etc.) in restoreTransaction.






    share|improve this answer













    You should keep track of already purchased products in your app yourself. I usually use [[NSUserDefaults standardUserDefaults] setBool:YES forKey:productIdentifier] for this.



    The problem arises when your users reinstalls your app or buys a new device. In this case you must implement a way to restore the purchased products.



    The In-App Purchase Programmering Guide states that one way to implement this is by calling [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]. This sends a request to the App Store to restore all of your app’s completed transactions.



    Then paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions of your transaction observer will be called and transactions holds the restored products. My function usually looks something like this:



    - (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];
    break;
    case SKPaymentTransactionStateRestored:
    [self restoreTransaction:transaction];
    default:
    break;
    }
    };
    }`


    Complete the restoration process (providing content, update NSUserDefaults etc.) in restoreTransaction.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Sep 11 '15 at 11:38









    MarkusMarkus

    5522518




    5522518













    • Thanks for your help, but the problem is that I want to know if the user already bought products without going in the in-app view controller

      – Karz
      Sep 11 '15 at 12:57











    • The code for checking if the product is already bought or not shouldn't have anything to do with the view controller. It may be located in the view controller but most developers agree that it's good practice to separate the code that present the view from the business logic. That said, the code in the answer could/should be in its own class (together with the rest of the in-app purchase logic) and you should be able to use its features from anywhere in your code. Even before going into the view controller.

      – Markus
      Sep 11 '15 at 15:05





















    • Thanks for your help, but the problem is that I want to know if the user already bought products without going in the in-app view controller

      – Karz
      Sep 11 '15 at 12:57











    • The code for checking if the product is already bought or not shouldn't have anything to do with the view controller. It may be located in the view controller but most developers agree that it's good practice to separate the code that present the view from the business logic. That said, the code in the answer could/should be in its own class (together with the rest of the in-app purchase logic) and you should be able to use its features from anywhere in your code. Even before going into the view controller.

      – Markus
      Sep 11 '15 at 15:05



















    Thanks for your help, but the problem is that I want to know if the user already bought products without going in the in-app view controller

    – Karz
    Sep 11 '15 at 12:57





    Thanks for your help, but the problem is that I want to know if the user already bought products without going in the in-app view controller

    – Karz
    Sep 11 '15 at 12:57













    The code for checking if the product is already bought or not shouldn't have anything to do with the view controller. It may be located in the view controller but most developers agree that it's good practice to separate the code that present the view from the business logic. That said, the code in the answer could/should be in its own class (together with the rest of the in-app purchase logic) and you should be able to use its features from anywhere in your code. Even before going into the view controller.

    – Markus
    Sep 11 '15 at 15:05







    The code for checking if the product is already bought or not shouldn't have anything to do with the view controller. It may be located in the view controller but most developers agree that it's good practice to separate the code that present the view from the business logic. That said, the code in the answer could/should be in its own class (together with the rest of the in-app purchase logic) and you should be able to use its features from anywhere in your code. Even before going into the view controller.

    – Markus
    Sep 11 '15 at 15:05













    0














    For non-renewal subscription you have to manually store the expiry date somewhere because Apple does not manages it for non-renewal.



    I had implemented this feature in one of my application where after subscription I used to store the expire date on server and app will check for expire date while accessing paid features.



    If found expired, app will ask to purchase subscription again.



    Reference link:
    https://developer.apple.com/library/mac/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/CreatingInAppPurchaseProducts.html#//apple_ref/doc/uid/TP40013727-CH3-SW1



    https://www.progressconcepts.com/blog/non-renewing-subscription-app-purchases-ios/



    Hope this helps.






    share|improve this answer




























      0














      For non-renewal subscription you have to manually store the expiry date somewhere because Apple does not manages it for non-renewal.



      I had implemented this feature in one of my application where after subscription I used to store the expire date on server and app will check for expire date while accessing paid features.



      If found expired, app will ask to purchase subscription again.



      Reference link:
      https://developer.apple.com/library/mac/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/CreatingInAppPurchaseProducts.html#//apple_ref/doc/uid/TP40013727-CH3-SW1



      https://www.progressconcepts.com/blog/non-renewing-subscription-app-purchases-ios/



      Hope this helps.






      share|improve this answer


























        0












        0








        0







        For non-renewal subscription you have to manually store the expiry date somewhere because Apple does not manages it for non-renewal.



        I had implemented this feature in one of my application where after subscription I used to store the expire date on server and app will check for expire date while accessing paid features.



        If found expired, app will ask to purchase subscription again.



        Reference link:
        https://developer.apple.com/library/mac/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/CreatingInAppPurchaseProducts.html#//apple_ref/doc/uid/TP40013727-CH3-SW1



        https://www.progressconcepts.com/blog/non-renewing-subscription-app-purchases-ios/



        Hope this helps.






        share|improve this answer













        For non-renewal subscription you have to manually store the expiry date somewhere because Apple does not manages it for non-renewal.



        I had implemented this feature in one of my application where after subscription I used to store the expire date on server and app will check for expire date while accessing paid features.



        If found expired, app will ask to purchase subscription again.



        Reference link:
        https://developer.apple.com/library/mac/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/CreatingInAppPurchaseProducts.html#//apple_ref/doc/uid/TP40013727-CH3-SW1



        https://www.progressconcepts.com/blog/non-renewing-subscription-app-purchases-ios/



        Hope this helps.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 11 '15 at 13:48









        Dharmesh SiddhpuraDharmesh Siddhpura

        1,236818




        1,236818






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f32521454%2flink-an-in-app-purchase-to-user-apple-account%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            List item for chat from Array inside array React Native

            Thiostrepton

            Caerphilly