# payment-gateway-crypto

> A payment gateway for reciving payments on zkEVM: Cardona testnet and Base Sepolia Testnet

Latest version **1.1.2** (published 2024-07-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install payment-gateway-crypto
pnpm add payment-gateway-crypto
yarn add payment-gateway-crypto
bun add payment-gateway-crypto
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2024-07-21 |
| First published | 2024-07-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Shubh |
| Maintainers | shubhk |
| Keywords | Payment, gateway, crypto |

## Links

- npm: https://www.npmjs.com/package/payment-gateway-crypto
- Repository: https://github.com/shubhiscoding/Payment-GateWay-Crypto
- Homepage: https://github.com/shubhiscoding/Payment-GateWay-Crypto#readme
- Issues: https://github.com/shubhiscoding/Payment-GateWay-Crypto/issues
- npm.io page: https://npm.io/package/payment-gateway-crypto

## Dependencies (6)

- [ethers](https://npm.io/package/ethers.md) ^6.13.1
- [web3modal](https://npm.io/package/web3modal.md) ^1.9.12
- [@web3modal/ethers](https://npm.io/package/@web3modal/ethers.md) ^5.0.6
- [@coinbase/wallet-sdk](https://npm.io/package/@coinbase/wallet-sdk.md) ^4.0.4
- [@walletconnect/web3wallet](https://npm.io/package/@walletconnect/web3wallet.md) ^1.12.3
- [@walletconnect/ethereum-provider](https://npm.io/package/@walletconnect/ethereum-provider.md) ^2.13.3

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2024-07-21
- 1.1.1 — 2024-07-11
- 1.1.0 — 2024-07-11
- 1.0.3 — 2024-07-08
- 1.0.2 — 2024-07-05
- 1.0.1 — 2024-07-05
- 1.0.0 — 2024-07-05

## README

NOTE: CURRENTLY IT ONLY SUPPORTS ZK EVM CARDONA TESTNET AND BASE SEPOLIA TESTNET ONLY!!


# Payment Gateway Crypto

A simple crypto payment gateway using ethers.js. This package allows you to handle payments, check balances, and collect fees using Ethereum smart contracts.

## Installation

You can install this package using npm:

```bash
npm install payment-gateway-crypto
```

## Usage

### Importing the Module

You can import the `handlePayment` function using ES6 module syntax:

```javascript
import { handlePayment } from 'payment-gateway-crypto';
```

Or using CommonJS syntax:

```javascript
const { handlePayment } = require('payment-gateway-crypto');
```

### Using the `handlePayment` Function

The `handlePayment` function allows you to make payments to a specified Ethereum address. Here's an example of how to use it:

```javascript
import { handlePayment } from 'payment-gateway-crypto';

const amount = 0.001; // Example amount in Ether
const address = '0x1F85a21033Da743136C1808D635e8679221418d1'; // Receiver's wallet address
const netwrok = 'POLzk'; //'POLzk' for Polygon zkEVM and 'BASE' for Base Sepolia network
handlePayment(amount, address, network).then(() => {
    console.log('Payment successful');
}).catch(error => {
    console.error('Payment failed', error);
});
```

#### `handlePayment(amount, address)`

- `amount` (number): The amount of Ether to send.
- `address` (string): The recipient's Ethereum address.
- `network` (string): 'POLzk' for Polygon zkEVM CARDONA Testnet and 'BASE' for Base Sepolia network

This function sends the specified amount of Ether to the given address using the connected Ethereum wallet.

### Example

Here is a complete example of a simple React component that uses the `handlePayment` function:

```javascript
import React from 'react';
import { handlePayment } from 'payment-gateway-crypto';

const PaymentComponent = ({ amount }) => {
    const address = '0x1F85a21033Da743136C1808D635e8679221418d1';
    const network = 'BASE';
    const handleButtonClick = async () => {
        try {
           const tx = await handlePayment(amount, address, network);
            console.log('Payment successful', tx);
        } catch (error) {
            console.error('Payment failed', error);
        }
    };

    return (
        <div>
            <h1>Pay {amount} ETH</h1>
            <button onClick={handleButtonClick}>Confirm</button>
        </div>
    );
};

export default PaymentComponent;
```

## Author

Shubh Kesharwani - [Your Email](mailto:kesharwanis084@gmail.com)

## Acknowledgements

- [ethers.js](https://docs.ethers.io/v5/) for providing the library to interact with the Ethereum blockchain.

---
_Source: https://npm.io/package/payment-gateway-crypto · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
