#attila_api
1 messages ¡ Page 1 of 1 (latest)
đ 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.
Hi! In the newest API version, which you're using, payment_intent was removed from the Invoice object.
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()}" );
}
All you need to do is downgrade your Stripe-PHP below 17.x.x and it should work.
what if i would like to use the new api?