#abdullahergun_code
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/1328512492883677267
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello! Sounds like you're looking for these docs: https://docs.stripe.com/connect/authentication#stripe-account-header
That shows you how to set the Stripe-Account header with PHP.
Hi yes I am but unfortunately my php skills are limited are you able to help me modify the code ? Since I am using WordPress/WooCommerce their integration is a bit complicated I am guessing this is where
$this->intent = PaymentIntent::create( $args, Helpers::get_auth_opts());
payment intent is created right ?
It looks like that's the point where the Payment Intent is created, yep. I can't help you write your code, though.
I am not expecting you to but how can I pass the " ['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}'] " to this intent I have tried things like " $this->intent = PaymentIntent::create( $args, Helpers::get_auth_opts(), ['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}']); "
What happened when you tried that? Can you share the request ID for the request that code made? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Noting happened payment go to the main account instead of connected account
req_ytfxq9YLFuM8uV
That worked. The request was made on the connected account by your platform.
The Stripe-Account header was set as expected.
Are you sure because my connected accounts ID is acct_1QfUeABO5hlueKZw
My code is currenly looks like this
$this->intent = PaymentIntent::create( $args, Helpers::get_auth_opts(), ['stripe_account' => 'acct_1QfUeABO5hlueKZw'] );
That account ID wasn't involved in this request. Two different accounts were. Perhaps you gave me the wrong request ID?
How did you get the request ID? Did you get it from the Dashboard or your code?
I got it from the stripe dashboard. I just did another test order
req_wJQuYdGDuXqkXO
and its still going to the main account
My code currently looks like this
$this->intent = PaymentIntent::create( $args, Helpers::get_auth_opts(), ['stripe_account' => 'acct_1QfUeABO5hlueKZw'] );
The request you just shared does not involve that account. That request is not coming from that code as far as I can tell.
Or Helpers::get_auth_opts() is doing something unexpected.
Can you see what Helpers::get_auth_opts() spits out?
Yes its getting the api and secret key
/**
* Get authorization options used for every Stripe transaction as recommended in Stripe official docs.
*
* @link https://stripe.com/docs/connect/authentication#api-keys
*
* @since 1.8.2
*
* @return array
*/
public static function get_auth_opts() {
return [ 'api_key' => self::get_stripe_key( 'secret' ) ];
}
and get_stripe_key is doing this
/**
* Get Stripe key from the WPForms settings.
*
* @since 1.8.2
*
* @param string $type Key type (e.g. 'publishable' or 'secret').
* @param string $mode Stripe mode (e.g. 'live' or 'test').
*
* @return string
*/
public static function get_stripe_key( $type, $mode = '' ) {
$mode = self::validate_stripe_mode( $mode );
if ( ! in_array( $type, [ 'publishable', 'secret' ], true ) ) {
return '';
}
$key = wpforms_setting( "stripe-{$mode}-{$type}-key" );
if ( ! empty( $key ) && is_string( $key ) ) {
return sanitize_text_field( $key );
}
return '';
}
Oh, that's why. The key used to make these requests belongs to a specific connected account.
That's overriding the Stripe-Account header you're trying to set.
You would need to use the correct secret key, the one belonging to the connected account you want to use instead of this other one.
So it sounds like you're using this deprecated approach, with OAuth + Express accounts, right? https://docs.stripe.com/connect/oauth-express-accounts
I can update the secret key I am unable to locate the secret key for the connected account in my stripe dasboard the only secret key I can see on my dashboard is the one they are using
It's not in your Dashboard. It's the key you got during OAuth with that specific connected account.
I am using the express connected account I created this account from stripe dashboard. I dont remember seeing any OAuth + stuff while creating the account. What I did is just created the conneted account
Okay, let's back up a bit.
Let's focus on request req_wJQuYdGDuXqkXO. This request was made from a platform on a connected account to create a direct charge. The API key used for this request is specific to a particular connected account and their relationship to the platform in question. That key can only be used to make requests from said platform on said connected account. From everything I can see on my end this key was obtained during an OAuth connection from the connected account to the platform account. Neither of the account IDs involved in this request (the platform and the connected account) are acct_1QfUeABO5hlueKZw. I can't reveal the account IDs involved because this is a public server and I can't verify your identity. It sounds like the code you're using and what's actually happening are very far apart, and I'm trying to find out where that gap is and why it exists. How can I help from here?
I will go ahead and tell you that neither of the accounts involved in that request are Express accounts. I can see your Express account (acct_1QfUeABO5hlueKZw), and it is in no way involved in this request.
It seems to me like you have an API key mixup somewhere.
Yeah I got what you mean in here. Since I am using a wordpress site to connect my website to the stripe I have clicked this "connect to stripe" button which did give me a list of accounts but in this list there was only 1 account which is my main account with the ID of acct_1QNEFFBZ8dpn0pCV (this account is a main account not a connected account).
Ah, yeah, so that account is actually the account the request was made on. That account is connected to another platform, which is the platform that made the request.
To clarify, acct_1QNEFFBZ8dpn0pCV is both a platform account and a connected account.
Understand in this case when we specifify the " $this->intent = PaymentIntent::create( $args, Helpers::get_auth_opts(), ['stripe_account' => 'acct_1QfUeABO5hlueKZw'] ); " should this not be fixing our problem ?
No, because the API key you're using is overriding any Stripe-Account header you're setting in your code.
To put it another way, the API key you're currently using will never work the way you want it to. You need to be using your platform's API key, not the OAuth key you're using now.
The OAuth key you're using now belongs to a different platform account, the one your platform account is connected to as a connected account.
It sounds like you're fetching the API key being used by the WordPress plugin that belongs to the platform your account is connected to.
That's different from your own API key.
I think it would help if you could provide a lot more context about what you're building and the environment you're building in.
I understand the issue here what I am trying to build
I provide a website to my client
My clients customer purchases an item from this website
My client gets the money to their connected account
I charge my client on this order from their connected account to my account for providing the website
Also I have just noticed that I was using this third party plugin made by Checkout Plugins so far I have noticed that you guys do have a an official plugin in this in wordpress
to clarify, Stripe doesn't have any official plugins in wordpress. That's not owned or maintained by Stripe.
Are you sure there is pluging available on wordpress site called
"WooCommerce Stripe Payment Gateway" and Author is Stripe
Take credit card payments on your store using Stripe.
yes, i'm 100% certain, it's not by Stripe. I'll pass on the feedback about that description
Understand now to connect my stripe account to receive payments
I need click this create or connect account button
The only option I get here is my main account
Unfortunaly I cannot see the connected account in this list
Does "Brainstorm Force" ring any bells or sound familiar?
Oh, wait, I just re-read what you shared earlier, and that helper you're using says Get Stripe key from the WPForms settings. So do you have WPForms installed? How is that involved? Why are you using their helper code to get the API key to use?
Does checkoutplugins.com ring any bells?
Yes checkoutplugins.com rings a bell I dont know about this WPForms settings I think it came with the checkoutplugins should I dive in the to the code see what it is doing ?
No. We need more details and context. Do you own the Checkout Plugins plugin? Are you a developer there?
No I dont I am a user of this plugin
Okay, so it seems like the code you're using is pulling the API key that belongs to checkoutplugins.com. You should not be using that API key.
How did you get to the point where you wrote that code to pull that API key?