#PyroFiire

1 messages · Page 1 of 1 (latest)

wintry pecanBOT
old scroll
#

Hi there!

#

I've added the proration_behavior parameter to the subscription_update feature in the portal configuration but that doesn't change anything.
So what is happening currently?

royal lance
#

I have an "Amount due today" and the customer is debited immediately when the plan is changed

#
            $price = $this->stripeService->getClient()->prices->create([
                'unit_amount' => 1000,
                'currency' => 'eur',
                'product' => $subscription->getProducts()[0]->getStripeId(),
                'recurring' => [
                    'interval' => 'month',
                    'interval_count' => 1,
                ],
            ]);

            $portal_config = $this->stripeService->getClient()->billingPortal->configurations->create([
                'features' => [
                    'subscription_cancel' => [
                        'enabled' => true,
                        'proration_behavior' => 'none',
                        'mode' => 'at_period_end',
                    ],
                    'payment_method_update' => [
                        'enabled' => true,
                    ],
                    'subscription_update' => [
                        'enabled' => true,
                        'default_allowed_updates' => ['price'],
                        'products' => [
                            [
                                'product' => $subscription->getProducts()[0]->getStripeId(),
                                'prices' => [$price->id]
                            ]
                        ],
                        'proration_behavior' => 'none',
                    ]
                ],
                'business_profile' => [
                    'privacy_policy_url' => 'https://example.com/privacy',
                    'terms_of_service_url' => 'https://example.com/terms',
                ],
            ]);

            $portal = $this->stripeService->getClient()->billingPortal->sessions->create([
                'customer' => $stripe_customer_id,
                'return_url' => Url::fromRoute('maitresse_customer.product_controller.list', [], ['absolute' => TRUE])->toString(),
                'configuration' => $portal_config->id
            ]);
old scroll
#

Can you share an example Subscription (sub_xxx) that was updated with the customer portal this way?

royal lance
#

Of course, I've done it in a simulation clock where I haven't advanced the time yet (clock_1NziuhIXNywFBsoWPhB7wqvJ). I've just seen that the clock is still dated yesterday, 10 October 2023 at 18:36. Could this be a problem?
If not, here's the subscription id sub_1NzivNIXNywFBsoWVT2O35rN

old scroll
#

Thanks! Give me a few minutes to look into this.

royal lance
#

Maybe I should try moving the clock forward a day to see if the problem is still there? I can also try without the simulation clock

old scroll
#

No there shouldn't be any impact here.

#

the customer has an active subscription that will be renewed on 10 December 2023. I want the new offer to start on 10 December 2023
But I don't think it's possible to make a change now in the customer portal that will be applied in the future.

#

I have an "Amount due today" and the customer is debited immediately when the plan is changed
Can you clarify what you updated exactly? Was the billing period of the new price difference from the old one?

royal lance
#

Yes, the aim is to get the customer to change their interval and price, but only at the end of the current period for which they have already paid.

#

This is not what the proration_behavior parameter does ?

wintry pecanBOT
royal lance
#

Is anyone there?

iron tinsel
#

proration is not about changing when the actual upgrade happens

#

if the customer visits the portal and upgrades, the subscription moves to the new Price immediately. proration_behaviour controls how the payment for that works, the default is that prorated amounts are calculated and added to the next invoice, but the upgrade has still happened at the time you/the portal calls the API to do the upgrade

royal lance
#

ah so I have to go through Subscription Schedule? Can't I use the portal for that?

#

ok thanks

#

I'd tried but I had another problem doing what I wanted with subscription_schedule. That's why I tried using the portal. I'll try again