{"id":13415172,"url":"https://github.com/square/connect-csharp-sdk","last_synced_at":"2025-03-14T22:32:57.209Z","repository":{"id":53043993,"uuid":"64772048","full_name":"square/connect-csharp-sdk","owner":"square","description":"C# client library for the Square Connect APIs","archived":true,"fork":false,"pushed_at":"2019-12-17T20:30:47.000Z","size":3408,"stargazers_count":27,"open_issues_count":3,"forks_count":25,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-10-06T00:48:53.266Z","etag":null,"topics":["sdk"],"latest_commit_sha":null,"homepage":"https://docs.connect.squareup.com/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/square.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-02T16:07:33.000Z","updated_at":"2023-12-03T16:13:21.000Z","dependencies_parsed_at":"2022-09-09T18:55:17.638Z","dependency_job_id":null,"html_url":"https://github.com/square/connect-csharp-sdk","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fconnect-csharp-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fconnect-csharp-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fconnect-csharp-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/square%2Fconnect-csharp-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/square","download_url":"https://codeload.github.com/square/connect-csharp-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221513991,"owners_count":16835754,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sdk"],"created_at":"2024-07-30T21:00:44.512Z","updated_at":"2024-10-26T08:31:17.129Z","avatar_url":"https://github.com/square.png","language":"C#","readme":"![Square logo]\n\n# Square Connect .NET SDK - RETIRED\n\n---\n\n[![Build Status](https://travis-ci.org/square/connect-csharp-sdk.svg?branch=master)](https://travis-ci.org/square/connect-csharp-sdk)\n[![NuGet version](https://badge.fury.io/nu/Square.Connect.svg)](https://badge.fury.io/nu/Square.Connect)\n[![Apache-2 license](https://img.shields.io/badge/license-Apache2-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n==================\n\n## NOTICE: Square Connect .NET SDK retired\n\nThe Square Connect .NET SDK is retired (EOL) as of 2019-12-17 and will no longer\nreceive bug fixes or product updates. To continue receiving API and SDK\nimprovements, please follow the instructions below to migrate to the new\n[Square .NET SDK](https://github.com/square/square-dotnet-sdk).\n\n\nThe old Connect SDK documentation is available under the\n[`/docs` folder](./docs/README.md).\n\n\u003cbr/\u003e\n\n---\n\n* [Migrate to the Square .NET SDK](#migrate-to-the-square-net-sdk)\n  * [Update your package](#update-your-package)\n  * [Update your code](#update-your-code)\n* [Example code migration](#example-code-migration)\n* [Ask the Community](#ask-the-community)\n\n---\n\n\u003cbr/\u003e\n\n## Migrate to the Square .NET SDK\n\nFollow the instructions below to migrate your apps from the deprecated\n`Square.Connect` library to the new `Square` library.\n\n### Update your package\n\nReplace `Square.Connect` with the new `Square` package and update the version.\n\n### Update your code\n\n1. Change all instances of `using Square.Connect.Api` to `using Square`.\n1. Change all instances of `using Square.Connect.Model` to `using Square.Models`.\n1. Remove all instances of `using Square.Connect.Client`.\n1. Add a reference to `using Square.Exceptions` to anything that calls an endpoint.\n1. Update client instantiation to follow the method outlined below.\n\nTo simplify your code, we also recommend that you use method chaining to access\nAPIs instead of explicitly instantiating multiple clients.\n\n#### Client instantiation\n\n```csharp\nSquareClient square = new SquareClient.Builder()\n    .Environment(Square.Environment.Sandbox)\n    .AccessToken(\"YOUR_SANDBOX_ACCESS_TOKEN\")\n    .Build();\n// e.g to fetch a list of locations\nvar response = square.LocationsApi.ListLocationsAsync();\n```\n\n\u003cbr/\u003e\n\n---\n\n\u003cbr/\u003e\n\n## Example code migration\n\nAs a specific example, consider the code used to create a new customer\nprofile with the following `CreateCustomerRequest` object:\n\n```csharp\nvar bodyAddress = new Address.Builder()\n    .AddressLine1(\"500 Electric Ave\")\n    .AddressLine2(\"Suite 600\")\n    .Locality(\"New York\")\n    .AdministrativeDistrictLevel1(\"NY\")\n    .PostalCode(\"10003\")\n    .Country(\"US\")\n    .Build();\nvar body = new CreateCustomerRequest.Builder()\n    .GivenName(\"Amelia\")\n    .FamilyName(\"Earhart\")\n    .EmailAddress(\"Amelia.Earhart@example.com\")\n    .Address(bodyAddress)\n    .PhoneNumber(\"1-212-555-4240\")\n    .ReferenceId(\"YOUR_REFERENCE_ID\")\n    .Note(\"a customer\")\n    .Build();\n```\n\nWith the deprecated `Square.Connect` library, this is how you instantiate a client\nfor the Customers API, format the request, and call the endpoint:\n\n```csharp\nusing System;\nusing System.Diagnostics;\nusing Square.Connect.Api;\nusing Square.Connect.Client;\nusing Square.Connect.Model;\n\n// Instantiate the client\nvar configuration = new Configuration(new ApiClient(\"https://connect.squareupsandbox.com\"));\nconfiguration.AccessToken = \"YOUR_SANDBOX_ACCESS_TOKEN\";\nvar customersApi = new CustomersApi(configuration);\n\n// Call the endpoint and handle the response\ntry\n{\n  // CreateCustomer\n  CreateCustomerResponse result = customersApi.CreateCustomer(body);\n  Debug.WriteLine(result);\n}\ncatch (Exception e)\n{\n  Debug.Print(\"Exception when calling CustomersApi.CreateCustomer: \" + e.Message );\n}\n```\n\nNow consider equivalent code using the new `Square` library:\n\n```csharp\nusing Square;\nusing Square.Models;\nusing Square.Exceptions;\n\n// Instantiate the client\nSquareClient square = new SquareClient.Builder()\n    .Environment(Square.Environment.Sandbox)\n    .AccessToken(\"YOUR_SQUARE_ACCESS_TOKEN\")\n    .Build();\n\n// Call the endpoint and handle the response\ntry\n{\n    CreateCustomerResponse result = square.CustomersApi.CreateCustomerAsync(body).Result;\n    // Business logic\n}\ncatch (APIException e)\n{\n    // Error Handling\n};\n```\n\nThat's it!\n\nWhat was once a multi-block process can be handled in 1 line of code. Migrating\nto the `Square` library reduces boilerplate and lets you focus on the parts of\nyour code that really matter.\n\n\u003cbr/\u003e\n\n---\n\n\u003cbr/\u003e\n\n## Ask the community\n\nPlease join us in our [Square developer community] if you have any questions!\n\n\n[//]: # \"Link anchor definitions\"\n[Square Logo]: https://docs.connect.squareup.com/images/github/github-square-logo.svg\n[Square .NET SDK gem]: https://github.com/square/square-dotnet-sdk\n[Square developer community]: https://squ.re/slack\n","funding_links":[],"categories":["E-Commerce and Payments","电子商务和支付","Csharp"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquare%2Fconnect-csharp-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquare%2Fconnect-csharp-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquare%2Fconnect-csharp-sdk/lists"}