Try doing dd($paymentMethod);before the return, what does that output?
paymentMethods() return always empty object result
Welcome file Welcome file
- Cashier Version: ^10.5
- Laravel Version: ^6.0
- PHP Version: 7.3.5
- Database Driver & Version:
Description:
paymentMethods() retrieve always array with empty object.
public function userAllPaymentMethods(Request $request)
{
$user = User::find(5);
$paymentMethod = $user->paymentMethods();
return response($paymentMethod);
}
Result : https://www.screencast.com/t/aqenaud77A
Also using Stripe PaymentMethod lib it's works.
public function userAllPaymentMethods(Request $request)
{
$user = User::find(5);
\Stripe\Stripe::setApiKey('{{KEY}}');
$paymentMethod = \Stripe\PaymentMethod::all([
'customer' => $user->stripe_id,
'type' => 'card',
]);
return response($paymentMethod);
}
Result : https://www.screencast.com/t/X14ane7WyqS
stackoverflow : Here Cashier Version: ^10.5 Laravel Version: ^6.0 PHP Version: 7.3.5 Database Driver & Version: Description: paymentMethods() retrieve always array with empty object.
public function userAllPaymentMethods(Request $request) { $user = User::find(5); $paymentMethod = $user->paymentMethods(); return response($paymentMethod); } Result : https://www.screencast.com/t/aqenaud77A
Also using Stripe PaymentMethod lib it’s works.
public function userAllPaymentMethods(Request $request) { $user = User::find(5); \Stripe\Stripe::setApiKey('{{KEY}}'); $paymentMethod = \Stripe\PaymentMethod::all([ 'customer' => $user->stripe_id, 'type' => 'card', ]);
return response($paymentMethod);
}
Please or to participate in this conversation.