{"id":27151386,"url":"https://github.com/checkout/checkout-sdk-go","last_synced_at":"2025-04-08T14:40:17.588Z","repository":{"id":38819991,"uuid":"283459721","full_name":"checkout/checkout-sdk-go","owner":"checkout","description":"Checkout.com SDK for Go","archived":false,"fork":false,"pushed_at":"2025-03-28T10:21:00.000Z","size":1106,"stargazers_count":17,"open_issues_count":4,"forks_count":28,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-28T10:43:46.315Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/checkout.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-29T09:45:28.000Z","updated_at":"2025-03-19T09:55:12.000Z","dependencies_parsed_at":"2022-07-20T01:18:42.985Z","dependency_job_id":"45370ed9-ee36-4deb-bc10-aa4c63020d57","html_url":"https://github.com/checkout/checkout-sdk-go","commit_stats":null,"previous_names":[],"tags_count":57,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkout%2Fcheckout-sdk-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkout%2Fcheckout-sdk-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkout%2Fcheckout-sdk-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkout%2Fcheckout-sdk-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/checkout","download_url":"https://codeload.github.com/checkout/checkout-sdk-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247863680,"owners_count":21008948,"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":[],"created_at":"2025-04-08T14:40:16.938Z","updated_at":"2025-04-08T14:40:17.564Z","avatar_url":"https://github.com/checkout.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Checkout.com Golang SDK\n\n[![build-status](https://github.com/checkout/checkout-sdk-go/workflows/build-master/badge.svg)](https://github.com/checkout/checkout-sdk-go/actions/workflows/build-master.yml)\n![CodeQL](https://github.com/checkout/checkout-sdk-go/workflows/CodeQL/badge.svg)\n\n[![build-status](https://github.com/checkout/checkout-sdk-go/workflows/build-release/badge.svg)](https://github.com/checkout/checkout-sdk-go/actions/workflows/build-release.yml)\n[![GitHub release](https://img.shields.io/github/release/checkout/checkout-sdk-go.svg)](https://github.com/checkout/checkout-sdk-go/releases/)\n[![Go Reference](https://pkg.go.dev/badge/github.com/checkout/checkout-sdk-go.svg)](https://pkg.go.dev/github.com/checkout/checkout-sdk-go)\n\n[![GitHub license](https://img.shields.io/github/license/checkout/checkout-sdk-go.svg)](https://github.com/checkout/checkout-sdk-go/blob/master/LICENSE.md)\n\n## Getting started\n\n\u003e **Version 1.0.0 is here!**\n\u003e \u003cbr/\u003e\u003cbr/\u003e\n\u003e We improved the initialization of SDK making it easier to understand the available options. \u003cbr/\u003e\n\u003e Now `NAS` accounts are the default instance for the SDK and `ABC` structure was moved to a `previous` prefixes. \u003cbr/\u003e\n\n### Module installer\nMake sure your project is using Go Modules:\n```sh\ngo get github.com/checkout/checkout-sdk-go@{version}\n```\nThen import the library into your code:\n```sh\nimport \"github.com/checkout/checkout-sdk-go\"\n```\n\n### :rocket: Please check in [GitHub releases](https://github.com/checkout/checkout-sdk-go/releases) for all the versions available.\n\n### :book: Checkout our official documentation.\n\n* [Official Docs (Default)](https://docs.checkout.com/)\n* [Official Docs (Previous)](https://docs.checkout.com/previous)\n\n### :books: Check out our official API documentation guide, where you can also find more usage examples.\n\n* [API Reference (Default)](https://api-reference.checkout.com/)\n* [API Reference (Previous)](https://api-reference.checkout.com/previous)\n\n## How to use the SDK\n\nThis SDK can be used with two different pair of API keys provided by Checkout. However, using different API keys imply\nusing specific API features. \u003c/br\u003e\nPlease find in the table below the types of keys that can be used within this SDK.\n\n| Account System | Public Key (example)                    | Secret Key (example)                    |\n|----------------|-----------------------------------------|-----------------------------------------|\n| Default        | pk_pkhpdtvabcf7hdgpwnbhw7r2uic          | sk_m73dzypy7cf3gf5d2xr4k7sxo4e          |\n| Previous       | pk_g650ff27-7c42-4ce1-ae90-5691a188ee7b | sk_gk3517a8-3z01-45fq-b4bd-4282384b0a64 |\n\nNote: sandbox keys have a `sbox_` or `test_` identifier, for Default and Previous accounts respectively.\n\nIf you don't have your own API keys, you can sign up for a test\naccount [here](https://www.checkout.com/get-test-account).\n\n**PLEASE NEVER SHARE OR PUBLISH YOUR CHECKOUT CREDENTIALS.**\n\n### Default\n\nDefault keys client instantiation can be done as follows:\n\n```go\nimport (\n    \"github.com/checkout/checkout-sdk-go\"\n    \"github.com/checkout/checkout-sdk-go/configuration\"\n)\n\napi, err := checkout.Builder().\n                     StaticKeys().\n                     WithEnvironment(configuration.Sandbox()).\n                     WithSecretKey(\"secret_key\").\n                     WithPublicKey(\"public_key\"). // optional, only required for operations related with tokens\n                     Build()\n```\n\n### Default OAuth\n\nThe SDK supports client credentials OAuth, when initialized as follows:\n\n```go\nimport (\n    \"github.com/checkout/checkout-sdk-go\"\n    \"github.com/checkout/checkout-sdk-go/configuration\"\n)\n\napi, err := checkout.Builder().\n                     OAuth().\n                     WithAuthorizationUri(\"https://access.sandbox.checkout.com/connect/token\"). // optional, custom authorization URI\n                     WithClientCredentials(\"client_id\", \"client_secret\").\n                     WithEnvironment(configuration.Sandbox()).\n                     WithScopes(getOAuthScopes()).\n                     Build()\n```\n\n### Previous\n\nIf your pair of keys matches the previous system type, this is how the SDK should be used:\n\n```go\nimport (\n    \"github.com/checkout/checkout-sdk-go\"\n    \"github.com/checkout/checkout-sdk-go/configuration\"\n)\n\napi, err := checkout.Builder().\n                     Previous().\n                     WithEnvironment(configuration.Sandbox()).\n                     WithSecretKey(\"secret_key\").\n                     WithPublicKey(\"public_key\"). // optional, only required for operations related with tokens\n                     Build()\n```\n\nThen just get any client, and start making requests:\n\n```go\nimport (\n    \"github.com/checkout/checkout-sdk-go/payments\"\n    \"github.com/checkout/checkout-sdk-go/payments/nas\"\n)\n\nrequest := nas.PaymentRequest{}\nresponse, err := api.Payments.RequestPayment(request)\n```\n\n## Error Handling\n\nAll the API responses that do not fall in the 2** status codes will return a `errors.CheckoutApiError`. The\nerror encapsulates the `StatusCode`, `Status` and a the `ErrorDetails`, if available.\n\n## Custom Http Client\nGo SDK supports your own configuration for `http client` using `http.Client` from the standard library. You can pass it through when instantiating the SDK as follows:\n\n```go\nimport (\n    \"net/http\"\n    \n    \"github.com/checkout/checkout-sdk-go\"\n    \"github.com/checkout/checkout-sdk-go/configuration\"\n)\n\nhttpClient := http.Client{\n    Timeout: time.Duration(20) * time.Millisecond,\n}\n\napi, err := checkout.Builder().\n                     StaticKeys().\n                     WithEnvironment(configuration.Sandbox()).\n                     WithHttpClient(\u0026httpClient).\n                     WithSecretKey(\"secret_key\")).\n                     WithPublicKey(\"public_key\")). // optional, only required for operations related with tokens\n                     Build()\n```\n\n## Logging\n\nThe SDK supports custom Log provider. You can provide your log configuration via SDK initialization. By default, the SDK uses the `log` package from the standard library.\n\n```go\nimport (\n    \"log\"\t\n\t\n    \"github.com/checkout/checkout-sdk-go\"\n    \"github.com/checkout/checkout-sdk-go/configuration\"\n)\n\nlogger := log.New(os.Stderr, \"checkout-sdk-go - \", log.LstdFlags)\n\napi, err := checkout.Builder().\n                     StaticKeys().\n                     WithEnvironment(configuration.Sandbox()).\n                     WithSecretKey(\"secret_key\")).\n                     WithPublicKey(\"public_key\")). // optional, only required for operations related with tokens\n                     WithLogger(logger) // your own custom configuration\n                     Build()\n```\n\n## Custom Environment\nIn case that you want to use an integrator or mock server, you can specify your own URI configuration as follows:\n\n```go\nimport (\n    \"github.com/checkout/checkout-sdk-go\"\n    \"github.com/checkout/checkout-sdk-go/configuration\"\n)\n\nenvironment := configuration.NewEnvironment(\n\t\"https://the.base.uri/\", // the uri for all CKO operations \n\t\"https://the.oauth.uri/connect/token\", // the uri used for OAUTH authorization, only required for OAuth operations \n\t\"https://the.files.uri/\", // the uri used for Files operations, only required for Accounts module \n\t\"https://the.transfers.uri/\", // the uri used for Transfer operations, only required for Transfers module \n\t\"https://the.balances.uri/\", // the uri used for Balances operations, only required for Balances module false \n)\n\napi, err := checkout.Builder().\n                     StaticKeys().\n                     WithEnvironment(environment).\n                     WithSecretKey(\"secret_key\")).\n                     WithPublicKey(\"public_key\")). // optional, only required for operations related with tokens\n                     Build()\n```\n\n## Building from source\n\nOnce you check out the code from GitHub, the project can be built using:\n\n```sh\ngo mod tidy\n\ngo build\n```\n\nThe execution of integration tests require the following environment variables set in your system:\n\n* For default account systems (NAS): `CHECKOUT_DEFAULT_PUBLIC_KEY` \u0026 `CHECKOUT_DEFAULT_SECRET_KEY`\n* For default account systems (OAuth): `CHECKOUT_DEFAULT_OAUTH_CLIENT_ID` \u0026 `CHECKOUT_DEFAULT_OAUTH_CLIENT_SECRET`\n* For Previous account systems (ABC): `CHECKOUT_PREVIOUS_PUBLIC_KEY` \u0026 `CHECKOUT_PREVIOUS_SECRET_KEY`\n\n## Telemetry\nRequest telementry is enabled by default in the Go SDK. Request latency is included in the telemetry data. Recording the request latency allows Checkout.com to continuously monitor and imporove the merchant experience.\n\nRequest telemetry can be disabled by opting out during checkout_sdk_builder builder step:\n\n```\napi := checkout.Builder().\n    Previous().\n    WithSecretKey(\"CHECKOUT_PREVIOUS_SECRET_KEY\").\n    WithEnvironment(configuration.Sandbox()).\n    WithEnableTelemetry(false).\n    Build()\n```\n\n## Code of Conduct\n\nPlease refer to [Code of Conduct](CODE_OF_CONDUCT.md)\n\n## Licensing\n\n[MIT](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckout%2Fcheckout-sdk-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheckout%2Fcheckout-sdk-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckout%2Fcheckout-sdk-go/lists"}