imdhemy / laravel-in-app-purchases

Validate products and subscription receipts. Handle subscription lifecycle.
MIT License
327 stars 76 forks source link

Undefined property: Imdhemy\\AppStore\\ValueObjects\\JwsTransactionInfo::$token #428

Open saagoor opened 2 months ago

saagoor commented 2 months ago

Liap version(s) affected

1.7.0

Description

Getting this error on app store v2 subscription event.

{
    "message": "Undefined property: Imdhemy\\AppStore\\ValueObjects\\JwsTransactionInfo::$token",
    "exception": "ErrorException",
    "file": "/Users/mhsagor/apps/goplay/backend/vendor/imdhemy/appstore-iap/src/Jws/UnEncryptedTokenConcern.php",
    "line": 97,
    "trace": [
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php",
            "line": 256,
            "function": "handleError",
            "class": "Illuminate\\Foundation\\Bootstrap\\HandleExceptions",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/imdhemy/appstore-iap/src/Jws/UnEncryptedTokenConcern.php",
            "line": 97,
            "function": "Illuminate\\Foundation\\Bootstrap\\{closure}",
            "class": "Illuminate\\Foundation\\Bootstrap\\HandleExceptions",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/app/Billing/Listeners/AppStore/AppStoreBaseListener.php",
            "line": 47,
            "function": "claims",
            "class": "Imdhemy\\AppStore\\ValueObjects\\JwsTransactionInfo",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/app/Billing/Listeners/AppStore/AutoRenewSubscription.php",
            "line": 18,
            "function": "getSubscriptionDataFromNotification",
            "class": "App\\Billing\\Listeners\\AppStore\\AppStoreBaseListener",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php",
            "line": 478,
            "function": "handle",
            "class": "App\\Billing\\Listeners\\AppStore\\AutoRenewSubscription",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php",
            "line": 286,
            "function": "Illuminate\\Events\\{closure}",
            "class": "Illuminate\\Events\\Dispatcher",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php",
            "line": 266,
            "function": "invokeListeners",
            "class": "Illuminate\\Events\\Dispatcher",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php",
            "line": 473,
            "function": "dispatch",
            "class": "Illuminate\\Events\\Dispatcher",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/imdhemy/laravel-purchases/src/Handlers/AppStoreV2NotificationHandler.php",
            "line": 45,
            "function": "event"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/imdhemy/laravel-purchases/src/Handlers/AbstractNotificationHandler.php",
            "line": 44,
            "function": "handle",
            "class": "Imdhemy\\Purchases\\Handlers\\AppStoreV2NotificationHandler",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/imdhemy/laravel-purchases/src/Http/Controllers/ServerNotificationController.php",
            "line": 28,
            "function": "execute",
            "class": "Imdhemy\\Purchases\\Handlers\\AbstractNotificationHandler",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
            "line": 54,
            "function": "__invoke",
            "class": "Imdhemy\\Purchases\\Http\\Controllers\\ServerNotificationController",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
            "line": 43,
            "function": "callAction",
            "class": "Illuminate\\Routing\\Controller",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
            "line": 262,
            "function": "dispatch",
            "class": "Illuminate\\Routing\\ControllerDispatcher",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
            "line": 208,
            "function": "runController",
            "class": "Illuminate\\Routing\\Route",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 808,
            "function": "run",
            "class": "Illuminate\\Routing\\Route",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 144,
            "function": "Illuminate\\Routing\\{closure}",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/app/Http/Middleware/WebhookLogger.php",
            "line": 20,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 183,
            "function": "handle",
            "class": "App\\Http\\Middleware\\WebhookLogger",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 119,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 807,
            "function": "then",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 786,
            "function": "runRouteWithinStack",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 750,
            "function": "runRoute",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
            "line": 739,
            "function": "dispatchToRoute",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 201,
            "function": "dispatch",
            "class": "Illuminate\\Routing\\Router",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 144,
            "function": "Illuminate\\Foundation\\Http\\{closure}",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php",
            "line": 19,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 183,
            "function": "handle",
            "class": "Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php",
            "line": 66,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 183,
            "function": "handle",
            "class": "Barryvdh\\Debugbar\\Middleware\\InjectDebugbar",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/app/Http/Middleware/Localization.php",
            "line": 23,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 183,
            "function": "handle",
            "class": "App\\Http\\Middleware\\Localization",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php",
            "line": 31,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 183,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
            "line": 21,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php",
            "line": 51,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 183,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\TrimStrings",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php",
            "line": 27,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 183,
            "function": "handle",
            "class": "Illuminate\\Http\\Middleware\\ValidatePostSize",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php",
            "line": 110,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 183,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php",
            "line": 62,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 183,
            "function": "handle",
            "class": "Illuminate\\Http\\Middleware\\HandleCors",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php",
            "line": 58,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 183,
            "function": "handle",
            "class": "Illuminate\\Http\\Middleware\\TrustProxies",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
            "line": 119,
            "function": "Illuminate\\Pipeline\\{closure}",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 176,
            "function": "then",
            "class": "Illuminate\\Pipeline\\Pipeline",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
            "line": 145,
            "function": "sendRequestThroughRouter",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/apps/goplay/backend/public/index.php",
            "line": 51,
            "function": "handle",
            "class": "Illuminate\\Foundation\\Http\\Kernel",
            "type": "->"
        },
        {
            "file": "/Users/mhsagor/.composer/vendor/laravel/valet/server.php",
            "line": 110,
            "function": "require"
        }
    ]
}

How to reproduce

$serverNotification = $event->getServerNotification();
$subscription = $serverNotification->getSubscription();
$appStorePayload = $subscription->getProviderRepresentation();
$transactionInfo = $appStorePayload->getTransactionInfo();

And then

$transactionInfo->payload();

or

$transactionInfo->claims()

I'm trying to retrieve the amount and currency from the payload.

Possible Solution

No response

Additional Context

No response