# How to define Square Version C#?

**URL:** <https://developer.squareup.com/forums/t/how-to-define-square-version-c/5205>\
**Category:** Questions\
**Tags:** oauth-api\
**Created:** [February 18, 2022, 12:14am UTC](https://developer.squareup.com/forums/t/how-to-define-square-version-c/5205 "2022-02-18T00:14:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrianYeon](https://avatars.discourse-cdn.com/v4/letter/b/aeb1de/32.png) [@BrianYeon](https://developer.squareup.com/forums/u/BrianYeon)\
**Post date:** [February 18, 2022, 12:14am UTC](https://developer.squareup.com/forums/t/how-to-define-square-version-c/5205/1 "2022-02-18T00:14:24Z")

</div>

Hello,  
My friends, forgive me if I am doing wrong. Trying to revoke access token using version 2022-02-16. It was working fine with version 2022-01-20.

Can someone tell me how to specify Square version when creating Square client using c# please?  
Api explorer shows example for curl specifying version as ‘Square-Version: 2022-02-16’.  
I could modify my code using curl but there are too many lines already in my code.  
Below is my c# code specifying square version when creating client.

private SquareClient client;  
this.client = new SquareClient.Builder()  
.SquareVersion(“2022-01-20”) //\<— Does not work.  
.Environment(Program.squareproduction ? Square.Environment.Production : Square.Environment.Sandbox)  
.AccessToken(Program.squareproduction ? Properties.Resources.squareAccessToken : Properties.Resources.squareAccessTokenSandbox)  
.Build();

Using Properties.Resources value is OK in my case because this application is heavily obfuscated.

The problem is…  
My code was working ok on version “2022-01-20” when revoking access token (sending merchant\_id without access\_token as guided by API document) but new version “2022-02-16” 's Revoke Token API does not work when merchant\_id is provided without access\_token for calling Revoke Token API. I think this is Square API error for the version “2022-02-16”.

I also tried API explorer with hard coded. Result is error. Error message is asking basically I need provide access token. API document and API explorer says ‘do not send access token when sending merchant id.’

I could just send merchant’s access token instead of merchant id. However, I need to know [How to specify Square Version in c#] in case Square API version updates.

Can someone answer this please?

Thanks,

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [February 18, 2022, 1:22am UTC](https://developer.squareup.com/forums/t/how-to-define-square-version-c/5205/2 "2022-02-18T01:22:31Z")

</div>

👋 The version for the SDK client should be set like:

```auto
Square.SquareClient client = new Square.SquareClient.Builder()
    .AccessToken("AccessToken")
    .SquareVersion(GetEnvironmentVariable("2022-02-16"))
    .Environment(Square.Environment.Production)
    .CustomUrl("https://connect.squareup.com")
    .HttpClientConfig(config => config.NumberOfRetries(0))
    .Build();

```

However I just tested revoking a token with the `merchant_id` and it worked as expected. What are your steps to reproduce and what’s the error you’re getting? 🙂

---

<div class="post-metadata">

**Author:** ![BrianYeon](https://avatars.discourse-cdn.com/v4/letter/b/aeb1de/32.png) [@BrianYeon](https://developer.squareup.com/forums/u/BrianYeon)\
**Post date:** [February 18, 2022, 1:33pm UTC](https://developer.squareup.com/forums/t/how-to-define-square-version-c/5205/3 "2022-02-18T13:33:14Z")

</div>

Thank you for your response. I saved production merchant\_id in database and then set my application as sandbox for testing and passed production merchant\_id to revoke. This is my mistake.

API works fine. I apologize.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [February 18, 2022, 4:51pm UTC](https://developer.squareup.com/forums/t/how-to-define-square-version-c/5205/4 "2022-02-18T16:51:21Z")

</div>

Glad to hear you figured it out. Feel free to reach out if you have any additional questions. 🙂
