#videovillain_api
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/1318800055120957470
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
What type of connected account do you use? Standard, Express, Custom or using controller config?
I believe we made Standard, how do I find out for sure though?
yes, they are standard in the test data, except for the first one which was Express
Could you share a connected account ID (acct_xxx), so that I can take a look?
acct_1QMPGBQrBbr8JOkl
This is a standard account as specified in the creation request sent by the platform: https://dashboard.stripe.com/test/logs/req_lJ8YIukQXN3MO4
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
To create the price and payment intents on the standard connected account, Stripe-Account header as connected account ID should be used: https://docs.stripe.com/connect/authentication#stripe-account-header
This will allows product / prices to be created on the connected account
This is the guide to accept payments on the connected account: https://docs.stripe.com/connect/direct-charges
hmmm, i believe we are doing that.. jsut a sec
If you believe that, can you share the example request ID (req_xxx) which you created relevant objects on the connected account?
yes, just a sec, sorry
just to be clear, this is the part you are talkinga bout right? ['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}']
req_KvpABTZdG7Ex9K
that is one I think was made intended for a stripe connected account
this is the PHP:
public function createPaymentIntentCourse(Request $request) {
$sub = "";
try {
//I need to add the Coach Stripe Account ID?
$unit_amount = $request->unit_amount;
$currency = $request->currency;
$session_unique_key = $request->session_unique_key;
$payment_intent_id = $request->payment_intent_id;
$player_id = $request->player_id;
$player = Player::findOrFail($player_id);
$customer = $player->createOrGetStripeCustomer();
$customerid = $customer->id;
$stripe = $this->initializeStripeClient();
if (isset($payment_intent_id)) {
$sub = $stripe->paymentIntents->retrieve($payment_intent_id);
if ($sub->status !== 'succeeded') {
// Proceed with confirmation
$sub->confirm();
}
} else {
// Create the Payment Intent using the amount and currency from the price
$sub = $stripe->paymentIntents->create([
'amount' => $unit_amount, // Use the amount from the price object
'currency' => $currency, // Use the currency from the price object
'customer' => $customerid, // 顧客IDを追加
"setup_future_usage" => "on_session",
'automatic_payment_methods' => [
'enabled' => true,
],
'metadata' => [
'course_unique_key' => $session_unique_key,
],
]);
}
return $sub;
} catch (Exception $e) {
return $this->error_send($e, "A-005", 500);
}
return $sub;
}
just to be clear, this is the part you are talkinga bout right? ['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}']
Yes
so in there we need to add
['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}'] to the create() right?
In https://dashboard.stripe.com/test/logs/req_KvpABTZdG7Ex9K, Stripe-Account header wasn't set
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}'] to the create() right?
Yes
Okay, and that is the only difference?
Yup! This will allow the products / payment intents to be created on the connected account
Also, how do we check if that account is restricted or not if it is ready to make/accept payments or not?
Hi @pure mirage I'm taking over this thread
thanks!
You can tell by looking at the account's charges_enabled property
okay
is that a simple check that the front can do during loading of the page, I assume we need a backend api built for it right?
or if we pull the stripe account it will come along with it all?
Yes you need to use your API key to retrieve the account object from your backend
Okay, now how do we make sure that the connected accounts and their payments and such are handled by stripe liability is on stripe and the connected accounts and not us?
I want to make sure I chose the right pattern
https://docs.stripe.com/api/accounts/create?lang=node#create_account-controller-losses set it to stripe when you create a connected account
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
isn't there a path we could have taken that wouldn't allow us to set that?
so in that case it would default to stripe right?
is there an easy way to check it from the dashboard?
Yes can get the controller info from Dashboard, or through API https://docs.stripe.com/api/accounts/object?lang=node#account_object-controller-losses
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Okay thanks!
and also, regarding the charges_enabled
is that on Stripe Customer Accounts or on Stripe Connected Accounts? or both?
https://docs.stripe.com/api/accounts/object?lang=node#account_object-charges_enabled it's on connected account
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and are we doing this correctly?
public function createPaymentIntentCourse(Request $request) {
$sub = "";
try {
//I need to add the Coach Stripe Account ID?
$unit_amount = $request->unit_amount;
$currency = $request->currency;
$session_unique_key = $request->session_unique_key;
$payment_intent_id = $request->payment_intent_id;
$player_id = $request->player_id;
$player = Player::findOrFail($player_id);
$customer = $player->createOrGetStripeCustomer();
$customerid = $customer->id;
$stripe = $this->initializeStripeClient();
if (isset($payment_intent_id)) {
$sub = $stripe->paymentIntents->retrieve($payment_intent_id);
if ($sub->status !== 'succeeded') {
// Proceed with confirmation
$sub->confirm();
}
} else {
// Create the Payment Intent using the amount and currency from the price
$sub = $stripe->paymentIntents->create([
'amount' => $unit_amount,
'currency' => $currency,
'customer' => $customerid, // <-- do we also need this so it knows which customer is paying, is this the right location?
"setup_future_usage" => "on_session",
'automatic_payment_methods' => [
'enabled' => true,
],
'metadata' => [
'course_unique_key' => $session_unique_key,
],
['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}'], // <-- add this line and it will work?
);
}
return $sub;
} catch (Exception $e) {
return $this->error_send($e, "A-005", 500);
}
return $sub;
}
i have two comments with < --
You still there?
Yes, you can specify a customer to assocaite a payment to it
okay, and just a last thing
the setup_future_usage, would I only use that if this product were to be a subscription or is that good to have in case the customer wants to buy it again?
Setting setup_future_usage tells Stripe that you want to save the payment method for future usage. You can use the saved payment method for another one-off payment, or recurring payments like subscriptions
right, okay
so then, actually, i have another question
i was looking at adding payment methods
and we found a way to change default method based on already existing methods
but for a Stripe Customer Account, how do we simply prompt them to add a new method for their account without any payment intent?
I don't quite understand your last question. What you mean by "Stripe Customer Account" ? is it a customer or connected account?
the customer account
the regular one everyone needs
for example, users on our site all get a stripe customer account and become free users on our app
they can subscribe, and i want to let them add othe methods there
To clarify, are you talking about customer? https://docs.stripe.com/api/customers/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
they can also buy from connected accounts and i want them to have their options available there.
yes
Ok, you can save a payment method to a customer by using SetupIntent https://docs.stripe.com/payments/save-and-reuse
they can also Become connected account users and offer things to others, and i want to migrate their payment info when/if possible
okay, so setup intent is just for adding payment methods?
Yes you are right.