#aashish_api

1 messages ยท Page 1 of 1 (latest)

long moonBOT
#

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

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

kind micaBOT
stone bloom
#

Hello, I think you will want to have your Checkout Session charge the user a one time fee in payment mode and then your backend can use a subscription schedule to make sure the actual subscription starts at a later date.

#

And then here are our docs on subscription schedules. You have a couple options for how to make sure the first invoice on the subscription is $0 because the customer already paid and I'm happy to walk through them but this is already a lot of info. Does this overall sound viable for your integration? https://docs.stripe.com/billing/subscriptions/subscription-schedules

Learn how to use subscription schedules to automate changes to subscriptions over time.

leaden lotus
#

ok, thanks. I'll look into it and try it on our test account.
Is it possible to have the subscription start on later date through the checkout session by using trials?
If I use subscripton mode in checkout session, will it charge at the time of payment, and then at the next interval?

stone bloom
#

Yep, you can definitely do a trial with a one time fee upfront. That would delay the subscription to not start charging until the trial is over and then the subscription would charge on its regular intervals

#

One thing to keep in mind is that with this setup the wording may be a bit confusing on the actual Checkout page, so you may need to flag that "30 days free" doesn't mean that the user gets 30 days free after the trial is over.

leaden lotus
#

how do I charge an one time fee upfront in the checkout session?

stone bloom
#

My line items for that Checkout Session looked like this (names changed for clarity):

    {
      quantity: "1",
      price_data: {
        unit_amount: 400,
        currency: 'USD',
        recurring: {
          interval: 'month'
        },
        product_data: {
          name: "Subscription price"
        }
      },
    },
    {
      price_data: {
        unit_amount: 1099,
        currency: 'usd',
        product_data: {
          name: 'One-time price',
        },
      },
      quantity: 1,
    },
    ],
   phone_number_collection: {
    enabled: "false",
  },```
#

Basically you can have both one time and recurring prices in your line items. I defined each of those prices via the price_data parameter, but you can have your own predefined prices and pass in their IDs:

    {
      quantity: "1",
      price: "price_1234"
    },
    {
      price: "price_5678"
      quantity: 1,
    },
    ],
   phone_number_collection: {
    enabled: "false",
  },```
leaden lotus
#

oh, okay. I'm not sure if I can make it work in my case by using both recurring and one time payment in one session.
As I need to pass an application_fee in percentage. I can do that for subscriptions but not for one time payments. So, for a work around, I used manual payment intent capture and then when session is completed, I calculate the application fee and capture the payment.
I won't be able to calculate the application fee in the above example for the one time payment ๐Ÿ˜ฆ

stone bloom
#

And I am 99% that that will take the right percent from the one-time fee

leaden lotus
#

oh, okay. I will try that now. Thank you so much.