#attila_api

1 messages ¡ Page 1 of 1 (latest)

modern quiverBOT
#

👋 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/1364368535647813743

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

potent kraken
boreal fern
#

Hi, is there an alternative solution?

        // Create new Subscription if none suitable exists
        try {
            $stripeSubscription = $this->stripe()->subscriptions->create([
                'customer'         => $customerId,
                'items'            => [['price' => $priceId]],
                'payment_behavior' => 'default_incomplete',
                'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
                'metadata'         => [
                    'premium_price_id' => $priceId,
                    'method'           => $paymentMethod,
                    'country'          => $country,
                    'mode'             => $this->getPaymentsMode(),
                ],
                'expand'           => [
                    'latest_invoice',                 // first expand the invoice
                    'latest_invoice.payment_intent',  // then expand its payment_intent
                ],
            ]);
            
        } catch ( ApiErrorException $e ) {
            throw new RuntimeException( "Stripe error creating subscription: {$e->getMessage()}" );
        }
potent kraken
#

All you need to do is downgrade your Stripe-PHP below 17.x.x and it should work.

boreal fern
#

what if i would like to use the new api?