MichaelFu Posted June 21, 2018 Share Posted June 21, 2018 Hello, is there a way to enable a Payment gateway only for certain customer? for example: all Customers >> Wire Transfer and PayPal Customer John Doo >> Wire Transfer and PayPal and AsiaPay thank you for help 0 Quote Link to comment Share on other sites More sharing options...
anderbytes Posted July 3, 2018 Share Posted July 3, 2018 This logic-based payment method showing would be useful for us, too. Anyone has a good hook for the invoice view page, for the generation of the payment dropdown, or maybe any tip on the template edit ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 4, 2018 Share Posted July 4, 2018 On 21/06/2018 at 18:20, MichaelFu said: is there a way to enable a Payment gateway only for certain customer? from the settings, No... On 21/06/2018 at 18:20, MichaelFu said: for example: all Customers >> Wire Transfer and PayPal Customer John Doo >> Wire Transfer and PayPal and AsiaPay i'd be tempted to do the logic the other way because I think AsiaPay needs to have the 'show on orderform' option ticked for it to be a gateway option at viewinvoice... so it's easier to remove a gateway than add one. Quote all Customers >> Wire Transfer and PayPal not AsiaPay Customer John Doo >> Wire Transfer and PayPal and AsiaPay which as a hook would be... <?php # ViewInvoice Gateway Hook # Written by brian! function hook_view_invoice_gateway($vars) { { if ($vars['status'] == 'Unpaid' && $vars['userid'] != '28') { $gatewaydropdown = $vars['gatewaydropdown']; $asiapay = '<option value="asiapay">AsiaPay</option>'; $gd2 = str_replace($asiapay, '', $gatewaydropdown); return array("gatewaydropdown" => $gd2); } } add_hook('ClientAreaPageViewInvoice', 1, 'hook_view_invoice_gateway'); ?> you will need to get the client ID value for John Doo (I know you could search for name, but you may have many John Doo - but their client IDs will be unique to each John Doo), which will be the #value on his clientsummary profile in the admin area... and then change the value of '28' in the above hook to whatever it is for John Doo - then John Doo will see all available gateways, everyone else will see all available gateways - except AsiaPay. for a one-off client, the above should be acceptable... if it turns out to need to apply to multiple clients, I would suggest putting their IDs in an array and using in_array, or assigning those users to a client group and then checking if they are a member of that group when deciding which gateways to show. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.