woocommerce / woocommerce-gateway-stripe

The official Stripe Payment Gateway for WooCommerce
https://wordpress.org/plugins/woocommerce-gateway-stripe/
234 stars 206 forks source link

Handler request's header before send #1474

Open TadeuRodrigues opened 3 years ago

TadeuRodrigues commented 3 years ago

I'm trying to implement connected account but at time I can't change the request's header. I suggest create a new hook to use to handler them.

v18 commented 3 years ago

Hi @TadeuRodrigues, thanks for opening this issue. Can you elaborate a little bit about how you're using the Stripe extension with the connected account?

TadeuRodrigues commented 3 years ago

Hi @v18 i made a PR to implement #1479 I just need an way to change the header to add $headers['Stripe-Account']

v18 commented 3 years ago

Hi @TadeuRodrigues - thank you for opening the PR. Could you please add more details to this issue or to the PR? For example steps to reproduce the problem. It would help us understand the reasons for this change.

TadeuRodrigues commented 3 years ago

@v18 At begin, I want to create a new 'payment intent' with application_fee_amount at time I can use woocommerce_stripe_request_body to add a new field in the body but I should to add to header too to add a connected account id, this wait I was thinking to add a new hook to change the header, i will make a new contribute to add this mode(connected account) to native.

ricardo commented 3 years ago

@TadeuRodrigues, I believe you're referring to adding a Stripe-Account header to Stripe Connect while you have the secret keys in the Stripe plugin as a platform account, is that right?

Unfortunately, you can't do that with this plugin. The Stripe API is different for platform integrations. It's not only the Stripe-Account header.

If you just want to use a connected account and not serve as a platform, you can check the WooCommerce Payments extension.

TadeuRodrigues commented 3 years ago

@ricardo a API é a mesma, na verdade eu já fiz essa implementação em um plugin separado mas como não tive uma forma de adicionar o stripe-account no header nativamente fiz esse PR para suprir esssa necessidade, penso em juntar o plugin que fiz para ter essa capacidade de usar o stripe connected account nativamente.

ricardo commented 3 years ago

@TadeuRodrigues Entendi, but please reply in English so that other contributors can understand the issue too 😄

@v18 Explaining the issue + translating the above comment, they are proposing a filter to add "Stripe-Account" headers to enable support for platform accounts. The Stripe API keys in the settings page would be the platform account keys, and the connected account ID would be provided by a different plugin.

I'm not sure this is in the scope of the Stripe Gateway plugin.