Question about adding taxes with PHP

Hello,

I have 2 small questions about taxes. On my site I sell subscriptions.
Being in Canada, I have to charge taxes when the member is in Canada, but if the member is in France for example, I do not have to charge taxes.

My first question: Can I in my PHP code, when I create the subscription, add the taxes dynamically depending on whether the member is in Canada or not. So ± 15% if the member is in Canada and 0% elsewhere in the world! Is it possible? If yes, what is the API(sdk for PHP) please.

My second question, I use the Web Payment SDK with the verifyBuyer function. And in the VerifyBuyer, we have to put the price “amount”, for verification. Should the “amount” contain the price with taxes included.
For example, if I sell a product for $10 here in Canada, the total price is $11.50, so in the “amount” field, should I put $10 or it is better to put $11.50

Thank you so much !

Pascal

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Customize the Checkout Amount
Localize In-App Payments
Take a Cash Payment

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Hi !
Thanks for the reply, this does not answer my question! It is about taxes and the verifyBuyer function.

Thanks

Hi,

I found a solution and I would like to know if it is the right thing for subscriptions… via APIs in PHP (skd)

Here my code :

$body = new \Square\Models\CreateSubscriptionRequest($locationId, $Token);
$body->setIdempotencyKey($idempotencyKey);
$body->setPlanVariationId($planVariationId);
$body->setCardId($result->getCard()->getId());
$body->setCustomerId($customerId);
$body->setTaxPercentage("5.0"); // <---- i added this
$api_response = $client->getSubscriptionsApi()->createSubscription($body);

I added $body->setTaxPercentage(“5.0”); // for 5% taxs
and it seems to work and I have the right amount in the dashboard.

Is it OK to do it this way?

When there is no tax, I will not put this line, otherwise when there will be taxes, I change the “5.0” to the right tax percentage!

Is this way of doing things OK?

If so, there is only one question left to answer, which is : regarding the “amount” of verifybuyer, namely whether the amount should contain taxes?

Thank you

1 Like

Hey @pascalf1324! Yes, that’s the correct way to handle taxes with subscriptions.

For verifyBuyer, you’ll want to set the amount to the total that will be charged to the card (so including taxes, if present).

I would like to call out though that we have a new payment flow now that will allow you too take payments without having to explicitly call verifyBuyer. Square will automatically determine whether buyer verification is needed. You can find details here: Take a card Payment with the Web Payments SDK

Hi Josh

Thanks for your message and the explanations! It is very appreciated.

I have 2 questions regarding the BETA version of the payment flow.

1- When will the old version be deprecated? Will I receive a notification by email or other ? is there a date ?

2- Currently I ask for first name, last name, address, email, phone, city, region, country. With the BETA version, do I have to ask the user for this too or, Squareup will take care of it in the new version?

Thanks again, and have a great day!

1- There’s no set date for deprecation or retirement yet. For deprecations, we send out email notices to the email address associated with your Square developer account.

2- Information like billingContact is passed through the tokenize() method in the new flow: Set up the new payment flow

Thanks sooo much Josh !
Have a great weekend !

1 Like