{"id":27151404,"url":"https://github.com/checkout/checkout-sdk-node","last_synced_at":"2025-04-08T14:40:22.220Z","repository":{"id":38184042,"uuid":"242775876","full_name":"checkout/checkout-sdk-node","owner":"checkout","description":"Checkout.com SDK for Node.js. Documentation here:","archived":false,"fork":false,"pushed_at":"2024-04-19T10:55:04.000Z","size":2248,"stargazers_count":58,"open_issues_count":6,"forks_count":22,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-19T11:53:23.652Z","etag":null,"topics":["accept-card-payments","api-client","card-processing","credit-card","node-js-payments","online-payments","payment-gateway","payment-processing","payments","payouts","sdk","sdk-nodejs"],"latest_commit_sha":null,"homepage":"https://api-reference.checkout.com","language":"JavaScript","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","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-02-24T15:46:56.000Z","updated_at":"2024-04-23T12:36:25.555Z","dependencies_parsed_at":"2023-10-23T13:26:30.518Z","dependency_job_id":"13a398de-cfe2-4180-bc4b-9a6088a87229","html_url":"https://github.com/checkout/checkout-sdk-node","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkout%2Fcheckout-sdk-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkout%2Fcheckout-sdk-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkout%2Fcheckout-sdk-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/checkout%2Fcheckout-sdk-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/checkout","download_url":"https://codeload.github.com/checkout/checkout-sdk-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247863869,"owners_count":21008993,"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":["accept-card-payments","api-client","card-processing","credit-card","node-js-payments","online-payments","payment-gateway","payment-processing","payments","payouts","sdk","sdk-nodejs"],"created_at":"2025-04-08T14:40:21.715Z","updated_at":"2025-04-08T14:40:22.200Z","avatar_url":"https://github.com/checkout.png","language":"JavaScript","readme":"[![build-status](https://github.com/checkout/checkout-sdk-node/workflows/build-master/badge.svg)](https://github.com/checkout/checkout-sdk-node/actions/workflows/build-master.yml)\n![CI Tests](https://github.com/checkout/checkout-sdk-node/workflows/CI%20Tests/badge.svg)\n![CodeQL](https://github.com/checkout/checkout-sdk-node/workflows/CodeQL/badge.svg)\n[![codecov](https://codecov.io/gh/checkout/checkout-sdk-node/branch/master/graph/badge.svg?token=POL9EXI2IS)](https://codecov.io/gh/checkout/checkout-sdk-node)\n\n[![build-status](https://github.com/checkout/checkout-sdk-net/workflows/build-release/badge.svg)](https://github.com/checkout/checkout-sdk-net/actions/workflows/build-release.yml)\n[![GitHub release](https://img.shields.io/github/release/checkout/checkout-sdk-node.svg)](https://GitHub.com/checkout/checkout-sdk-node/releases/)\n\n[![zip badge](https://badgen.net/bundlephobia/minzip/checkout-sdk-node)](https://badgen.net/bundlephobia/minzip/action-test)\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://i.ibb.co/93zwP9m/SDK-Logo.png\" width=\"70%\"\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src='https://i.imgur.com/ubifkCL.gif' width='100%' alt='npm start'\u003e\n\u003c/p\u003e\n\n# :rocket: Install\n\n```bash\nnpm install checkout-sdk-node\n```\n\n# :computer: Import\n\n```js\n// ES6:\nimport { Checkout } from 'checkout-sdk-node';\n// Common JS:\nconst { Checkout } = require('checkout-sdk-node');\n```\n\n\u003e If you don't have your API keys, you can sign up for a test account [here](https://www.checkout.com/get-test-account).\n\n# :clapper: Initialize SDK\n\n## With api keys or access credentials\nBased on how your account was set up, you will either have a pair or API key or a set of access credentials. Here is how you can use the SDK in both scenarios:\n```js\n// API Keys\nconst cko = new Checkout('sk_XXXXXXXXX', {\n    pk: 'pk_XXXXXXX'\n});\n\n// Access credentials\nconst cko = new Checkout('your api secret here', {\n    client: 'ack_XXXXXXXX',\n    scope: ['gateway'], // or whatever scope required\n    environment: 'sandbox', // or 'production'\n});\n```\n\n## With environment variables\nIf your account uses API Keys (pk_XXX + sk_XXX), you can set the following environment variables, and the SK will pick them up:\n- *CKO_SECRET_KEY*    (with a value like sk_XXX)\n- *CKO_PUBLIC_KEY*   (with a value like pk_XXX)\n\nIf you use access credentials (ack_XXXX), you can set the following environment variables, and the SK will pick them up:\n- *CKO_SECRET*\n- *CKO_CLIENT*   (with a value like ack_XXXX)\n- *CKO_SCOPE*   (with a value of the scope or semicolon separated scopes in case you use multiple)\n- *CKO_ENVIRONMENT*   (with a value like sandbox or production)\n\n## Set custom config\nBasides the authentication, you also have the option to configure some extra elements about the SDK \n```js\nconst cko = new Checkout('...', {\n    ..., //other authentication config\n    host: \"https://myProxyExample.com\", // in case you need to use a custom host for tests\n    timeout: 60000,   // HTTP request timout in ms\n    agent: new http.Agent({ keepAlive: true }), // custom HTTP agent\n    httpClient: 'axios' // specify axios httpClient, by default fetch. Optional\n});\n```\n\n# :wrench: SDK Environment (Sandbox/Production)\nWhen using API Keys (pk_XXX + sk_XXX) the SDK will automatically figure out what environment you are using however, if you use access credentials (ack_XXXX), make sure you set the \"environment\" in the config, as shown above in the initialization. \n\n# :interrobang: Error handling\nThe SDK is using promises, and you can handle errors similar to any other HTTP call.\n\n```js\ntry {\n    // some async request made with the SDK\n    const action = await cko.payments.request({...});\n    ...\n} catch (error) {\n    console.log(error.name, error.http_code, error.body)\n    switch (error.name) {\n        ...\n    }\n}\n```\nHere you have all the possible SDK specific errors:\n\n| error.name           | error.http_code | error.body              |\n| -------------------- | --------------- | ----------------------- |\n| AuthenticationError  | 401             | undefined               |\n| ActionNotAllowed     | 403             | undefined               |\n| UrlAlreadyRegistered | 409             | undefined               |\n| NotFoundError        | 404             | undefined               |\n| BadGateway           | 502             | undefined               |\n| ValidationError      | 422             | object                  |\n| TooManyRequestsError | 429             | object/undefined        |\n| ValueError           | 429             | string describing error |\n\n\n# :book: Examples of usage\n\nYou can see examples of how to use the SDK for every endpoint documented in our  [API Reference](https://api-reference.checkout.com/). All you have to do is to navigate to the endpoint you want to use, and select \"Node\" for the example on the right side.\n\u003e NOTE: If you use access credentials (ack_XXXX) the link to the API reference relevant to you will be shared by your Solutions Engineers. \n\n# :eyeglasses: Try it on RunKit\n\nYou can try the SDK [here](https://npm.runkit.com/checkout-sdk-node).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckout%2Fcheckout-sdk-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheckout%2Fcheckout-sdk-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheckout%2Fcheckout-sdk-node/lists"}