#dverleg_error

1 messages ¡ Page 1 of 1 (latest)

red citrusBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1306160615798083634

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

ivory shoal
#

Additional information:
The Subscription is created through this function, which seems to work all good. I've used the iDeal payment method in this case during the checkout session for that Subscription:
public function createCheckoutSession(Request $request) {
$user = $request->user();

    if (!$user->stripe_id) {
        $user->createAsStripeCustomer();
    }

    $session = $user->newSubscription('default', *partner_price_id*)
        ->checkout([
            'customer' => $user->stripe_id,
            'success_url' => route('partner.checkout-complete'),
            'cancel_url' => route('clients'),
        ]);

    return redirect($session->url);
}

The use case here is that the "Partner" user adds multiple Clients in our dashboard. For each client I need to add a specific package (Stripe Price) to the Partners' Stripe Subscription.

limber compass
ivory shoal
#

Hi there, thanks for the quick reply. I think this is the request id where it throws the error: req_M1PP5rh1e6ARgL

#

I'm happy to use the Stripe API directly if that would make things easier. I was thinking Laravel Cashier would have this sorted properly but I totally understand you can't give feedback on that

limber compass
#

Okie, speaking from a pure Stripe API perspective, I think this request could work if you pass off_session: true

#

Can you look around Laravel Cashier document to see if you can pass that parameter?

ivory shoal
#

thanks, will check if I can figure that out and add it

#

That seems to be sent when creating the Subscription, but I'll check if I can also add it when adding the Price

limber compass
ivory shoal
#

Yeah thanks for that, found that one as well. Unfortunately the Cashier integration does not support sending that off_session somehow.. This is the addPrice under the hood

    public function addPrice($price, $quantity = 1, array $options = [])
    {
        $this->guardAgainstIncomplete();

        if ($this->items->contains('stripe_price', $price)) {
            throw SubscriptionUpdateFailure::duplicatePrice($this, $price);
        }

        $stripeSubscriptionItem = $this->owner->stripe()->subscriptionItems
            ->create(array_filter(array_merge([
                'subscription' => $this->stripe_id,
                'price' => $price,
                'quantity' => $quantity,
                'tax_rates' => $this->getPriceTaxRatesForPayload($price),
                'payment_behavior' => $this->paymentBehavior(),
                'proration_behavior' => $this->prorateBehavior(),
            ], $options)));

        $this->items()->create([
            'stripe_id' => $stripeSubscriptionItem->id,
            'stripe_product' => $stripeSubscriptionItem->price->product,
            'stripe_price' => $stripeSubscriptionItem->price->id,
            'quantity' => $stripeSubscriptionItem->quantity ?? null,
        ]);

        $this->unsetRelation('items');

        $stripeSubscription = $this->asStripeSubscription();

        if ($this->hasSinglePrice()) {
            $this->fill([
                'stripe_price' => null,
                'quantity' => null,
            ]);
        }

        $this->fill([
            'stripe_status' => $stripeSubscription->status,
        ])->save();

        $this->handlePaymentFailure($this);

        return $this;
    }

When adding a off_session => true I get: Received unknown parameter: off_session

I can imagine you can't help me out there, but maybe I could try to instead use the Stripe API directly for adding a price to the subscription?