j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.3k stars 537 forks source link

[IOS] is it possible to retrieve a history of consumables / renewable subscriptions transactions? #1251

Open vesper8 opened 2 years ago

vesper8 commented 2 years ago

I'm still in Sandbox mode right now, and I understand how important it is to keep a log of every transaction. And I have built these mechanisms. But I also have now truncated these tables since I'm still developing and testing and I find myself in a position where I know this particular user has purchases multiple consumables, and currently has one of the renewable-subscriptions set to owned. But I do not have any records of these on my back-end.. because I purposefully truncated that data.

I'm just curious, without a log of transaction receipts or transaction ids or anything basically.. is it possible to retrieve a history of transactions for a given user?

I would like to know for example what is the expiry date for the currently owned renewable subscription.

And I would like to see how many consumables this user has purchased.

If I don't have the log.. is this data available anywhere else?

Is it also possible to have a little more visibility on transactions performed inside the sandbox environment? I can't seem to find that anywhere on appstoreconnect

Many thanks

j3k0 commented 2 years ago

Unfortunately purchases of consumable are not kept in the receipt. You need to implement this yourself.

If you're OK with using a external service, Fovea's https://billing.fovea.cc will do the job for you and let you get access the list of transactions for your users as well as the status of subscriptions.

Of course that is something you can re-implement yourself if you want to. However, once your database is gone you'll loose the history of purchases. Alternatively the last state can be checked by validating the receipt with Apple servers.

vesper8 commented 2 years ago

Thank you for the clarification @j3k0

Unfortunately my client insists on us building all this infrastructure in-house because they intend to re-use it on other projects, so using https://billing.fovea.cc is not currently an option even though I've tried suggesting it.

I'm curious, if I want to access these two endpoints https://developer.apple.com/documentation/appstoreserverapi/get_transaction_history and https://developer.apple.com/documentation/appstoreserverapi/get_all_subscription_statuses

It seems pretty straightforward, I do have the original_transaction_id that these endpoints require, but I'm unsure which JWT token I need to supply exactly. I assume this package is already configure with this JWT token. Can I either, access the above two endpoints via this package (sorry if this is already explained, I haven't found it yet) or can I have access to the JWT token so I can make my own calls to these endpoints?

Many thanks!

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.