stripe integration on checkoutpage

i am getting this message when i create a createSetupIntent Undefined method 'createSetupIntent'
public function render()
{
$cart_items = CartManagement::getCartItemsFromCookie();
$grand_total = CartManagement::calculateGrandTotal($cart_items);

// Ensure the user is authenticated and has a Stripe ID
if (auth('customer')->check()) {
$user = auth('customer')->user();
$intent = $user->createSetupIntent(); // Calling the createSetupIntent() method here
}

return view('livewire.pages.checkout-page', compact('cart_items', 'grand_total', 'intent'));
}
public function render()
{
$cart_items = CartManagement::getCartItemsFromCookie();
$grand_total = CartManagement::calculateGrandTotal($cart_items);

// Ensure the user is authenticated and has a Stripe ID
if (auth('customer')->check()) {
$user = auth('customer')->user();
$intent = $user->createSetupIntent(); // Calling the createSetupIntent() method here
}

return view('livewire.pages.checkout-page', compact('cart_items', 'grand_total', 'intent'));
}
i have added the billable trait in the customer model. i have installed cashier but i keep getting this error.
3 Replies
toeknee
toeknee2w ago
That means at user doesn't have the method createSetupIntent. You pronbably want to do: $user = User::find(auth('customer')->id); providing createSetup^ntent is on the user model.
raheel3031
raheel3031OP2w ago
I have tried that it is not working either I am using the customer model
toeknee
toeknee2w ago
dd(auth('customer')->id) what di you get?

Did you find this page helpful?