#michael_checkout-connect

1 messages ยท Page 1 of 1 (latest)

fleet elmBOT
#

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

dull flame
#

michael_checkout-connect

crystal gull
#

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?

dull flame
#

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 that Stripe-Account header https://stripe.com/docs/connect/authentication#stripe-account-header

crystal gull
#

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?

dull flame
#

yes!

crystal gull
#

Wheh ok, great.

fleet elmBOT
crystal gull
#

HI, I'm not seeing how to specify the pricing, product details etc when using the Strip-Account header server side.

gaunt path
#

what does your code snippet look like currently?

crystal gull
#

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

gaunt path
#

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)?

crystal gull
#

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.

gaunt path
#

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?
crystal gull
#

Q2 is Standard, Q3 is just one

gaunt path
#

alright, what about the first question?

crystal gull
#

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

gaunt path
#

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

crystal gull
#

ok that makes sense

gaunt path
#

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

crystal gull
#

In reading the Create a Product page, the price data doesn't seem to offer the pay what you want model. Is that right?

gaunt path
crystal gull
#

Yes our code does this now in the custom checkout, but we need the connected account's price_id to do it.

gaunt path
#

you need to create the Price on the connected account. Include the Stripe-Account header when creating a Price

crystal gull
#

We need the product id when creating the price, but we need the price_id when we creat the product, is that right?

gaunt path
#

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

crystal gull
#

It looks like we need to specify the default_price_data ?

gaunt path
#

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

crystal gull
#

SO, the process is, create the product, then create the price ID, then update the product with the new price?

gaunt path
#

no, if you want to create both the product and price separately, then like what the example shows

  1. Create the Product
  2. 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
crystal gull
#

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?

gaunt path
#

hrm, doesn't look like that's possible unfortunately

crystal gull
#

I'm looking up HRM in urban dictionary, what is that? Can't find it

gaunt path
#

it's supposed to be hmm, sorry, that was a typo ๐Ÿ˜…

crystal gull
#

ah like hmmm

#

Yeah ok so, I'll follow the two step process.

#

THank you so much for the help

gaunt path
#

btw, going back to splitting the amount between yourself and the connected accounts

crystal gull
#

Yes and also, how to specify the type of charginig as Direct

gaunt path
#

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

Let me quickly test something out for the "choose the amount you want to pay" to see if it works

#

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

Separate payment authorization and capture to create a charge now, but capture funds later.

crystal gull
#

Is that because we cannot create the priceID as pay what you want as we did already?

gaunt path
#

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?

crystal gull
#

We are using a percent of the amount as the artist's share

gaunt path
#

^ this specific parameter doesn't allow you to set a percentage

crystal gull
#

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

gaunt path
#

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)

crystal gull
#

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

gaunt path
#

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"

crystal gull
#

ONe more idea I had was to make the price $1 and to let the user set the quantity

gaunt path
#

that's a really odd flow but it still doesn't solve the issue. The application_fee_amount doesn't depend on the quantity

crystal gull
#

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.

gaunt path
#

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

crystal gull
#

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?

gaunt path
#

you can split the transaction if you use auth and capture

crystal gull
#

Yes, ok. GO it.

#

erp got it. Sorry I have trouble typing these days

gaunt path
#

no worries!

crystal gull
#

Have a great night/day ahead!