#michael_checkout-connect
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.
โฑ๏ธ 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/1281032628035911772
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
michael_checkout-connect
@crystal gull the Price id price_1234 has to exist on the Stripe account where the request is made.
If you are using Standard accounts (https://stripe.com/docs/connect/standard-accounts) and Direct Charges (https://stripe.com/docs/connect/direct-charges) then the Price id has to exist on that connected account. You can't use the one in your platform
I see. Can I create the product for the connected account via the Conenct Standard account API and retain the price_id in our DB? We don't want each connected account to have to learn their Stripe dashboard and create their own products manually.
Or is there a class of Product that spans all connected accounts?
Can I create the product for the connected account via the Connect Standard account API and retain the price_id in our DB?
yes! As a platform you have full access to the API and you can call the Create Product or Create Price API on their account the same way you are creating the Checkout Session today with thatStripe-Accountheader https://stripe.com/docs/connect/authentication#stripe-account-header
ok thank you, I can make that work. We currently would like each connected account to have three base products. Two are subscriptions (recurring charge) and one is pay what you want (for tipping) SO, I just need to create those same products for each account we sign up. Can I create those before they complete the onboarding?
yes!
Wheh ok, great.
HI, I'm not seeing how to specify the pricing, product details etc when using the Strip-Account header server side.
what does your code snippet look like currently?
public function createCustomTipCheckout(Request $request, Artist $artist)
{
Log::info('Creating custom tip checkout ' . env('STRIPE_CONNECT_TIP_PRICE_ID'));
try {
$artistPercentage = config('services.stripe_connect.artist_revenue_percentage');
$tipPriceId = config('services.stripe_connect.tip_price_id');
$artistStripeAccountId = $artist->stripeconnect_account;
$checkoutSession = $this->stripeConnect->checkout->sessions->create([
'success_url' => route('stripe_connect.checkout.success', ['session_id' => '{CHECKOUT_SESSION_ID}']),
'cancel_url' => route('stripe_connect.checkout.cancel'),
'line_items' => [
[
'price' => $tipPriceId,
'quantity' => 1,
],
],
'mode' => 'payment',
'custom_fields' => [
[
'key' => 'tip_amount',
'label' => [
'type' => 'custom',
'custom' => 'Tip Amount (USD)',
],
'type' => 'numeric',
],
],
'custom_text' => [
'submit' => [
'message' => 'Your contribution helps support the artist directly.',
],
],
],
[
'stripe_account' => $artistStripeAccountId,
]);
return response()->json([
'status' => 'success',
'checkout_url' => $checkoutSession->url
], 200);
} catch (\Exception $e) {
return response()->json([
'status' => 'error',
'message' => 'Failed to create checkout session: ' . $e->getMessage()
], 500);
}
}
The idea is to use the Stripe capability of splitting the payment to the connected account and to our account
It works OK if we use the company's Price Id but then all the funds go to us with no split
okay, maybe lets take a step back first, there's a couple of ways to split funds amongst connected accounts - are you using direct charges, destination charges, or Separate Charges and Transfers (SCT)?
I don't think our code is specifying that at this point. We have an app, so all the transactions originate by the front end user initiating a tip or a subscription purchase, where the recipient is one of our connected accounts.
I think Direct charges makes sense, but the definition "Customers transact with your platform for products or services provided by your connected account." might apply to us
We are using the Standard plan.
you need to decide which Connect fund flow to use first because that determines which parameters to use and how to build your integration. A couple of questions for me to decide which fund flow is more suited for you :
- should the platform or connected account be the one showing up on the customer's credit card statement?
- are your connected accounts Express / Custom / Standard?
- do you need to split the funds between more than 1 connected account?
Q2 is Standard, Q3 is just one
alright, what about the first question?
Q1 I think it should be the artist/connected account if possible. We need to keep track of how much each artist is receiving though.
SO we can issue a 1099 for them
FYI we are USA region only right now, so no cross-region issues.
zThis workflow looks much simpler
alright, then direct charges are what you want to use. To be clear, when you make a direct charge, the payment (and Checkout Session object ) are all made on the connected account. So the Price / Product will also need to exist and/or be created on the connected account
ok that makes sense
going back to your original question now,
I'm not seeing how to specify the pricing, product details etc when using the Strip-Account header server side.
The only difference here is adding in the Stripe-Account header server side. How do you want to create the Price and Product? You can either create the Price and Product separately e.g. https://docs.stripe.com/api/products/create, or create them inline e.g. https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-price_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.
In reading the Create a Product page, the price data doesn't seem to offer the pay what you want model. Is that right?
https://docs.stripe.com/payments/checkout/pay-what-you-want?dashboard-or-api=api - you might want to take a look at this page for how to do it via the API
Yes our code does this now in the custom checkout, but we need the connected account's price_id to do it.
you need to create the Price on the connected account. Include the Stripe-Account header when creating a Price
We need the product id when creating the price, but we need the price_id when we creat the product, is that right?
uh no, where are you seeing that you need the price_id when creating the product? you do need the product id when creating the price, but you don't need the price_id when you create the product
It looks like we need to specify the default_price_data ?
default_price_data is the literal parameter name. You're can pass in information to create a default price at the same time you're creating a product. However, nowhere in there does it say you need a Price ID
you can see this parameter as a comparison where it explicitly says you need to pass in a Price ID : https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-price
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
SO, the process is, create the product, then create the price ID, then update the product with the new price?
no, if you want to create both the product and price separately, then like what the example shows
- Create the Product
- Create the Price. As part of creating the Price, you are alreadying specifying the Product. So there's no need to update the Product with the new Price
If I don't want to create the price seperately, is there a way to specify the "pay what you want" price as part of the create a product API?
hrm, doesn't look like that's possible unfortunately
I'm looking up HRM in urban dictionary, what is that? Can't find it
it's supposed to be hmm, sorry, that was a typo ๐
ah like hmmm
An onomatopoeic word of the sound or hum you would emit when raising an eyebrow, expressing scepticism or mentally picturing something bizarre.
Yeah ok so, I'll follow the two step process.
THank you so much for the help
btw, going back to splitting the amount between yourself and the connected accounts
Yes and also, how to specify the type of charginig as Direct
using the Stripe-Account header already defines it as a direct charge. The next part to this is splitting the amount
you would use the application_fee parameter
- if it's for a Subscription, you can define it here : https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-subscription_data-application_fee_percent
- if it's for a choose the amount you want to pay situation, it becomes a bit more complicated because the parameter only allows you to define a flat fee for a single payment - https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-application_fee_amount
Let me quickly test something out for the "choose the amount you want to pay" to see if it works
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so how you'll go about it for the "amount you want to pay" is to use capture_method=manual (which makes it into auth and hold [0][1]). After you get the notification that the payment can be captured, you would capture the payment with the appropriate application fee - https://docs.stripe.com/api/payment_intents/capture#capture_payment_intent-application_fee_amount
[0] https://docs.stripe.com/payments/place-a-hold-on-a-payment-method
[1] https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-capture_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Is that because we cannot create the priceID as pay what you want as we did already?
I'm making the assumption, that you as a platform, want to take an application fee from "pay what you want" amounts also. You don't know how much the customer will pay, so how would you know how much to take as an application fee?
We are using a percent of the amount as the artist's share
well yes, but you need to set a fixed amount for the application fee for one time payments when creating the Checkout Session : https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-application_fee_amount
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
^ this specific parameter doesn't allow you to set a percentage
This workflow seems complex. Are there a lot more issues and error conditions to handle then?
Is there another priceing model where a % can be used perhaps?
for the split I mean
it is more complex and with that comes more conditions to deal with. I wouldn't say that there's more issues
i think an alternative i've seen before is to offer certain fixed amounts e.g. $1, $5, $10 etc (essentially don't use pay what you want)
Ideally, it would be a backoffice percent that happens after the transaction
We configure the connected acount's percent of rthat product/priceID... something likethat
nothing else that comes to mind other than what i mentioned. Either use auth and capture so that you can define the application fee amount later, or don't use "pay what you want"
ONe more idea I had was to make the price $1 and to let the user set the quantity
that's a really odd flow but it still doesn't solve the issue. The application_fee_amount doesn't depend on the quantity
Yeah the application fee model doesn't seem to work for this particular product. It is great tfor the subscriptions, but not so much for tipping
That's why we liked the existing price_id of pay what you want.
yeah, it's pretty unfortunate. I'll pass on the feedback that we should offer the ability to take a percentage amount too for this use case
So, if we stick with creating the price_id int eh connected account of pay what you want, then we have no way to split the transaction, except a fixed amount, is that right?
you can split the transaction if you use auth and capture
no worries!
Have a great night/day ahead!