{"id":26800393,"url":"https://github.com/yahya-aghdam/multipay","last_synced_at":"2025-04-23T00:14:15.091Z","repository":{"id":281253482,"uuid":"944150876","full_name":"yahya-aghdam/multipay","owner":"yahya-aghdam","description":"Multi Crypto payment gateway","archived":false,"fork":false,"pushed_at":"2025-03-27T11:06:27.000Z","size":138,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T00:13:58.013Z","etag":null,"topics":["apollo","apollo-server","bep20","binance","binance-smart-chain","crypto","cryptocurrency","ethereum","gateway","graphql","graphql-server","grpc","pactus","payment","payments","tether","trc20","tron","typescript","usdt"],"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/yahya-aghdam.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":"2025-03-06T21:43:30.000Z","updated_at":"2025-04-12T13:46:05.000Z","dependencies_parsed_at":"2025-03-14T22:25:56.841Z","dependency_job_id":null,"html_url":"https://github.com/yahya-aghdam/multipay","commit_stats":null,"previous_names":["yahya-aghdam/multipay"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahya-aghdam%2Fmultipay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahya-aghdam%2Fmultipay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahya-aghdam%2Fmultipay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahya-aghdam%2Fmultipay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yahya-aghdam","download_url":"https://codeload.github.com/yahya-aghdam/multipay/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250343957,"owners_count":21415041,"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":["apollo","apollo-server","bep20","binance","binance-smart-chain","crypto","cryptocurrency","ethereum","gateway","graphql","graphql-server","grpc","pactus","payment","payments","tether","trc20","tron","typescript","usdt"],"created_at":"2025-03-29T20:17:01.856Z","updated_at":"2025-04-23T00:14:15.058Z","avatar_url":"https://github.com/yahya-aghdam.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# multipay\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./cw.png\" alt=\"multipay logo\" width=\"200\" height=\"200\" style=\"display: block; margin: 30 auto\" /\u003e\n\u003c/p\u003e\n\n![License](https://img.shields.io/badge/License-MIT-blue)\n![Version](https://img.shields.io/badge/Version-1.8.0-orange)\n\nMultipay is a multi cryptocurrency payment gateway as a microservice that facilitates the creation and management of wallets, balance checking, and payment verification and confirmation for various cryptocurrencies. It leverages [Trust Wallet Core](https://github.com/TrustWallet/wallet-core) for wallet functionalities and uses [gRPC](https://grpc.io/) for and [graphQL](https://graphql.org/) for payment management.\n\n## Supported Cryptocurrencies\n\n- ✅ Tron\n- ✅ Ethereum\n- ✅ Binance smart chain\n- ✅ Pactus\n- ✅ USDT TRC-20\n- ✅ USDT BEP-20\n\n## Table of Contents\n\n- [multipay](#multipay)\n  - [Supported Cryptocurrencies](#supported-cryptocurrencies)\n  - [Table of Contents](#table-of-contents)\n  - [Installation](#installation)\n  - [`.env` file](#env-file)\n  - [Supported databases](#supported-databases)\n  - [Usage](#usage)\n    - [Development](#development)\n    - [Production](#production)\n  - [Postman example](#postman-example)\n  - [Example of gRPC request](#example-of-grpc-request)\n    - [coin types](#coin-types)\n    - [Add payment](#add-payment)\n    - [Verify payment](#verify-payment)\n  - [GraphQL Schema](#graphql-schema)\n    - [Types](#types)\n    - [Queries](#queries)\n    - [Mutations](#mutations)\n    - [Example Queries and Mutations](#example-queries-and-mutations)\n      - [Query: Get All Payments](#query-get-all-payments)\n      - [Query: Get Payment by ID](#query-get-payment-by-id)\n      - [Mutation: Create Payment](#mutation-create-payment)\n      - [Mutation: Verify Payment](#mutation-verify-payment)\n      - [Get all wallets](#get-all-wallets)\n    - [Get wallets by](#get-wallets-by)\n  - [Project Structure](#project-structure)\n  - [License](#license)\n\n## Installation\n\n1. Clone the repository:\n\n    ```sh\n    git clone https://github.com/yahya-aghdam/multipay.git\n    cd multipay\n    ```\n\n2. Install dependencies:\n\n    ```sh\n    npm install\n    ```\n\n3. Build the project:\n\n    ```sh\n    npm run build\n    ```\n\n4. Start the server:\n\n    ```sh\n    npm start\n    ```\n\n## `.env` file\n\n```ini\nPROTO_URL=your_proto_url\nPROTO_PORT=your_proto_port\nGRAPHQL_PORT=your_graphql_port\nDB_URL=your_db_url\nDB_NAME=your_db_name\nPAYMENT_EXPIRATION_TIME_MIN=your_payment_expiration_time # in minutes\nWALLET_STRENGTH=your_wallet_strength # in bits\nETHER_SCAN_API_KEY=your_ether_scan_api_key # if you support Ethereum sign in  https://etherscan.io and paste your api key in here\nBSC_SACN_API_KEY=your_bsc_sacn_api_key # if you support Binance Smart Chain sign in  https://bscscan.com and paste your api key in here\n```\n\n## Supported databases\n\nBased on `DB_URL` variable in `.env` file, multipay can use MySQL, PostgreSQL or MongoDB.\n\n- ✅ MySQL\n- ✅ PostgreSQL\n- ✅ MongoDB\n\nDatabase connection URL:\n\n| Type       |        default connection url        |\n| :--------- | :----------------------------------: |\n| mongo      |      mongodb://127.0.0.1:27017       |\n| mysql      |     mysql://root@127.0.0.1:3306      |\n| postgresql | postgresql://postgres@127.0.0.1:5432 |\n\n## Usage\n\n### Development\n\nYou can add your own custom coins in `src/balance/index.ts` file.\n\nTo start the development server locally, with hot reloading:\n\n```sh\nnpm run dev\n```\n\nTo start the development server using Docker:\n\n```sh\nnpm run docker:dev\n```\n\n### Production\n\nTo start the production server locally:\n\n```sh\nnpm run build\nnpm run start\n```\n\nTo start the production server using Docker:\n\n```sh\nnpm run docker:build\n```\n\n## Postman example\n\nYou can use this invitation link to test app:\n[Postman example](https://app.getpostman.com/join-team?invie_code=a9f908c0257917207a95ea9bb3ddc1f772171fb37d05df712f94700f75d8482d\u0026target_code=08b944b4912a3d2a0233dd587445fca3)\n\n## Example of gRPC request\n\n### coin types\n\n| Coin name                 | Type     | value        |\n| ------------------------- | -------- | ------------ |\n| Tron (TRX)                | `string` | `tron`       |\n| Ethereum (ETH)            | `string` | `ethereum`   |\n| Binance smart chain (BNB) | `string` | `smartchain` |\n| Pactus (PAC)              | `string` | `pactus`     |\n| USDT TRC-20 (USDT)        | `string` | `usdt_trc20` |\n| USDT BEP-20 (USDT)        | `string` | `usdt_bep20` |\n\n### Add payment\n\nMessage body:\n\n| Field      | Type     | Description                      |\n| ---------- | -------- | -------------------------------- |\n| `amount`   | `string` | Amount of payment like \"0.00256\" |\n| `clientId` | `string` | ID of client                     |\n| `coin`     | `string` | Name of coin like \"etherum\"      |\n\nResponse:\n\n```json\n{\n    \"coin\": \"ethereum\",\n    \"amount\": \"0.001\",\n    \"expiration\": \"1742146248273\",\n    \"paymentId\": \"53d10ad5-3be0-4ef3-ac30-6a88afb4e364\",\n    \"clientId\": \"testClientId\",\n    \"address\": \"0xFF49d5Ff0Da6cB8825ba644F0262a514Ec7830C0\",\n    \"time\": \"1742145048273\"\n}\n```\n\n### Verify payment\n\nMessage body:\n\n| Field       | Type     | Description   |\n| ----------- | -------- | ------------- |\n| `paymentId` | `string` | ID of payment |\n\nResponse:\n\n```json\n{\n    \"coin\": \"ethereum\",\n    \"amount\": \"0.001\",\n    \"expiration\": \"1742146248273\",\n    \"paymentId\": \"53d10ad5-3be0-4ef3-ac30-6a88afb4e364\",\n    \"clientId\": \"testClientId\",\n    \"address\": \"0xFF49d5Ff0Da6cB8825ba644F0262a514Ec7830C0\",\n    \"isPaid\": true,\n    \"isConfirmed\": true,\n}\n```\n\n## GraphQL Schema\n\nThe GraphQL schema defines the types and operations available in the API. Here are the main types and operations:\n\n### Types\n\n```graphql\ntype Payment {\n  _id: String!\n  paymentId: String!\n  coin: String!\n  amount: String!\n  expiration: String!\n  clientId: String!\n  address: String!\n  isPaid: Boolean!\n  blockNumber: Int!\n  isConfirmed: Boolean!\n  time: String!\n}\n\ntype Payment_CreatePaymentOutput {\n  paymentId: String!\n  coin: String!\n  amount: String!\n  expiration: String!\n  clientId: String!\n  address: String!\n  time: String!\n}\n\ntype Payment_VerifyPaymentOutput {\n  coin: String!\n  amount: String!\n  expiration: String!\n  paymentId: String!\n  clientId: String!\n  address: String!\n  isPaid: Boolean!\n  isConfirmed: Boolean!\n}\n\ntype Wallet {\n  _id: String!\n  address: String!\n  mnemonic: String!\n  coin: String!\n  amount: String!\n}\n```\n\n### Queries\n\n```graphql\ntype Query {\n  payments: [Payment!]!\n  paymentById(paymentId: String!): Payment\n}\n\ntype Query {\n  wallets: [Wallet!]!\n  walletBy(address: String,coin: String): [Wallet!]!\n}\n```\n\n### Mutations\n\n```graphql\ntype Mutation {\n  createPayment(\n    coin: String!\n    amount: String!\n    clientId: String!\n  ): Payment_CreatePaymentOutput!\n\n  verifyPayment(\n    paymentId: String!\n  ): Payment_VerifyPaymentOutput!\n}\n```\n\n### Example Queries and Mutations\n\n#### Query: Get All Payments\n\n```graphql\nquery {\n  payments {\n    _id\n    paymentId\n    coin\n    amount\n    expiration\n    clientId\n    address\n    isPaid\n    blockNumber\n    isConfirmed\n    time\n  }\n}\n```\n\n#### Query: Get Payment by ID\n\n```graphql\nquery {\n  paymentById(paymentId: \"your_payment_id\") {\n    _id\n    paymentId\n    coin\n    amount\n    expiration\n    clientId\n    address\n    isPaid\n    blockNumber\n    isConfirmed\n    time\n  }\n}\n```\n\n#### Mutation: Create Payment\n\n```graphql\nmutation {\n  createPayment(\n    coin: \"ethereum\",\n    amount: \"0.001\",\n    clientId: \"testClientId\"\n  ) {\n    paymentId\n    coin\n    amount\n    expiration\n    clientId\n    address\n    time\n  }\n}\n```\n\n#### Mutation: Verify Payment\n\n```graphql\nmutation {\n  verifyPayment(paymentId: \"your_payment_id\") {\n    coin\n    amount\n    expiration\n    paymentId\n    clientId\n    address\n    isPaid\n    isConfirmed\n  }\n}\n```\n\n#### Get all wallets\n\n```graphql\nquery WalletBy {\n    wallets {\n        _id\n        address\n        mnemonic\n        coin\n        amount\n    }\n}\n```\n\n### Get wallets by\n\n```graphql\nquery WalletBy {\n    walletBy(coin: \"ethereum\") {\n        _id\n        address\n        mnemonic\n        coin\n        amount\n    }\n}\n```\n\n## Project Structure\n\n```text\nsrc/\n├── config/           # Configuration files\n│   ├── constants.ts  # Application constants\n│   └── dotenv.ts     # Environment variable configuration\n├── db/               # Database related code\n│   ├── entity.ts     # Database entities\n│   └── mikro_orm.ts  # MikroORM configuration\n├── lib/              # Core library code\n│   ├── balance/      # Balance checking functionality\n│   │   ├── index.ts  # Main balance logic\n│   │   ├── utils.ts  # Utility functions for balance\n│   │   └── vars.ts   # Variables for balance logic\n│   └── wallet/       # Wallet management\n│       ├── index.ts  # Main wallet logic\n│       └── utils.ts  # Utility functions for wallet\n├── protos/           # gRPC protocol definitions\n│   ├── multipay.proto           # Protocol buffer definition\n│   └── multipay.service.proto.ts # Generated gRPC service\n├── graphql/          # GraphQL schema and resolvers\n│   ├── schema.ts     # GraphQL schema definition\n│   └── resolvers.ts  # GraphQL resolvers\n├── services/         # Business logic services\n│   ├── payment.service.ts # Payment-related logic\n│   └── wallet.service.ts  # Wallet-related logic\n├── utils/            # General utility functions\n│   ├── logger.ts     # Logging utility\n│   └── helpers.ts    # Helper functions\n└── index.ts          # Application entry point\n```\n\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahya-aghdam%2Fmultipay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyahya-aghdam%2Fmultipay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahya-aghdam%2Fmultipay/lists"}