Sandbox payment in CAD currency

I’m trying to test sandbox payments in CAD and getting this error:

[{:code=>"BAD_REQUEST", :detail=>"This application is not allowed to accept currency CAD.", :category=>"INVALID_REQUEST_ERROR"}]

I’m using the sandbox test account for Canada.

The weird thing for me is that my CreateOrder request is passing. While it has the same :currency => "CAD" in its payload. But CreatePayment returns the above error

How can I fix that? Is there some currency/country setting in the application (besides the test account country) that I’m missing?

:wave: What’s the application Id that you are getting the error with?

:wave:t3: it’s sandbox-sq0idb-5P7DNs8QyQLf0Dh4HVmOrg

I took a look at the request and the account and everything look good. The one thing I can’t confirm is the access token. Did you use the access token for your Canada account? You get this token by clicking the three dots next to “Open.” Once you click on view details select your app name and you will see the access token. :slightly_smiling_face:
Screen Shot 2021-06-11 at 8.31.59 AM

i cannot see it. It says

This authorization was created via the API. You can still renew or revoke this authorization programatically.

but I’m pretty sure there should be no problem with it because our accounts authorization, payments and everything works in production and there is no special logic for the new CAD account feature now. So I can’t imagine why access tokens might not work for CAD. And again, like I said before, the CreateOrder request is passing. And they go one after another in our logic, using the same credentials for sure

btw there is a mistake. It’s programMatically

I’ve just confirmed. Both CreateOrder and CreatePayment requests use the same access token. They both use :currency => "CAD". Here is the created order id: SCrjAx2XCzqeaL4MmPE1S0NDJ7OZY. All the currencies in the OrderCreate response are CAD.

They go in the same transaction, so after CreateOrder I do CreatePayment request, using the just the same seller_client object (i.e. seller_client.create_order(payload1), then seller_client.create_payment(payload2)) which contains all the authentication data, and it returns the mentioned error

{:code=>“BAD_REQUEST”, :detail=>“This application is not allowed to accept currency CAD.”, :category=>“INVALID_REQUEST_ERROR”}

then I decided to try to actually replace the access_token with the wrong one just before the CreatePayment request and i got a different error

{:code=>“UNAUTHORIZED”, :detail=>“The Authorization http header of your request was incorrect or expired. The header value is expected to be of the for
mat "Bearer TOKEN" (without quotation marks), where TOKEN is a valid access token (e.g. "Bearer ABC123def456GHI789jkl0"). For more information, see https
://developer.squareup.com/docs/build-basics/using-rest-api#set-the-headers .”, :category=>“AUTHENTICATION_ERROR”}

so, i’m pretty sure there is no problem with the token

Looking at the account it looks like all the authorizations for the account now have been revoked. Do you have the refresh token to re-authorize the account so we can further troubleshoot. If not you’ll need to remove the account and create another CAD sandbox test account.

That’s not true. Here is the current authorization for my CAD account. Can we please try to proceed with this issue faster?

In that image there should be an access token that you would use to make API calls to Square as well as a refresh token. If you remove that account and create a new CAD account dose it display the tokens?

Ok, i’ve done that. There are two authorizations now for my “Default” app. The first is created together with this new “Canada Acc” creation (and it has its token visible in the UI), and the second one is created after I authorized it with my local application (and it has no token in the UI). I can confirm that the second one has the issue and behaves the same way as I described above

Took a closer look and noticed that you are collecting app_fee_money in the payment request and your default account is a USD account. Currently with Square you can’t accept app_fee_money in CAD if your default account is USD or any of our other supported currencies. If you remove the app_fee_money from the request the payment will go through. If you are planning on collecting app_fee_money and want to test you can create a new Square account with the default currency in CAD. That way you will be able to test the app_fee_money :slightly_smiling_face:

Thanks, @Bryan-Square. I will look into it and let you know if I have any questions.

Offtopic: could you please tell me the correct names for the account that in my case is called “default” and the account that in my case is called “Canada Acc”? I keep confusing them because of a lack of terminology. Is it correct and will it be fully clear for the square support if the first one is called “Square application” and the second one “Square account”? Or there is a better terminology?

@Bryan-Square is this “default account should be in CAD” restriction valid for both sandbox and production or only for sandbox?

The default account is the account you automatically get when signing up with Square. It’s at the top of the list of sandbox accounts. The additional accounts that you can create in sandbox are designed to simulate your customer using your application in various different supported regions.

Also yes, the default account will also need to be in CAD if you are collecting a fee from customers that are charging in CAD. :slightly_smiling_face:

Yeah, that’s clear. I already did that and it works. Now I wonder if that should be done in production as well. Or it’s just for sandbox?

The behavior with app_fee_money will be the same in production as it is in sandbox.