{"id":35062134,"url":"https://github.com/craftgate/craftgate-node-client","last_synced_at":"2026-04-30T12:01:10.585Z","repository":{"id":37907847,"uuid":"318199671","full_name":"craftgate/craftgate-node-client","owner":"craftgate","description":"Node.js client for Craftgate API","archived":false,"fork":false,"pushed_at":"2026-04-01T12:17:18.000Z","size":648,"stargazers_count":37,"open_issues_count":8,"forks_count":4,"subscribers_count":12,"default_branch":"master","last_synced_at":"2026-04-01T14:19:05.787Z","etag":null,"topics":["client-library","craftgate","craftgate-api","javascript","nodejs","nodejs-client","payment","payment-gateway","payment-orchestration","typescript"],"latest_commit_sha":null,"homepage":"https://developer.craftgate.io","language":"TypeScript","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/craftgate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-12-03T13:18:58.000Z","updated_at":"2026-04-01T12:17:22.000Z","dependencies_parsed_at":"2023-12-13T13:45:33.261Z","dependency_job_id":"b69d7dd0-65ed-4366-98c6-f947b7285e88","html_url":"https://github.com/craftgate/craftgate-node-client","commit_stats":null,"previous_names":[],"tags_count":67,"template":false,"template_full_name":null,"purl":"pkg:github/craftgate/craftgate-node-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftgate%2Fcraftgate-node-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftgate%2Fcraftgate-node-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftgate%2Fcraftgate-node-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftgate%2Fcraftgate-node-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/craftgate","download_url":"https://codeload.github.com/craftgate/craftgate-node-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/craftgate%2Fcraftgate-node-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32463894,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["client-library","craftgate","craftgate-api","javascript","nodejs","nodejs-client","payment","payment-gateway","payment-orchestration","typescript"],"created_at":"2025-12-27T10:49:51.358Z","updated_at":"2026-04-30T12:01:10.580Z","avatar_url":"https://github.com/craftgate.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Craftgate Node.js Client\n[![Build Status](https://github.com/craftgate/craftgate-node-client/actions/workflows/craftgate-build.yml/badge.svg?branch=master)](https://github.com/craftgate/craftgate-node-client/actions?query=branch%3Amaster)\n[![Version](https://img.shields.io/npm/v/@craftgate/craftgate.svg)](https://www.npmjs.com/package/@craftgate/craftgate)\n[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/craftgate/craftgate-node-client)\n\nThis repo contains the Node.js client for Craftgate API.\n\n[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/craftgate/craftgate-node-client)\n\n## Requirements\n- Node.js v4.x+\n  - If you plan on using this library with older versions of Node (e.g. v0.10.x), you'll only need to include a `Promise` polyfill such as [bluebird](https://github.com/petkaantonov/bluebird)\n\n## Installation\n```bash\n$ npm install @craftgate/craftgate\n```\n\n## Usage\nTo access the Craftgate API you'll first need to obtain API credentials (e.g. an API key and a secret key). If you don't already have a Craftgate account, you can signup at [https://craftgate.io](https://craftgate.io)\n\nOnce you've obtained your API credentials, you can start using Craftgate by instantiating a `CraftgateClient` with your credentials.\n\n```js\nconst Craftgate = require('@craftgate/craftgate');\n\nconst craftgate = new Craftgate.Client({\n  apiKey: '\u003cYOUR API KEY\u003e',\n  secretKey: '\u003cYOUR SECRET KEY\u003e'\n});\n\n...\n```\n\nBy default the Craftgate client connects to the production API servers at `https://api.craftgate.io`. For testing purposes, please use the sandbox URL `https://sandbox-api.craftgate.io` using the .\n\n```js\nconst Craftgate = require('@craftgate/craftgate');\n\nconst craftgate = new Craftgate.Client({\n  apiKey: '\u003cYOUR API KEY\u003e',\n  secretKey: '\u003cYOUR SECRET KEY\u003e',\n  baseUrl: 'https://sandbox-api.craftgate.io'\n});\n\n...\n```\n\n### Bulk Import vs. Individual Imports\nThe root export of the project (e.g. `@craftgate/craftgate`) is designed primarily for CommonJS-style bulk imports, but the project also exports its modules individually, so you can also import them directly in ES6 fashion. On development environments where a transpiler such as Babel or TypeScript exists, we recommend using this approach.\n\nKeep in mind that when using direct imports, you'll have to import necessary modules individually. So this code:\n\n```js\nconst Craftgate = require('@craftgate/craftgate');\n\nconst craftgate = new Craftgate.Client({...});\n\ncraftgate.payment().createPayment({\n  ...,\n  currency: Craftgate.Model.Currency.TRY,\n  ...\n})\n...\n```\n\nbecomes like this:\n\n```js\nimport CraftgateClient from '@craftgate/craftgate/CraftgateClient';\nimport Currency from '@craftgate/craftgate/model/Currency';\n\nconst craftgate = new CraftgateClient({...});\n\ncraftgate.payment().createPayment({\n  ...,\n  currency: Currency.TRY,\n  ...\n})\n...\n```\n\nAlso, since we make use of default exports, if you wish to import these modules directly in CommonJS fashion (e.g. `require()`), then make sure you're accessing the `default` keyword of the module.\n\n```js\nconst CraftgateClient = require('@craftgate/craftgate/CraftgateClient'); // this won't work\n\n...\n\nconst CraftgateClient = require('@craftgate/craftgate/CraftgateClient').default; // however, this will\n```\n\n## Examples\nIncluded in the project are a number of examples that cover almost all use-cases. Refer to [the `samples/` folder](./samples)] for more info.\n\nAside from demonstrating different business use cases, we also added technically different variants of certain examples to reflect the diversity in technical stacks. These examples are located under the [samples/misc](./samples/misc) folder, and what they represent are indicated by filename suffixes listed below:\n\n| Filename Suffix | Description |\n|-----------------|-------------|\n| `.es5.js` | ES5-style JavaScript code with bulk CommonJS imports (e.g. `var` keyword for variables, `require()` keyword for imports, inline `function()` blocks) |\n| `.es6.js` | ES6-style JavaScript code with ES6 imports (e.g. `let/const` keyword for variables, `import` keyword for imports, lambda expressions) |\n| `.ts` | TypeScript code |\n| `.js` | Node.js v6+ (ES6-style JavaScript code with direct CommonJS imports) (e.g. `let/const` keyword for variables, `require()` keyword for imports, lambda expressions) |\n\n### Running the Examples\nIf you've cloned this repo on your development machine and wish to run the examples directly, make sure to install the dependencies using `npm i` and build the library using `npm run build`. Once the library is built, you can run an example with the command `node \u003cexample path\u003e` (e.g. `node samples/payment/RetrievePayment.js`).\n\nKeep in mind that the `node` interpreter cannot be used to execute TypeScript files, whereas the `ts-node` can. This interpreter does not ship with Node.js itself, so you'll either have to install it globally on your machine, or include it in your project as a dependency. This repository already includes it as a dev dependency, and exposes it as an NPM task with the name`ts-node`, so to run a TypeScript example you can simply execute the command `npm run ts-node \u003cexample path\u003e` (e.g. `npm run ts-node samples/misc/CreatePayment.ts`).\n\n### Credit Card Payment Use Case (ES5-Style)\nLet's quickly review an example where we implement a credit card payment scenario using an ES5-style approach\n\n\u003e For more examples covering almost all use-cases, check out the [examples in the `samples/` folder](./samples)\n\n```js\nvar Craftgate = require('../dist');\n\nvar craftgate = new Craftgate.Client({\n  apiKey: 'api-key',\n  secretKey: 'secret-key',\n  baseUrl: 'https://sandbox-api.craftgate.io'\n});\n\nvar request = {\n  price: 100.0,\n  paidPrice: 100.0,\n  walletPrice: 0.0,\n  installment: 1,\n  conversationId: '456d1297-908e-4bd6-a13b-4be31a6e47d5',\n  currency: Craftgate.Model.Currency.TRY,\n  paymentGroup: Craftgate.Model.PaymentGroup.ListingOrSubscription,\n  card: {\n    cardHolderName: 'Haluk Demir',\n    cardNumber: '5258640000000001',\n    expireYear: '2044',\n    expireMonth: '07',\n    cvc: '000'\n  },\n  items: [\n    {\n      name: 'Item 1',\n      price: 30.0,\n      externalId: '123d1297-839e-4bd6-a13b-4be31a6e12a8'\n    },\n    {\n      name: 'Item 2',\n      price: 50.0,\n      externalId: '789d1297-839e-4bd6-a13b-4be31a6e13f7'\n    },\n    {\n      name: 'Item 3',\n      price: 20.0,\n      externalId: '3a1d1297-839e-4bd6-a13b-4be31a6e18e6'\n    }\n  ]\n};\n\ncraftgate.payment().createPayment(request)\n  .then(function(result) {\n    console.info('Payment successful', result);\n  })\n  .catch(function(err) {\n    console.error('Payment failed', err);\n  });\n```\n\n## Development\nTo contribute to the project, please see our guidelines at [CONTRIBUTING](./CONTRIBUTING.md)\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftgate%2Fcraftgate-node-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcraftgate%2Fcraftgate-node-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcraftgate%2Fcraftgate-node-client/lists"}