#subhrajeet_checkout-application-fees
1 messages ยท Page 1 of 1 (latest)
๐ 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.
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.
May I have some references
This is a basic guide on how to build a Stripe Checkout Subscription integration: https://docs.stripe.com/billing/subscriptions/build-subscriptions?ui=stripe-hosted
About the recurring + one-time Prices there's just what's in this property description: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items
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?
Pretty much.
price_data and product_data are used if you need to create a Price/Product on the fly/dynamically.
Instead, usually, you would want to create the Prices and Products via the Dashboard, and then just use the Price ID in the line_items.price field: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-price
Actually me platform requirement is such that I need to create Price/Product on the fly/dynamically.
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.
My 2nd concern is that, platform takes 7% cut on one time price and 1% on recurring price, is this possible?
Unfortunately the application_fee_percent is set per whole Subscription: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-subscription_data-application_fee_percent
You could set it to 7% first, and after the first Invoice is paid update the Subscription directly to set application_fee_percent: 1: https://docs.stripe.com/api/subscriptions/update#update_subscription-application_fee_percent
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?
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 %
Let me check this and get back to you
Can I create Price/Product on the fly/dynamically in subscription object?
This is not related to the previous question
Yes, using the price_data parameter:
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?
No, but you can create the Product inline too via product_data and omit product: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-price_data-product_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Let me clarify it again, using subscription object
You're using Checkout, right?
Nope, was using Checkout in previous query, currently using Subscription object
so is this possible using Subscription object?
Oh, then no. You can't create a Product inline on the Subscriptions API (there's no product_data parameter)
Hello, is there any way to collect payment method used in Checkout Session with mode : "payment" and use it for future subscriptions?
๐ taking over for my colleague.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
you can use that parameter
to setup future usage with the collected PM
So after i collect the payment method, I can use it with Subscription object?
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
you can create them at the same time
you can create a Checkout session with both a subscription and one-off payments
but the platform takes 7% cut on one time price and 1% on recurring price
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
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?
- I need a checkout session in which end customers pay $100 - this is a one time payment
- then using charged.succeeded webhook event, I collect the payment method of that customer
- 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
Can you share the ID (req_xxx) of the API request? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
evt_3OpUcCRaGU4hbiXL0ugITANU
That's not the ID of the API request that errors
Again, I need a req_xxx ID. See the link above for where you can find them