• Resolved ilsc

    (@ilsc)


    Our organization is selling products for different locations. Thus I need to use hooks to modify the stripe account keys on the fly at checkout, based on the product being bought. Thus far I’m hooking into these 3 filters:

    wc_stripe_params – $params[‘key’] contains the publishable key. This is run when the page is loaded.
    woocommerce_stripe_request_headers – The “authorization” field here contains the base-64 encoded secret key. This is run when the payment is made.
    woocommerce_stripe_request_params – $params[‘stripe’][‘key’] contains the publishable key. This is run when the checkout page is loaded.

    I’m using these filters to change my publishable and secret keys to those of a different stripe account, and it seems to work fine. However, will this cause unforeseen issues anywhere?

Viewing 1 replies (of 1 total)
  • Hi @ilsc,

    Thank you for following up in the other thread and pointing me here.

    Personally I ended up being able to do what I needed without any modifications. As it turns out my client set up the Stripe account in two different workspaces instead of in the same workspace. I thought I would need to swap keys in order to send US funds to the US account and the CAD funds to the CAD account.

    Finally it just required having both accounts in the same workspace and therefore I was left with only 1 set of API keys. Thus, there was no additional modifications needed.

    However, when I was thinking about how to accomplish this and digging through the plugin source code, I realized where it would cause complications is on the wp-admin dashboard for things like returns and cancelled payments etc.

    Front end seems possible to do with your suggested setup and based on the product but have you thought about how you will handle it in the dashboard? You will need to evaluate which product category it belongs to and ensure that any API keys transactions are using the correct ones.

    Otherwise thats the only thing I could foresee being a problem.

Viewing 1 replies (of 1 total)
  • The topic ‘Using filterss to change Stripe account per-product, will this cause problems?’ is closed to new replies.