#subhrajeet_checkout-application-fees

1 messages ยท Page 1 of 1 (latest)

shell geyserBOT
#

๐Ÿ‘‹ 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. Thank you for your patience!

โฑ๏ธ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.

๐Ÿ”— 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/1213053707793469491

๐Ÿ“ Have more to share? You can add more detail below, including code, screenshots, videos, etc.

nocturne belfryBOT
undone forge
#

Let me help you with this!

#

Yes, something like this is possible, but in mode: "subscription".
You can just pass one-time Prices along with recurring Prices into line_items.

reef heron
#

May I have some references

undone forge
reef heron
#

So what I understand is that- the mode of the checkout session will be subscription, in line items array, we will pass both one time price and recurring price, the one time price inside line_items.price_data.product_data and the recurring one inside line_items.price_data.recurring

#

Am I on the track?

undone forge
reef heron
#

Actually me platform requirement is such that I need to create Price/Product on the fly/dynamically.

undone forge
#

Then sure, you can use the price_data. Here you can still choose to use an existing Product (which is just a name, description, image), or create it dynamically too with product_data. Depending on your needs.

reef heron
#

My 2nd concern is that, platform takes 7% cut on one time price and 1% on recurring price, is this possible?

undone forge
shell geyserBOT
reef heron
#

So in the very first invoice, platform takes total 8%, after the first invoice, we update the application_fee_percent to 1% and platform takes 1% on every invoice there after? Am I on the right track?

slender ether
#

The initial fee would be whatever application_fee_percent you set on creation, yes. Be that 8 or 7

#

If you then update the Subscription after creation, subsequent invoices/payments would have the updated %

reef heron
#

Let me check this and get back to you

reef heron
#

Can I create Price/Product on the fly/dynamically in subscription object?

#

This is not related to the previous question

slender ether
# reef heron Can I create Price/Product on the fly/dynamically in subscription object?

Learn about common pricing models and how to create them.

reef heron
#

But I think items.price_data.product requires The ID of the product that this price will belong to, but I want to create a new Price which is not related to any product, is this possible?

slender ether
reef heron
#

Let me clarify it again, using subscription object

slender ether
#

You're using Checkout, right?

reef heron
#

Nope, was using Checkout in previous query, currently using Subscription object

reef heron
slender ether
#

Oh, then no. You can't create a Product inline on the Subscriptions API (there's no product_data parameter)

reef heron
#

Ok got it

#

Thank you

#

I'll get back to you

nocturne belfryBOT
reef heron
#

Hello, is there any way to collect payment method used in Checkout Session with mode : "payment" and use it for future subscriptions?

lilac citrus
#

๐Ÿ‘‹ taking over for my colleague.

#

you can use that parameter

#

to setup future usage with the collected PM

reef heron
#

So after i collect the payment method, I can use it with Subscription object?

lilac citrus
#

yes

#

but why not directly create the subscription in the Checkout Session then?

reef heron
#

coz I don't want two transactions, that in turn will result in charging of two time stripe fees i.e. (2.9% + 30c) * 2

lilac citrus
#

you can create them at the same time

#

you can create a Checkout session with both a subscription and one-off payments

reef heron
#

but the platform takes 7% cut on one time price and 1% on recurring price

lilac citrus
#

you can use separate charges and transfers in this case

#

so basically the platform creates the Checkout Session and once it's complete the Platform calculates it's cut and then transfer the rest of the amount to the Connect Account

reef heron
#

So I need a checkout session in which end customers pay $100, then using charged.succeeded webhook event, I collect the payment method, then using checkout.sessions.completed webhook event, I create a subscription, but I am getting this error-Error updating payment status: StripeInvalidRequestError: This customer has no attached payment source or default payment method. Please consider adding a default payment method

#

Although I am attaching the collected payment_method while creating subscription-
const monthlySubscription = await stripeInstance.subscriptions.create(
{
customer: realtor.stripe_customer_id_under_broker,
items: [{
price: "price_1OpTihRaGU4hbiXLf4FnHLpb",
}],
application_fee_percent: 1,
metadata: {
"fee_type": "subdomain_fee"
},
default_payment_method: payment_method
},
{
stripeAccount: broker.stripe_account_id,
}
);

#

Are we connected?

slender ether
#

Sure, how can I help?

#

The error seems pretty verbose to me โ€“ what is unclear?

reef heron
#
  1. I need a checkout session in which end customers pay $100 - this is a one time payment
  2. then using charged.succeeded webhook event, I collect the payment method of that customer
  3. then using checkout.sessions.completed webhook event, I create a subscription with collected payment method as default_payment_method - here is the code snippet-
    const monthlySubscription = await stripeInstance.subscriptions.create(
    {
    customer: realtor.stripe_customer_id_under_broker,
    items: [{
    price: "price_1OpTihRaGU4hbiXLf4FnHLpb",
    }],
    application_fee_percent: 1,
    metadata: {
    "fee_type": "subdomain_fee"
    },
    default_payment_method: payment_method
    },
    {
    stripeAccount: broker.stripe_account_id,
    }
    );

But still getting this error-Error updating payment status: StripeInvalidRequestError: This customer has no attached payment source or default payment method. Please consider adding a default payment method

slender ether
reef heron
#

evt_3OpUcCRaGU4hbiXL0ugITANU

slender ether
#

That's not the ID of the API request that errors

reef heron
#

Just a minute

#

evt_3OpV0xRaGU4hbiXL1rvYly3p

slender ether
#

Again, I need a req_xxx ID. See the link above for where you can find them