laravel / cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

Home Page:https://laravel.com/docs/cashier-paddle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undefined index: payment_information

BKirev opened this issue · comments

  • Cashier Paddle Version: 1.4.6
  • Laravel Version: 8.12
  • PHP Version: 7.4.3
  • Database Driver & Version: mysql Ver 8.0.27-0ubuntu0.20.04.1 for Linux on x86_64

Description:

I'm using Spark Paddle, which is using Cashier Paddle under the hood, as we know. I've noticed the following error after some customers cancelled their subscriptions: Undefined index: payment_information

Location | /xxx/xxx/xxx/vendor/laravel/cashier-paddle/src/Subscription.php:707

Here's what's at the location:

return (string) $this->paddleInfo()['payment_information']['payment_method'];

$this->paddleInfo() is the following at the moment of the error:

{
   "subscription_id":xxxxxx,
   "plan_id":xxxxxx,
   "user_id":xxxxxx,
   "user_email":"xxxxxx@xxxxxx.com",
   "marketing_consent":false,
   "update_url":"https:\/\/subscription-management.paddle.com\/subscription\/xxxxxx\/hash\/xxxxxx\/update",
   "cancel_url":"https:\/\/subscription-management.paddle.com\/subscription\/xxxxxx\/hash\/xxxxxx\/cancel",
   "state":"deleted",
   "signup_date":"2021-10-22 21:47:56",
   "last_payment":{
      "amount":50.85,
      "currency":"USD",
      "date":"2021-11-22"
   },
   "linked_subscriptions":[
      
   ]
}

And the stacktrace:

/xxx/xxx/xxx/vendor/laravel/cashier-paddle/src/Subscription.php:707
/xxx/xxx/xxx/vendor/laravel/spark-paddle/src/FrontendState.php:226
/xxx/xxx/xxx/vendor/laravel/spark-paddle/src/FrontendState.php:37
/xxx/xxx/xxx/vendor/laravel/spark-paddle/src/Http/Controllers/BillingPortalController.php:36

Steps To Reproduce:

Not really sure how to reproduce the issue exactly, since it happened in production. Like mentioned above, it happens after a customer cancels their subscription and tries to access the billing portal again(Spark's billing portal page).

Will be in the next release