pythonin-app-purchase

Get purchase / subscription info using Apple receipt, server-side, "Original API"


I have looked at previous questions/answers for this, but they point to the now deprecated VerifyReceipt endpoint.

I am trying to get information related to in-app purchases using the receipt that Apple supplies. I am using the original API. The only information that I save is the receipt. I need to be able to do this server side (Python).

I've followed the links from the page above, but they seem to be about validating the original purchase or they link to pages that require a transaction id??

This hasn't been an issue before since the purchases were all one-time purchases, and cancellations weren't an issue. But now that I'll be adding auto-renewable purchases I need to look up if people are renewing or cancelling.

I should upgrade to the new transaction method at some point, but that won't be right away. Hopefully it's not necessary.


Solution

  • Ok, so the old way is deprecated, but still works. I'd still like to know the "proper" way of doing it, but at least for now, this still works:

    import requests 
    
    apple_reciept = <the receipt>
    url = "https://buy.itunes.apple.com/verifyReceipt"
    resp = requests.post(url, data = json.dumps({"receipt-data":apple_receipt}))
    return HttpResponse(resp.text)
    

    Note, I didn't need to include the password (App-Specific Shared Secret) because it's not a renewable purchase.