-
Again and again, thanks so much for this package you have provided for the community. As you know, when an in-app purchase is done, we should update the client records in our database, even create an invoice, renew the subscription, or send an email. How it is possible, to send and receive the client_id from the mobile to the backend with the In-app Events? If this isn't possible, is there any workaround solution you have worked on? I was thinking, about after the purchase is done, the mobile app sends a post request to the backend with the subscription id and the client id. Do not know if this is an efficient solution? Moreover, what is a receipt? it is a unique identifier? or what it is? `use Imdhemy\Purchases\Facades\Subscription; $receiptResponse = Subscription::appStore()->receiptData($receipt)->verifyRenewable(); Regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Thank you for your nice words. I'm glad you like it. Regarding your question: It would be better if the providers were allowed to add some payload to the receipt data, As far as I know, Google used to allow this, but it stopped. And even more, sometimes both of them (Google and Apple) don't send the initial purchase event. I don't know why, but it happens. Proposed solution As you mentioned, I think the best solution is to receive the receipt data from the mobile application once the user has purchased the product, and then use the Facades ( You can follow the steps in the documentation Note - $receiptResponse = Subscription::appStore()->receiptData($receipt)->verifyRenewable();
+ $receiptResponse = Subscription::appStore()->receiptData($receipt)->verify(); What is a $receipt The How to identify a subscription The $user = $request->user(); // or any other way to get the active user
$transactionId = $receiptInfo->getTransactionId();
$originalTransactionId = $receiptInfo->getOriginalTransactionId();
$productId = $receiptInfo->getProductId(); // The same accessor for (Apple) products and subscriptions
// Check if the user has already purchased the product
// Do whatever to maintain your DB consistency
// Entitle the user to the product or subscription |
Beta Was this translation helpful? Give feedback.
Thank you for your nice words. I'm glad you like it.
Regarding your question:
It would be better if the providers were allowed to add some payload to the receipt data, As far as I know, Google used to allow this, but it stopped.
And even more, sometimes both of them (Google and Apple) don't send the initial purchase event. I don't know why, but it happens.
Proposed solution
As you mentioned, I think the best solution is to receive the receipt data from the mobile application once the user has purchased the product, and then use the Facades (
Product
orSubscription
) to verify the receipt data.You can follow the steps in the documentation
Note
I deprecated the
verifyRenewable
. Use theverify
…