• Resolved bluedogranch

    (@bluedogranch)


    Hi,

    I have an interesting feature I need to get working and am wondering if someone can help.

    I’m taking donations for an organization, and I process the donations through Woocommerce Square. I have several different donation funds set up as Woocommerce products, and most of the donations go to one Square account.

    But for one fund in particular, the donations need to go to a different Square account.

    My question: is it possible to hook into the “payment” loop in Woocommerce Square and change the API application_id and access_token for one particular product ID?

    This is pseudocode for what I need to do: If IDs 1, 2, 3 are in checkout, use Woocommerce Square plugin API key settings, If any other ID, use the second Square account API keys.

    function alternate_square_payment_ids( $gateways ) {
    
    if ( is_product( array (1, 2, 3 ) ) ) {
    
       return;   // Use application_id and access_token as entered in the Woocommerce Square plugin settings
    
        // Use a second Square account ID and token for all other product IDs: 
    
        $gateways['square']['application_id'] = 'second_account_application_id';
    
        $gateways['square']['access_token'] = second_account_access_token';
    
    }
    
    return $gateways;

    Are the application_id and access_token all I need to use in order to switch between two Square accounts?

    Will switching API keys effect Woocommerce Subscriptions, if used?

    Thanks for any advice and help

    • This topic was modified 8 months, 3 weeks ago by bluedogranch.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey there, @bluedogranch! Thanks for contacting us. I’m happy to help you.

    While we can’t provide support for code customization as per our support policy, we do our best to offer advice and direct you to appropriate resources.

    You can visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there too.

    I’m going to leave it open for a bit to see if anyone is able to chime in and help you out further.

    Having said that, I believe a simpler way to achieve this, is getting another payment gateway, such as Stripe or PayPal, for example, and using a plugin like Conditional Shipping and Payments to choose which payment method can be used in each product.

    I hope this helps.

    Please let us know if there’s anything else we can help you with.

    Have a wonderful day!

    Thread Starter bluedogranch

    (@bluedogranch)

    Hi,

    Thanks for the response, but I see you offering code in other threads for other issues. You can’t tell me what hook to try?

    I tried WooCommerce Community Slack a few weeks ago and got no answer.

    And I’m using Square, not PayPal or Stripe, so there’s no reason for me to add different payment gateway and use the Conditional Payments plugin.

    • This reply was modified 8 months, 3 weeks ago by bluedogranch.
    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi there @bluedogranch,

    I understand your concern about not receiving the code support you expected, but just to clarify, due to the complexity of your issue, it’s difficult to provide an accurate working code.

    As you already asked for assistance from the Slack channel but did not receive any answer, I suggest hiring a developer or a freelancer specializing in WooCommerce. You can find more channels below:

    Hope this helps!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Switching between two Square accounts?’ is closed to new replies.