Skip to content

RedirectToCheckoutResponse confusion #292

@evertjanMlbrgn

Description

@evertjanMlbrgn

Subscription builders use:

\Laravel\Cashier\SubscriptionBuilder\RedirectToCheckoutResponse

FirstPaymentChargeBuilder and
UpdatePaymentMethodBuilder uses:
use Laravel\Cashier\Http\RedirectToCheckoutResponse;

i was trying to redirect users to checkout with a new chargeItem, but this failed over and over, the customer did not have a mandate yet, after some time i saw that i used the wrong RedirectToCheckoutResponse

$item = new ChargeItemBuilder($customerProfile);
$item->unitPrice(money($amount, 'EUR'));
$item->description($description);
$chargeItem = $item->make();

$result = $customerProfile->newCharge()
    ->addItem($chargeItem)
    ->setRedirectUrl(config('cashier.first_payment.redirect_url'))
    ->create();

// Note my IDE, or I, accidentially picked \Laravel\Cashier\SubscriptionBuilder\RedirectToCheckoutResponse, instead of 
// use Laravel\Cashier\Http\RedirectToCheckoutResponse in the following line and my payments at mollie timed out.
if(is_a($result, RedirectToCheckoutResponse::class))
{
    return $result;
} else {
    dump('is not a redirectToCheckoutResponse');
}

This might also have caused the issues this user was having: #154

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions