{"id":20308914,"url":"https://github.com/bchainhub/payto-rl","last_synced_at":"2025-04-16T01:36:30.274Z","repository":{"id":246891295,"uuid":"823670830","full_name":"bchainhub/payto-rl","owner":"bchainhub","description":"PayTo: Resource Locator","archived":false,"fork":false,"pushed_at":"2025-04-04T09:43:28.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-10T09:54:58.647Z","etag":null,"topics":["ach","cash","iban","ican","locator","payto","pix","prl","protocol","resource","uniform","upi","url"],"latest_commit_sha":null,"homepage":"https://payto.money","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bchainhub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["bchainhub"],"custom":["https://blockindex.net/address/cb7147879011ea207df5b35a24ca6f0859dcfb145999","https://www.blockchain.com/explorer/addresses/btc/bc1pd8guxjkr2p6n2kl388fdj2trete9w2fr89xlktdezmcctxvtzm8qsymg0d","https://www.blockchain.com/explorer/addresses/ltc/ltc1ql8dvx0wv0nh2vncpt9j3zqefaehsd25cwp7pfx"]}},"created_at":"2024-07-03T13:33:15.000Z","updated_at":"2025-04-04T09:42:51.000Z","dependencies_parsed_at":"2024-07-05T19:35:20.185Z","dependency_job_id":"7284c7fd-65de-4128-847b-cb90c1a173ce","html_url":"https://github.com/bchainhub/payto-rl","commit_stats":null,"previous_names":["bchainhub/payto-rl"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchainhub%2Fpayto-rl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchainhub%2Fpayto-rl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchainhub%2Fpayto-rl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchainhub%2Fpayto-rl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bchainhub","download_url":"https://codeload.github.com/bchainhub/payto-rl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249182758,"owners_count":21226118,"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":["ach","cash","iban","ican","locator","payto","pix","prl","protocol","resource","uniform","upi","url"],"created_at":"2024-11-14T17:24:33.230Z","updated_at":"2025-04-16T01:36:30.254Z","avatar_url":"https://github.com/bchainhub.png","language":"TypeScript","funding_links":["https://github.com/sponsors/bchainhub","https://blockindex.net/address/cb7147879011ea207df5b35a24ca6f0859dcfb145999","https://www.blockchain.com/explorer/addresses/btc/bc1pd8guxjkr2p6n2kl388fdj2trete9w2fr89xlktdezmcctxvtzm8qsymg0d","https://www.blockchain.com/explorer/addresses/ltc/ltc1ql8dvx0wv0nh2vncpt9j3zqefaehsd25cwp7pfx"],"categories":[],"sub_categories":[],"readme":"# Payto-RL\n\n`payto-rl` is a TypeScript library for handling Payto Resource Locators (PRLs). This library is based on the [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) API and provides additional functionality for managing PRLs.\n\n[![npm](https://img.shields.io/npm/v/payto-rl?label=npm\u0026color=cb3837\u0026logo=npm)](https://www.npmjs.com/package/payto-rl)\n[![License: CORE](https://img.shields.io/badge/License-CORE-yellow?logo=googledocs)](LICENSE)\n[![Bundle Size](https://img.shields.io/bundlephobia/minzip/payto-rl?label=Size\u0026logo=tsnode)](https://bundlephobia.com/package/payto-rl@latest)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.7-blue?logo=typescript)](https://www.typescriptlang.org/)\n[![GitHub Sponsors](https://img.shields.io/github/sponsors/bchainhub?label=Sponsors\u0026logo=githubsponsors\u0026color=EA4AAA)](https://github.com/sponsors/bchainhub)\n\n## Features\n\n- 🐥 **Small**: **[![Bundle Size](https://img.shields.io/bundlephobia/minzip/payto-rl?label=\u0026color=6ead0a)](https://bundlephobia.com/package/payto-rl@latest)** gzipped, distributed as minified ES modules.\n- 📜 **Standardized**: Based on the [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) Web API.\n- 🏗️ **Simple**: Easy to implement.\n- 🗂 **Typed**: Ships with types included.\n- 🧪 **Tested**: Robust test coverage.\n- 🌲 **Tree Shaking**: Zero dependencies, no side effects.\n\n## Installation\n\nInstall the `payto-rl` package using your package manager:\n\n```sh\nnpm i payto-rl\n```\n\n```sh\npnpm add payto-rl\n```\n\n```sh\nyarn add payto-rl\n```\n\n## Usage\n\nHere's an example of how to use the `payto-rl` package:\n\n```typescript\nimport Payto from 'payto-rl';\n\n// Basic payment URL\nconst paytoString = 'payto://xcb/cb7147879011ea207df5b35a24ca6f0859dcfb145999?amount=ctn:10.01\u0026fiat=eur';\nconst payto = new Payto(paytoString);\n\n// Standard payment properties\nconsole.log(payto.address);  // 'cb7147879011ea207df5b35a24ca6f0859dcfb145999'\nconsole.log(payto.amount);   // 'ctn:10.01'\nconsole.log(payto.value);    // 10.01\nconsole.log(payto.network);  // 'xcb'\nconsole.log(payto.currency); // ['ctn', 'eur']\n\n// Update payment amount\npayto.value = 20.02;\nconsole.log(payto.amount);   // 'ctn:20.02'\nconsole.log(payto.fiat);     // 'eur'\n\n// Color customization\npayto.colorBackground = 'ff0000';  // Red background (6-character hex)\npayto.colorForeground = '000000';  // Black foreground\nconsole.log(payto.colorBackground); // 'ff0000'\n\n// ACH payment examples\nconst achPayto1 = new Payto('payto://ach/123456789/1234567'); // With routing number\nconsole.log(achPayto1.routingNumber); // 123456789\nconsole.log(achPayto1.accountNumber); // 1234567\n\nconst achPayto2 = new Payto('payto://ach/1234567'); // Account number only\nconsole.log(achPayto2.accountNumber); // 1234567\n\n// UPI/PIX payment examples (case-insensitive email)\nconst upiPayto = new Payto('payto://upi/USER@example.com');\nconsole.log(upiPayto.accountAlias); // 'user@example.com'\n\nconst pixPayto = new Payto('payto://pix/user@EXAMPLE.com');\nconsole.log(pixPayto.accountAlias); // 'user@example.com'\n\n// Geo location example\nconst geoPayto = new Payto('payto://void/geo');\ngeoPayto.location = '51.5074,0.1278';  // Valid coordinates\nconsole.log(geoPayto.void);     // 'geo'\nconsole.log(geoPayto.location); // '51.5074,0.1278'\n\n// Plus code example\nconst plusPayto = new Payto('payto://void/plus');\nplusPayto.location = '8FVC9G8V+R9';  // Valid plus code\nconsole.log(plusPayto.void);     // 'plus'\nconsole.log(plusPayto.location); // '8FVC9G8V+R9'\n\n// Bank details example (case-insensitive BIC)\nconst bankPayto = new Payto('payto://bic/deutdeff500');\nconsole.log(bankPayto.bic);           // 'DEUTDEFF500'\nbankPayto.routingNumber = 123456789;  // Valid 9-digit routing number\nconsole.log(bankPayto.routingNumber); // 123456789\n\n// Value handling examples\nconst numericPayto = new Payto('payto://example/address?amount=10.5');\nconsole.log(numericPayto.value);  // 10.5\nconsole.log(numericPayto.amount); // '10.5'\n\nconst tokenPayto = new Payto('payto://example/address?amount=token:10.5');\nconsole.log(tokenPayto.value);    // 10.5\nconsole.log(tokenPayto.amount);   // 'token:10.5'\nconsole.log(tokenPayto.asset);    // 'token'\n\n// Convert to JSON object\nconst jsonObj = payto.toJSONObject();\nconsole.log(jsonObj.colorForeground); // Access typed properties\nconsole.log(jsonObj['custom-field']); // Access custom properties\n```\n\n## API Reference\n\n### Constructor\n\n```typescript\nnew Payto(paytoString: string)\n```\n\nCreates a new Payto instance from a payto URL string.\n\n### Properties\n\n| Property | Type | Description |\n|----------|------|-------------|\n| `accountAlias` | `string \\| null` | Email address for UPI/PIX payments (case-insensitive) |\n| `accountNumber` | `number \\| null` | Account number (7-14 digits) for ACH payments |\n| `address` | `string \\| null` | Payment address |\n| `amount` | `string \\| null` | Payment amount with optional currency prefix |\n| `asset` | `string \\| null` | Asset type or contract address |\n| `barcode` | `'qr' \\| 'pdf417' \\| 'aztec' \\| 'code128' \\| null` | Barcode format |\n| `bic` | `string \\| null` | Bank Identifier Code (8 or 11 characters, case-insensitive) |\n| `colorBackground` | `string \\| null` | Background color in 6-character hex format |\n| `colorForeground` | `string \\| null` | Foreground color in 6-character hex format |\n| `currency` | `[string \\| null, string \\| null]` | Currency codes array [asset, fiat] |\n| `deadline` | `number \\| null` | Payment deadline (Unix timestamp or positive integer) |\n| `donate` | `boolean \\| null` | Donation flag |\n| `fiat` | `string \\| null` | Fiat currency code (case-insensitive) |\n| `hash` | `string` | URL hash component |\n| `host` | `string` | Complete host (hostname:port) |\n| `hostname` | `string` | Host without port (case-insensitive) |\n| `href` | `string` | Complete URL string |\n| `iban` | `string \\| null` | International Bank Account Number (case-insensitive) |\n| `item` | `string \\| null` | Item description (max 40 chars) |\n| `location` | `string \\| null` | Location data (format depends on void type) |\n| `message` | `string \\| null` | Payment message |\n| `network` | `string` | Network identifier (case-insensitive) |\n| `organization` | `string \\| null` | Organization name (max 25 chars) |\n| `origin` | `string \\| null` | URL origin |\n| `password` | `string` | URL password component |\n| `pathname` | `string` | URL path component |\n| `port` | `string` | URL port component |\n| `protocol` | `string` | URL protocol (always 'payto:') |\n| `receiverName` | `string \\| null` | Receiver's name |\n| `recurring` | `string \\| null` | Recurring payment details |\n| `routingNumber` | `number \\| null` | Bank routing number (9 digits) |\n| `rtl` | `boolean \\| null` | right-to-left layout |\n| `search` | `string` | URL search component |\n| `searchParams` | `URLSearchParams` | URL search parameters |\n| `split` | `[string, string, boolean] \\| null` | Payment split information |\n| `swap` | `string \\| null` | Swap transaction details |\n| `username` | `string` | URL username component |\n| `value` | `number \\| null` | Numeric amount value (extracted from both simple and token:amount formats) |\n| `void` | `string \\| null` | Void path type (e.g., 'geo', 'plus') |\n\n### Methods\n\n| Method | Return Type | Description |\n|--------|-------------|-------------|\n| `toString()` | `string` | Returns the complete payto URL string |\n| `toJSON()` | `string` | Returns a JSON string representation |\n| `toJSONObject()` | `PaytoJSON` | Returns a typed object with all properties and custom fields |\n\n## Type Safety\n\nThe library includes TypeScript type definitions and runtime validation for:\n\n- Bank Identifier Codes (BIC) - 8 or 11 characters, case-insensitive\n- Routing numbers (9 digits)\n- Account numbers (7-14 digits)\n- Email addresses (for UPI/PIX, case-insensitive)\n- Geographic coordinates\n- Plus codes\n- Unix timestamps\n- Barcode formats\n- IBAN format (case-insensitive)\n- Color formats (6-character hex)\n\n## Payment System Support\n\n### IBAN\n\nSupports two formats (case-insensitive):\n\n- `payto://iban/iban` (without BIC)\n- `payto://iban/bic/iban` (with BIC)\n\n### ACH Payments\n\nSupports two formats:\n\n- `payto://ach/routing/account` (with routing number)\n- `payto://ach/account` (account number only)\n\n### UPI/PIX Payments\n\nEmail-based payment identifiers (case-insensitive):\n\n- `payto://upi/email@example.com`\n- `payto://pix/email@example.com`\n\n## License\n\nThis project is licensed under the CORE License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues and pull requests.\n\n## Acknowledgments\n\n- Based on the [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL) Web API\n- Implements [RFC 8905](https://datatracker.ietf.org/doc/html/rfc8905) - The 'payto' URI Scheme\n\n## Funding\n\nIf you find this project useful, please consider supporting it:\n\n- [GitHub Sponsors](https://github.com/sponsors/bchainhub)\n- [Core](https://blockindex.net/address/cb7147879011ea207df5b35a24ca6f0859dcfb145999)\n- [Bitcoin](https://www.blockchain.com/explorer/addresses/btc/bc1pd8guxjkr2p6n2kl388fdj2trete9w2fr89xlktdezmcctxvtzm8qsymg0d)\n- [Litecoin](https://www.blockchain.com/explorer/addresses/ltc/ltc1ql8dvx0wv0nh2vncpt9j3zqefaehsd25cwp7pfx)\n\nList of sponsors: [![GitHub Sponsors](https://img.shields.io/github/sponsors/bchainhub?label=Sponsors\u0026logo=githubsponsors\u0026color=EA4AAA)](https://github.com/sponsors/bchainhub)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbchainhub%2Fpayto-rl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbchainhub%2Fpayto-rl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbchainhub%2Fpayto-rl/lists"}