@foxses/pay-coinpayments
v1.0.0
Published
CoinPayments crypto payment provider for foxses-pay
Downloads
107
Readme
@foxses/pay-coinpayments
CoinPayments crypto payment provider for foxses-pay.
Supports 700+ cryptocurrencies.
Install
npm install @foxses/pay-core @foxses/pay-coinpaymentsOr use the all-in-one package:
npm install @foxses/payUsage
import { PaymentGateway } from "@foxses/pay-core";
import "@foxses/pay-coinpayments";
const gateway = new PaymentGateway();
gateway.use("coinpayments", {
publicKey: "YOUR_PUBLIC_KEY",
privateKey: "YOUR_PRIVATE_KEY",
successUrl: "https://yoursite.com/success",
failureUrl: "https://yoursite.com/cancel",
ipnUrl: "https://yoursite.com/ipn", // optional
});
// Step 1: Create transaction
const payment = await gateway.createPayment("coinpayments", {
amount: 50,
currency: "USD",
orderId: "ORDER-001",
customerEmail: "[email protected]",
});
// Redirect user to:
console.log(payment.checkoutUrl);
// Step 2: Verify transaction
const result = await gateway.verifyPayment("coinpayments", {
transactionId: txnId,
});
console.log(result.status); // "completed" | "pending" | "failed"Getting API Keys
- Go to coinpayments.net
- Account → API Keys → Generate New Key
Documentation
paydoc.foxses.com/docs/providers/coinpayments
License
MIT © Foxses Studio
