#davila7 - create price
1 messages · Page 1 of 1 (latest)
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
thanks! I'm working with connect accounts
when I have to send the application_fee_amount to charge the fee
?
Are you using payment intents?
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
What's not working?
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
What do you mean by "where should I send the account". You don't need to reference any account on a price object. But you would need to pass a price object here when creating the session: https://stripe.com/docs/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.
the account it is for the connect account
for example: ["stripe_account" => $box->stripe_account_id]
destination charges
For destination charges, all objects would live on the platform account, so there is no need to pass stripe account when creating product/price
You would pass the stripe account under transfer data on the session: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-transfer_data-destination
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 that funds are transferred to the connect account
ok, so the child account will not be able to see the products and prices created?
Not if you are using destination charges. Those objects would be on the platform
Connect account is just transferred money
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
Oh with Standard accounts you should not be using destination charges
That's highly discouraged
So if you are using direct charges (which you should be), you would pass the stripe account header instead: https://stripe.com/docs/connect/authentication
For both the checkout session and product creation requests
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
Yup just the stripe account header as outlined above
someting like this
$stripe->products->create([
'name' => 'Gold Special',
], ["stripe_account" => $box->stripe_account_id]);
No problem
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
That's not defined on the price that's defined on the subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok thanks!
While I am programming I am trying to publish articles in Spanish with what I am learning. https://medium.com/@dan.avila7/probando-el-cli-de-stripe-97db9ed03029
Thanks for the help, I was able to better understand the subject of products and subscriptions
Of course! Any time!