-
what is the possible problem with this app_store subscription verifyReceipt() returns {} I test the base 64 and shared secret in revenue cat and it shows receipt. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Could you please provide a snippet of your code? |
Beta Was this translation helpful? Give feedback.
-
use Imdhemy\GooglePlay\Subscriptions\SubscriptionPurchase;
use Imdhemy\Purchases\Facades\Subscription;
class UserSubscriptionController extends Controller
{
public function validateSubscription(Request $request)
{
$validateUser = Validator::make($request->all(),
[
'purchase_token' => 'required',
'provider' => 'required',
]);
if($request->provider === "APPLE"){
$receipt = $request->purchase_token;
$receiptResponse = Subscription::appStore()->receiptData(
$receipt)->verifyRenewable();
$receiptStatus = $receiptResponse->getStatus();
if($receiptStatus->isValid()) {
$latestReceiptInfo = $receiptStatus->getLatestReceiptInfo();
return json_encode($latestReceiptInfo[0]);
} else {
}
}
else if($request->provider === "GOOGLE"){
$itemId = "product_subs_annual";
$purchaseToken = $request->purchase_token;
$subscriptionReceipt = Subscription::googlePlay()->id($itemId)->
token($purchaseToken)->get();
return json_encode($subscriptionReceipt);
}
}
…On Tue, Nov 1, 2022 at 3:10 AM Dhemy ***@***.***> wrote:
Could you please provide a snippet of your code?
—
Reply to this email directly, view it on GitHub
<#170 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZJNJYZCVXKJ7GKRDAIMFPDWGAKSLANCNFSM6AAAAAARTJ7KCY>
.
You are receiving this because you authored the thread.Message ID:
<imdhemy/laravel-in-app-purchases/repo-discussions/170/comments/4021650@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
The App store But still, you can get an array value from them. - return json_encode($latestReceiptInfo[0]);
+ return $latestReceiptInfo[0]->toArray() ; - return json_encode($subscriptionReceipt);
+ return $subscriptionReceipt->toArray(); I deprecated the - $receiptResponse = Subscription::appStore()->receiptData($receipt)->verifyRenewable();
+ $receiptResponse = Subscription::appStore()->receiptData($receipt)->verify(); |
Beta Was this translation helpful? Give feedback.
The App store
LatestReceiptInfo
instance is not JSON serializable. The same applies to theSupscriptionPurchase
from Google play.But still, you can get an array value from them.
I deprecated the
verifyRenewable
today, so it would be better to replace it with theverify
method as follows.