#davlia7-Connect
1 messages · Page 1 of 1 (latest)
Hi there, can you tell me what do you want to accomplish so that I can advise the best solution for you?
Hi, I'm using stripe connect and I have clients creating stripe account with our account
and now I need to create start using that stripe_account to create the checkout_session->url
Got it, so you want to create a Checkout session on the connected account.
https://stripe.com/docs/connect/authentication here is the doc that you are looking for, basically you should pass the account ID in the Stripe-Account header.
Can you copy and paste the code here? I can help you edit
\Stripe\Stripe::setApiKey('sk_test_51BEhnwABQjp5g5dRhpytw9qdGxHS6t5SPxpSAKn8fPgUxVe1ltq8ZxJtDuTmXTX4NsSAIqxzCNmf659xosOHYlFJ00SE5gg70J');
$YOUR_DOMAIN = secure_url("/");
$checkout_session = \Stripe\Checkout\Session::create([
'line_items' => [[
'name' => $orden->producto,
'amount' => $monto,
'quantity' => 1,
'currency' => $currency_id,
'description' => $orden->producto.' con un valor de '.$orden->monto.' '.$currency_id
]],
'client_reference_id' => $orden->id,
'mode' => 'payment',
'success_url' => $YOUR_DOMAIN . '/stripe/'.Hashids::encode($orden->id).'/success',
'cancel_url' => $YOUR_DOMAIN . '/stripe/'.Hashids::encode($orden->id).'/cancel',
], ["stripe_account" => "{{CONNECTED_STRIPE_ACCOUNT_ID}}"]);
return redirect($checkout_session->url);
You shouldn't paste your API key in discord, it's now leaked and compromised, please roll it as soon as possible.
working! thanks!
No problem! remember to roll your key 🙂
yes! I wil do now
last question
when a new client create an account with stripe connect, Can I get that stripe account id with a webhook ?
How do you connect your platform with connected account? Do you create the connected account from the platform?
If it's, you should listen to account.updated webhooks. https://stripe.com/docs/connect/standard-accounts#return-user
yes, I'm using the standard account
// Create a Standard Account
$stripe = $this->stripe;
$stripe_account = $this->stripe->accounts->create(['type' => 'standard', 'country' => 'MX']);
$stripe_account = $stripe->accounts->create(['type' => 'standard']);
// Create an account link
$account_link = $this->stripe->accountLinks->create([
'account' => $stripe_account->id,
'refresh_url' => secure_url('/stripe/refresh_create_account'),
'return_url' => secure_url('/stripe/success_create_account'),
'type' => 'account_onboarding',
]);
return redirect($account_link->url);
Right, then you can take a look at the link that I sent earlier, and listen to account.updated webhooks