@paydirect/sdk
v0.2.0
Published
TypeScript SDK for PayDirect settlement API on Base — supports REST API and x402 protocol by Coinbase
Maintainers
Readme
@paydirect/sdk
TypeScript SDK for the PayDirect settlement API on Base.
Install
npm install @paydirect/sdkQuick Start
import { PayDirectClient } from "@paydirect/sdk";
const client = new PayDirectClient({
apiKey: "pd_live_your_key_here",
baseUrl: "https://paydirect.com/api/v1", // optional
});
// Create a payment
const { payment, receivingAddress } = await client.createPayment({
tokenSymbol: "USDC",
amount: "100",
merchantWallet: "0xYourWalletAddress",
description: "Order #1234",
});
console.log(`Send ${payment.grossAmount} USDC to ${receivingAddress}`);
// Check payment status
const { payment: updated } = await client.getPayment(payment.id);
console.log(`Status: ${updated.status}`);
// Verify a payment was forwarded
const { verified } = await client.verifyPayment(payment.id);
console.log(`Verified: ${verified}`);Webhook Verification
import { PayDirectClient } from "@paydirect/sdk";
const isValid = PayDirectClient.verifyWebhookSignature(
"whsec_your_signing_secret",
rawRequestBody,
request.headers["x-paydirect-signature"]
);Fee Rates
| Token | Fee | | ----- | ------ | | USDC | 0.50% | | ETH | 0.50% | | ADAO | 0.25% |
