#davila7 - create price

1 messages · Page 1 of 1 (latest)

gaunt quest
#

Hi there. We don't have sample code for exactly that, but you linked the proper api spec. You just have to fill in default_price_data

molten island
#

thanks! I'm working with connect accounts

#

when I have to send the application_fee_amount to charge the fee

#

?

gaunt quest
#

Are you using payment intents?

molten island
#

i'm using sessions

#

$YOUR_DOMAIN = secure_url("/");
$checkout_session = \Stripe\Checkout\Session::create([
'line_items' => [[
'name' => $box->nombre,
'amount' => $stripe_monto,
'quantity' => 1,
'currency' => $currency_id,
'description' => $orden->producto.' con un valor de '.$orden->monto.' '.$currency_id
]],
'payment_intent_data' => [
'application_fee_amount' => intval($fee_stripe),
],
'client_reference_id' => $orden->id,
'mode' => 'payment',
'success_url' => $YOUR_DOMAIN . '/market/'.Hashids::encode($orden->id).'/thanks_stripe',
'cancel_url' => $YOUR_DOMAIN . '/market/'.Hashids::encode($orden->id).'/cancel_stripe',
], ["stripe_account" => $box->stripe_account_id]);

#

this is my code for a single pay

gaunt quest
#

What's not working?

molten island
#

I have two questions- When I create a product with a price, where should I send the account. The second, when I create the session to pay, where should I associate the product that I already created

gaunt quest
molten island
#

the account it is for the connect account

#

for example: ["stripe_account" => $box->stripe_account_id]

gaunt quest
#

Ah

#

Are you using direct charges or destination charges?

molten island
#

destination charges

gaunt quest
#

For destination charges, all objects would live on the platform account, so there is no need to pass stripe account when creating product/price

#

So that funds are transferred to the connect account

molten island
#

ok, so the child account will not be able to see the products and prices created?

gaunt quest
#

Not if you are using destination charges. Those objects would be on the platform

#

Connect account is just transferred money

molten island
#

I'm not sure if I'm using direct charges or destination charges. I am creating standard accounts with Connect and I am charging a fee on each payment

gaunt quest
#

Oh with Standard accounts you should not be using destination charges

#

That's highly discouraged

#

For both the checkout session and product creation requests

molten island
#

yes sorry

#

I'm using direct charges, sorry for that

gaunt quest
#

So yeah in that case all objects would live on the Connect account and you should make each request with the above stripe account header

#

Looks like you are passing application fee correctly

molten island
#

yes!! great 🙂

#

so when I create a product I have to pass the account id ?

gaunt quest
#

Yup just the stripe account header as outlined above

molten island
#

someting like this
$stripe->products->create([
'name' => 'Gold Special',
], ["stripe_account" => $box->stripe_account_id]);

gaunt quest
#

yeah

#

and add the price data too if you want that in 1 request

molten island
#

great!

#

thanks!!

gaunt quest
#

No problem

molten island
#

sorry, one more question 🙏

#

How can I configure a recurring price with a limit? for example a 3 month subscription

#

I cannot find the number of charges

gaunt quest
#

That's not defined on the price that's defined on the subscription

molten island
#

ok thanks!

#

Thanks for the help, I was able to better understand the subject of products and subscriptions

gaunt quest
#

Of course! Any time!