none
Using CurrentApp.GetAppReceiptAsync() to determine if app previously paid for

    General discussion

  • I am trying to shift my app from a free trial / purchase model, to a free / in-app purchase model. I am thinking about using CurrentApp.GetAppReceiptAsync() to get an XML based receipt, indicating the purchase date for the app for a user. The receipt should look something like the following:


    <Receipt Version="1.0" ReceiptDate="2012-08-30T23:10:05Z" CertificateId="b809e47cd0110a4db043b3f73e83acd917fe1336" ReceiptDeviceId="4e362949-acc3-fe3a-e71b-89893eb4f528">
     <AppReceipt Id="8ffa256d-eca8-712a-7cf8-cbf5522df24b" AppId="55428GreenlakeApps.CurrentAppSimulatorEventTest_z7q3q7z11crfr" PurchaseDate="2012-06-04T23:07:24Z" LicenseType="Full" />
     <ProductReceipt Id="6bbf4366-6fb2-8be8-7947-92fd5f683530" ProductId="Product1" PurchaseDate="2012-08-30T23:08:52Z" ExpirationDate="2012-09-02T23:08:49Z" ProductType="Durable" AppId="55428GreenlakeApps.CurrentAppSimulatorEventTest_z7q3q7z11crfr" />
     <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
      <SignedInfo>
       <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
       <SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
       <Reference URI="">
        <Transforms>
         <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
        </Transforms>
        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
        <DigestValue>cdiU06eD8X/w1aGCHeaGCG9w/kWZ8I099rw4mmPpvdU=</DigestValue>
       </Reference>
      </SignedInfo>
      <SignatureValue>SjRIxS/2r2P6ZdgaR9bwUSa6ZItYYFpKLJZrnAa3zkMylbiWjh9oZGGng2p6/gtBHC2dSTZlLbqnysJjl7mQp/A3wKaIkzjyRXv3kxoVaSV0pkqiPt04cIfFTP0JZkE5QD/vYxiWjeyGp1dThEM2RV811sRWvmEs/hHhVxb32e8xCLtpALYx3a9lW51zRJJN0eNdPAvNoiCJlnogAoTToUQLHs72I1dECnSbeNPXiG7klpy5boKKMCZfnVXXkneWvVFtAA1h2sB7ll40LEHO4oYN6VzD+uKd76QOgGmsu9iGVyRvvmMtahvtL1/pxoxsTRedhKq6zrzCfT8qfh3C1w==</SignatureValue>
     </Signature>
    </Receipt>


    The above receipt was taken from here. I have a number of questions.

    1) Does the version number at the top of the receipt refer to the version of my app, when the app was bought?

    2) When a user receives the upgrade of my app with the new free / in-app purchase model, will the store generate an app receipt for the new version of the app, if the app was not previously purchased?

    What I'd like my app to essentially do, is check to see if the in-app product I'm selling is active. If it is not, check the app's receipt to see if the app was purchased in a previous version. If both are not true, require the user to purchase the in-app product, otherwise grant the user access to the in-app product.

    Note: assuming the answers to my questions above are true, all I'll have to do is check the version number in the receipt for my app, to see if my app was paid for by a user, prior to switching over to the new free / in-app purchase model.

    • Edited by PDoug Thursday, March 27, 2014 3:51 PM
    Thursday, March 27, 2014 3:34 PM