Support

Home Forums Event Espresso Premium How to implement provincial tax into Paypal Pro onsite payment

How to implement provincial tax into Paypal Pro onsite payment

Posted: February 15, 2017 at 1:55 pm

Viewing 10 reply threads


psg_napkin_dev

February 15, 2017 at 1:55 pm

Hi,
This question is a continuation of this forum post: https://eventespresso.com/topic/need-to-be-able-to-charge-provincial-state-taxes-with-ee4-paypal-pro/

The code linked to only seems to be able to add a fixed dollar amount, where as we would need it to add a percentage on top of what we charge. Is it possible to get the price of that certain ticket from somewhere?

I’m also a bit confused on where this code should go. I’ve managed to do the templates just fine, but this is my first foray into hooks and filters.

You can take a look at our pricing structure here:
http://dev.napkinmarketing.com/psg16/wp/events/webinar-9/

Much Appreciated,
Jason


Josh

  • Support Staff

February 16, 2017 at 12:22 pm

Hi Jason,

I’ll follow up with each of your questions below:

The code linked to only seems to be able to add a fixed dollar amount, where as we would need it to add a percentage on top of what we charge. Is it possible to get the price of that certain ticket from somewhere?

You’re correct that the code in the example adds a fixed dollar amount, but the code can be changed to add a percentage amount instead. Here’s a link to a variation of the original gist that shows how to add a percentage surcharge:

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

I’m also a bit confused on where this code should go. I’ve managed to do the templates just fine, but this is my first foray into hooks and filters.

You add the custom code to a custom functions plugin .


psg_napkin_dev

February 17, 2017 at 12:31 pm

Hey Josh,

You solution worked perfectly, thank you! You should look into building this solution in officially, I think the way you’ve implemented the tax calculation is awesome.

Thanks again,
Jason


Josh

  • Support Staff

February 17, 2017 at 12:52 pm

Hi Jason,

The hooks are built into core to add the ability to extend EE to make it fit a very specific use case. A few things to keep in mind is not everyone uses Event Espresso is in Canada, and not everyone in Canada that uses Event Espresso needs to charge different provincial taxes. So for those reasons we’re not planning on adding the additional functions to handle transaction surcharges into core.


psg_napkin_dev

February 17, 2017 at 12:56 pm

Hi Josh,

Take a look at this site, specifically this section here:

http://canadabusiness.ca/government/taxes-gst-hst/federal-tax-information/overview-of-charging-and-collecting-sales-tax/#toc0

“Charging sales tax to out-of-province/territory customers and to foreign customers

If you are a vendor in one province or territory and you make sales to residents of another province or territory, what sales taxes do you charge them? When you sell and ship or deliver taxable goods and services to out-of-province/territory customers, the sales tax that applies in your customer’s province or territory is generally applicable.”

I completely understand that Canadians are an underwhelming percentage of your userbase though, and it wouldn’t make sense to invest time into it. Thanks again for the help.

– Jason


Josh

  • Support Staff

February 17, 2017 at 2:53 pm

Hi Jason,

You might be surprised that all of the full-time developers of Event Espresso live in Canada, and it’s not a lack of interest or numbers that would prevent us from building specific solutions. My point is even within the group of Canadian users of Event Espresso, they’re not necessarily selling tickets to events to people located outside their province. These same users may need to add surcharges for other things, and that’s why we try to keep things open and extensible.


psg_napkin_dev

February 21, 2017 at 11:28 am

Hi Josh,

Thanks for following up, that does make sense. I have another small question pertaining to this.

How do I make it so that this question is a system question group – akin to how the personal information group cannot be removed from the primary registrant and is automatically included with every new event.

Essentially, I want it so that this question is automatically checked off in every new event for the primary registrant, in case my client forgets to include this question.

Thanks for all your help,
Jason


Josh

  • Support Staff

February 21, 2017 at 11:51 am

You can assign the question to the Personal Information group by going to Event Espresso > Registration Form > Question groups, then check the box next to the question. You’ll also need to remove the question from what ever question group it’s set to now.


psg_napkin_dev

February 28, 2017 at 7:52 am

Hi Josh,

I was doing a bit of testing on this, and I’ve come to realize that if there are multiple attendees, the last attendee’s billing address will be used, and not the primary registrant. How can I change the code to only use the primary registrants billing address?

Thanks,
Jason


psg_napkin_dev

February 28, 2017 at 8:20 am

I’ve managed to figure this out after a bit of prodding and hacking, although I still am interested in a better way of doing this.

Essentially, the code uses a foreach loop. I simply installed a counter here:

$i = 0;
if ( isset( $_REQUEST[ 'ee_reg_qstn' ] ) ) {
foreach ( $_REQUEST[ 'ee_reg_qstn' ] as $registrations ) {

if ( ! empty( $registrations ) ) {
$i++;
if($i < 2 ){
foreach ( $registrations as $QST_ID => $response ) {

I then created these CSS classes (14 is the number that this question is for me)

.ee-reg-qstn-14-input-dv{
display:none;
}
.first-billing{
display:block !important;
}

and added this JQuery code to attach the .first-billing class to the first instance of the field.
$('.ee-reg-qstn-14-input-dv').eq(0).addClass('first-billing');

Hope this helps anyone in need.


Josh

  • Support Staff

March 3, 2017 at 1:00 pm

Hi Jason,

Another approach would be to move the question to its own group, then use the code from this gist to make it so that question group is always checked:

https://gist.github.com/joshfeck/70ef3d761d1e3bf4228a1e015ff312b6

Viewing 10 reply threads

The support post ‘How to implement provincial tax into Paypal Pro onsite payment’ 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