#verox_subscription-retries

1 messages ยท Page 1 of 1 (latest)

tropic ginkgoBOT
#

๐Ÿ‘‹ 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/1237027436961726485

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

chilly depotBOT
tiny rose
#
$subscription = Cashier::stripe()->subscriptions->create([
            'customer' => $user->stripe_id,
            'items' => [
                [
                    'price_data' => [
                        'currency' => $currency,
                        'product' => config('cashier.products.server'),
                        'unit_amount' => $data['amount_due'],
                        'recurring' => [
                            'interval' => $data['metadata']['period'] == 'monthly' ? 'month' : 'year'
                        ]
                    ],
                ],
            ],
            'expand' => ['latest_invoice.payment_intent'],
            // Make sure each invoice is being sent out 7 days before the period ends
            'billing_cycle_anchor' => Carbon::now()->addDays($data['metadata']['period'] == 'monthly' ? (23) : (358))->timestamp,
            'currency' => $currency,
            'collection_method' => 'charge_automatically',
            'payment_behavior' => 'default_incomplete',
            'payment_settings' => [
                'save_default_payment_method' => 'on_subscription',
                'payment_method_types' => config('cashier.charge.' . $currency),
            ],
        ]);

This is my current approach

trail peak
#

Hi there ๐Ÿ‘‹ this isn't possible, Invoices are generated when the billing period changes. There isn't currently a way to separate those two actions, but I'll capture your feedback that this is something you'd be interested in seeing added in the future.

tiny rose
trail peak
tiny rose
#

Thanks! I'll try that.