#rajnisha-subscription

1 messages · Page 1 of 1 (latest)

glad cairn
dull compass
#

Thanks let me have a look

dull compass
#

Sorry but can't see there two prices set here.

#

Here you're suggesting price tier ?

glad cairn
#

nope, i am not suggesting that. I might have given the advise too literally. Do you mind share on what you want to achieve again?

What I shared just now is just that you can have an one-off charge if you want to charge your customer on top of a monthly recurring fee

dull compass
#

I'm looking to implement the solution in subscription for $20 for 1 month then $5 for after. Can you please guide me link/method need to use for this? I've tried a couple of things but didn't get it correct. Not sure where I'm doing mistakes as its charges $25 at once while i'm looking $20 upfront payment then once recurring cycle start then $5 for each month.

#

something like fixed cost for trial period before subcription start.

#

[payment_method_types] => Array
(
[0] => card
)

[mode] => subscription
[line_items] => Array
    (
        [0] => Array
            (
                [price] => Stripe\Price Object
                    (
                        [id] => sdfasf
                        [object] => price
                        [active] => 1
                        [billing_scheme] => per_unit
                        [created] => 1631698575
                        [currency] => usd
                        [livemode] => 
                        [lookup_key] => 
                        [metadata] => Stripe\StripeObject Object
                            (
                            )

                        [nickname] => Basic - Accommodation Provider
                        [product] => dsf
                        [recurring] => Stripe\StripeObject Object
                            (
                                [aggregate_usage] => 
                                [interval] => month
                                [interval_count] => 1
                                [trial_period_days] => 
                                [usage_type] => licensed
                            )

                        [tax_behavior] => unspecified
                        [tiers_mode] => 
                        [transform_quantity] => 
                        [type] => recurring
                        [unit_amount] => 1500
                        [unit_amount_decimal] => 1500
                    )

                [quantity] => 1
            )

    )
#

As of now array like this for creating subscription for new client.

glad cairn
#
  1. Create a subscription on the customer with the price ID created in step 1
#

So following the above 3 steps, your customer will be subscribed to a $5 subscription monthly

#

however, in the first invoice, they will be charged $15 more as one time charge only

dull compass
#

Thanks for guidance let me have a look and follow the steps

#

But here firest time customer charge one time fee + subscription feel but i wanted that subscription fee start once subscription start i.e. after 30 days.

glad cairn
#

So the first 30 days will be free for your customer is it?

dull compass
#

yes

glad cairn
#

That will still work. Just in step 3, you add a 100% discount by creating a coupon https://stripe.com/docs/api/coupons/create?lang=python#create_coupon-percent_off
and apply it when you create the subscription https://stripe.com/docs/api/subscriptions/create?lang=python#create_subscription-coupon

dull compass
#

Ok thanks

#

checking

dull compass
#

@glad cairn can we use this with checkout.js ?

#

$stripe->checkout->sessions->create([
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
'payment_method_types' => ['card'],
'line_items' => [
[
'price' => 'price_H5ggYwtDq4fbrJ',
'quantity' => 2,
],
],
'mode' => 'payment',
]);

#

Basically we have PWA app and from API (server side) generate session and with checkout.js it's redirect to stripe. After redirect again session submitted to server with API.

#

that's the our flow. So can we use above 3 steps with session?

glad cairn
#

unfortunately no, if you cannot
You can only create a subscription with 30days trial but for the one time charge of 15$, you will have to send a separate invoice

#

which is not great

dull compass
#

I've achieved it with existing customer, but now i'mt ryhing to do with checkout.js

#

Like

name_fee = "Setup fee";
$fixed_productData = $this->setProduct($name_fee);

    $name = "Product 2";
    $priceData = $this->setPrice($name, 5,'day');
    
    
    $fixedPriceObj = \Stripe\Price::create([
        'nickname' => $name_fee,
        'product' => $fixed_productData['data'],
        'unit_amount' => 30 * 100,
        'currency' => DEFAULT_CURRENCY_SHORT_NAME
    ]);
    $subscription =  $stripe->subscriptions->create([
        'customer' => $custId,
        'items' => [
            ['price' => $priceData['data']->id],
        ],
        'add_invoice_items' => [
            ['price' => $fixedPriceObj->id],
        ],
        'trial_end'=> strtotime('+7 days'),
    ]);
#

Now i'm need to generate a session for this so front end side redirect and do the payment!

glad cairn
#

yeah, it is not possible currently in Checkout session unfortunately