{"id":24936905,"url":"https://github.com/smarty-pay/smartypay-node-sdk","last_synced_at":"2025-04-10T01:13:39.803Z","repository":{"id":57689270,"uuid":"485699835","full_name":"smarty-pay/smartypay-node-sdk","owner":"smarty-pay","description":"Simple library for creating invoices on backend side","archived":false,"fork":false,"pushed_at":"2024-11-19T09:10:18.000Z","size":504,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-10T01:13:34.670Z","etag":null,"topics":["backend","nodejs","sdk"],"latest_commit_sha":null,"homepage":"","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/smarty-pay.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,"publiccode":null,"codemeta":null}},"created_at":"2022-04-26T08:32:44.000Z","updated_at":"2024-11-19T09:09:59.000Z","dependencies_parsed_at":"2024-04-22T08:57:15.377Z","dependency_job_id":"2e683da5-a0e9-40a1-a7a0-a155ef18aae5","html_url":"https://github.com/smarty-pay/smartypay-node-sdk","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"db4d0901e20461ebc4b31734f7f4604db70d0b07"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarty-pay%2Fsmartypay-node-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarty-pay%2Fsmartypay-node-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarty-pay%2Fsmartypay-node-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarty-pay%2Fsmartypay-node-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smarty-pay","download_url":"https://codeload.github.com/smarty-pay/smartypay-node-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137891,"owners_count":21053775,"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":["backend","nodejs","sdk"],"created_at":"2025-02-02T16:57:42.023Z","updated_at":"2025-04-10T01:13:39.771Z","avatar_url":"https://github.com/smarty-pay.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smarty Pay Node SDK\nSimple library for creating payments on backend side\n\n## Installation\n```shell\nnpm i smartypay-node-sdk\n```\n\n## Usage\n\n### Create payment\n\n[See docs](https://docs.smartypay.io/general/authentication#signing-requests)\n\n```typescript\nimport { SmartyPayAPI } from 'smartypay-node-sdk';\n\nasync function createPayment() {\n  \n  // call API \n  const api = new SmartyPayAPI({\n    secretKey: 'YOUR_SECRET_KEY',\n    publicKey: 'YOUR_API_KEY',\n  });\n  \n  const payment = await api.payments.createPayment({\n    amount: {\n      value: '1',\n      currency: 'bUSDT',\n    },\n    expiresAt: new Date(Date.now() + 1000 * 60 * 60), // optional: after 1 hour from now\n    metadata: { orderId: 'YOUR_PURCHASE_ID' } // optional: any metadata\n  });\n  \n  // result payment id\n  const paymentId = payment.id;\n\n  // additional params:\n  const params = new URLSearchParams();\n  // params.set('name', 'Item Name to Buy');\n  // params.set('success-url', 'https://...');\n  // params.set('fail-url', 'https://...');\n\n  // final url be like \"https://checkout.smartypay.io/XXXXXXX?...\"\n  const urlToRedirect = 'https://checkout.smartypay.io/' + paymentId + '?' + params.toString();\n}\n```\n- **amount** - Amount for a payment (value and currency token). See valid tokens here: https://docs.smartypay.io/general/supported-tokens\n- **expiresAt** - Optional: date before payment is active\n- **metadata** - Optional: key-value for any custom metadata (usually it's your own purchase id for success webhook)\n\nApi common config:\n- **secretKey** - You can get it here: https://dashboard.smartypay.io/\n- **publicKey** - You can get it here: https://dashboard.smartypay.io/\n\n\n### Create client's recharge address\n\n[See docs](https://docs.smartypay.io/api/recharge-payments)\n\n```typescript\nimport { SmartyPayAPI } from 'smartypay-node-sdk';\n\nasync function createRechargeAddress(customerId: string) {\n  \n  // call API\n  const api = new SmartyPayAPI({\n    secretKey: 'YOUR_SECRET_KEY',\n    publicKey: 'YOUR_API_KEY',\n  });\n  \n  const resp = await api.recharges.createRechargeAddress({\n    token: 'bUSDT',\n    customerId: customerId,\n  });\n  \n  // recharge address for your customerId\n  const rechargeAddress = resp.address;\n}\n```\n- **token** - See valid tokens here: https://docs.smartypay.io/general/supported-tokens\n- **customerId** - Customer's id from your own system\n\nApi common config:\n- **secretKey** - You can get it here: https://dashboard.smartypay.io/\n- **publicKey** - You can get it here: https://dashboard.smartypay.io/\n\n### Check webhook signature\n\n[See docs](https://docs.smartypay.io/api/webhooks)\n\n```typescript\nfunction isValidWebhook( resp: Respone){\n\n  // See: https://docs.smartypay.io/api/webhooks\n  const body: string = resp.body;\n  const signature: string = resp.heades['x-api-digest'];\n  \n  return SmartyPayAPI.utils.isValidSignature(body,  signature, 'YOUR_SECRET_KEY');\n}\n```\n\n## Full API docs\nCheckout our [TypeDocs](https://smarty-pay.github.io/smartypay-node-sdk/modules.html)\n\n## Build steps\n### Clone repository into your dir\n```shell\ncd your_dir\ngit clone https://github.com/smarty-pay/smartypay-node-sdk\n```\n\n### Build\n```shell\nnpm install\nnpm run build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmarty-pay%2Fsmartypay-node-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmarty-pay%2Fsmartypay-node-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmarty-pay%2Fsmartypay-node-sdk/lists"}