Support

Home Forums Event Espresso Premium how to limit payment by country but still register

how to limit payment by country but still register

Posted: April 13, 2020 at 2:16 pm

Viewing 12 reply threads


Kerry@novalda.com

April 13, 2020 at 2:16 pm

Hi, we need to open some virtual courses rather than the in-person ones for a short time. Is there a way to stop payments if they are out of Canada? We would like to limit it so only people in Canada can register. It would be ok if they registered but if they are from another country they should be taking the course through that country instead. Ideally we’d like anyone out of country to be able to register but not pay and notify us so we can communicate directly about it. (The prices are cheaper for the Canadian courses so people from out of country may want to sign up here but they should be using the one from their own country if available).

If this is not currently possible, is there someone we could hire to write the code to set it up?

Thanks for your help!


Josh

  • Support Staff

April 13, 2020 at 6:20 pm

Hi,

This may be possible. May I ask which payment method(s) does your site use to collect payments?

At a minimum though, the Payment Information step could be customized to include instructions to use an Invoice payment option if their billing address is outside of Canada.


Kerry@novalda.com

April 13, 2020 at 6:29 pm

Hi again, we’re currently using Stripe.

This is basically meant to stop people from paying so we can recommend they go through their own country’s site. It’s cheaper in Canadian funds so they may try just to save money. They can take our course, but we’d then need to pay a fee to the other country so we’re trying to minimize that and identify anyone who isn’t in-country.

thanks!


Josh

  • Support Staff

April 14, 2020 at 1:38 pm

What you could do is set up the Stripe gateway to require the billing address, then add some code so “Canada” is the only option for the Country field. This way only those that have a billing address in Canada can complete the credit card payment form.

Here’s how to do that:
1) You go to Event Espresso > Payment Methods > Stripe
2) Set Integration Type to Stripe Elements
3) Set Collect the user’s billing address? to Yes
4) Optionally add a note in the Description field to include instructions for how to pay if outside of Canada
5) Click the Update button to save the above changes
6) Add the code from this gist to a site-specific plugin on your site:

https://gist.github.com/joshfeck/caaacef4587ba906ec414f6f2120f634

You can add the code to a functions plugin.

If you have other events where it will be allowed for everyone to pay, you can set up payment methods for specific events by using the Payment Methods Pro add-on. In this case, you could set up a separate payment method (also using Stripe) which can be specifically set for other events.


Kerry@novalda.com

April 14, 2020 at 3:22 pm

Hi there, thanks so much for this info! Unfortunately I’m a designer, not a coder, so I don’t know how to add code to a functions plugin. Do you mean I’d make a child theme and add this to functions.php? I don’t know how to do hooks and that sort of thing.

We are wondering if we could hire you or someone you could recommend to set this up for us and what would be the cost.

thanks so much!


Josh

  • Support Staff

April 14, 2020 at 4:37 pm

We’ve put together a step by step guide that explains how to make a functions plugin:
https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

Adding code to a functions plugin is much like to adding code to a theme’s functions.php file. If you’ve added code to a theme’s functions.php file before, you’ll find the process to be similar. There are a few reasons why we recommend adding the code to a plugin though:
1) WordPress loads plugins before themes, so an Event Espresso customization like this one will load in the correct order. In other words, the code may not load in time to work if loaded from a theme file.
2) If you later want to remove the customization, you simply deactivate the plugin.

If you prefer that Event Espresso staff copy and paste code into a file on your server we can do that if you purchase a priority support token.


Kerry@novalda.com

April 14, 2020 at 6:08 pm

OK, thank you. I have added the code, created the plugin and got it working. However, we need to have this only happen on certain courses. So I need to be able to do turn off that Canada limitation code. I’ve installed the Payment Methods Pro addon but it says it was deactivated because Multi Event Registration was also active, and the two are incompatible.

If I did turn off the multi-event registration, can you tell me the process I would need to follow to have some events use this new Canada limitation (site-specific plugin code) and some not?

Also, does the Payments pro Addon do similar things as the multi-event Addon, I assume we will need to do without that functionality to have this one?

Thanks so much for your excellent help so far.


Josh

  • Support Staff

April 15, 2020 at 9:44 am

The Payment methods pro add-on makes it possible to set up specific payment methods for a specific event. Since the Multi Event Registration add-on makes it possible for two or more different events to be added to the cart, where each event could have a different payment method, the MER add-on cannot be used alongside Payment Methods Pro.

Here’s how you can set up a second Stripe payment method and use that payment method for the events with the Canada limitation:

1) You’ll activate the Payment Methods Pro add-on
2) You go to Event Espresso > Payment Methods > Stripe
3) Click “Activate Another Stripe Payment Method”
4) This will add a new payment method: Stripe 2
5) You’ll set up the new Stripe 2’s settings as follows:
a) set Admin-Only Name to something like “Stripe for Canada only”
b) Click Connect with Stripe and follow the prompts to connect your Stripe account
c) Set “Collect the user’s billing address?” to Yes
d) Set “Available By Default” to No
e) Click the Update button
6) You’ll make one change to the code this line:
https://gist.github.com/joshfeck/caaacef4587ba906ec414f6f2120f634#file-auto-fill_country_stripe-php-L44
You’ll change:
$custom_js .= 'jQuery("#stripe-payment-intent-and-elements-form-country option:not(:selected)").remove();';
to:
$custom_js .= 'jQuery("#spco-payment-method-info-stripe_onsite-2 #stripe-payment-intent-and-elements-form-country option:not(:selected)").remove();';
This change will make it so the other country options are removed only if the event is using the payment method with the Canada limitation
7) Go to edit the events that need the Canada limitation and you’ll find a box with a heading “Payment Methods”. You’ll select “Stripe for Canada only” there.


Kerry@novalda.com

April 15, 2020 at 9:58 pm

Nice! That sounds good, I’ll try that tomorrow.

Another question – I found out that we need to charge taxes based on the customer’s location (province within Canada). There are several different PSTs being charged in different provinces, although where we live in Alberta there is only GST. How can I do that during the transaction?

thanks again, you’ve been great!


Kerry@novalda.com

April 16, 2020 at 1:45 pm

Hi, sorry for the extra question but it pertains to my last one and I just want to check before I install – will a tax calculation service like quaderno or Taxjar work with EE? thanks again.


Josh

  • Support Staff

April 16, 2020 at 1:55 pm

Hi,

Quaderno or Taxjar work with WooCommerce/Easy Digital Downloads. I’m not aware of any add-ons for EE. This is something you can add to your site specific plugin though. Here’s the code:

https://gist.github.com/joshfeck/bc4ffb1d4417258fce3ce32e00d25ea8


Kerry@novalda.com

April 16, 2020 at 2:09 pm

Oh cool! So we’re good for Canada then, for the moment, thank you (we’re trying to get these events live & available today).

What would you recommend we use to sell worldwide and still collect the necessary taxes? Normally the courses are in-person but with the Coronavirus everything is moving to virtual so there must be lots of people needing to do this now.


Kerry@novalda.com

April 16, 2020 at 10:30 pm

Hi again, we’ve found out that she doesn’t need to charge taxes if teaching virtually in person rather than having an automated course, so we’re OK without this functionality for the time being. I’ll keep this code for other offerings, though. If you do have an addon or system for how to do that later on, I’d love to know about it. Thanks so much for your help, you’ve been excellent.

Viewing 12 reply threads

The support post ‘how to limit payment by country but still register’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso