#dv3ax

1 messages · Page 1 of 1 (latest)

zenith waspBOT
dusk lily
#

So you're using mode: 'subscription' to create a Subscription for recurring payments, but want an additional, one-time payment on the initial invoice too?

opal arch
#

I'm looking for a way to have an initial price for a subscription that differs from the recurring payment amount

dusk lily
opal arch
#

Thank you for the answer, yes I am currently using mixed chart with trial_end, but is there any way for me to show the exact date of when the first recurring payment happens?

dusk lily
#

So:

  • $100 p/m recurring, with a 30 day free trial
  • A one-time payment of $50 for the 'reduced' amount

Then it'll automatically start charging users $100 p/m at the end of the free trial

#

What do you mean by 'exact date'? trial_end accepts a epoch, so you can pass the exact time to the second

opal arch
#

I have managed to do that as shown in the 2nd screenshot I provided earlier, but I want the payer to see something like in the 1st screenshot (with the right initial fee)

dusk lily
#

Can you describe the exact amounts you want to charge? It's not clear to me what isn't working

#

Also, share the code you're using the create the session

opal arch
#

Okay, say that the initial fee is $10 and $25/y. This image shows the desired fee but without the date info, e.g. "Then SGD 25.00 every 12 months starting on 23 May 2024".

#

here's the code:

        $cart = [];

        $cart[] = [
            'price_data' => [
                'recurring' => [
                    'interval' => 'month',
                    'interval_count' => 12,
                ],
                'product_data' => [
                    'name' => 'testing recurring',
                    'metadata' => [
                        'pro_id' => '123',
                    ],
                ],
                'unit_amount' => 2500,
                'currency' => 'SGD',
            ],
            'quantity' => 1,
        ];

        $cart[] = [
            'price_data' => [
                'product_data' => [
                    'name' => 'testing',
                    'metadata' => [
                        'pro_id' => '123',
                    ],
                ],
                'unit_amount' => 1000,
                'currency' => 'SGD',
            ],
            'quantity' => 1,
        ];

        $checkout_session = $this->api()->checkout->sessions->create([
            'line_items' => $cart,
            'mode' => 'subscription',
            'success_url' => route('stripe.order.confirm').'?session_id={CHECKOUT_SESSION_ID}',
            'cancel_url' => route('stripe.order.cancel'),
            'subscription_data' => [
                'trial_end' => strtotime('+1 year', time()),
            ],
        ]);
dusk lily
opal arch
#

Alright, thank you for clarifying!

tropic ether
#

i also faced something similar, i need to charge a trial discounted amount before charging the regular price

tropic ether
dusk lily
tropic ether
#

ok