Installation
Install
bash
npm install @payre/paySetup
ts
import { PayrePay } from '@payre/pay';
const payre = new PayrePay({
secretKey: process.env.PAYRE_SECRET_KEY, // pyr_sk_live_xxx
});The secret key must start with pyr_sk_. Get yours at console.payre.dev -> Developer Settings.
Environment Variables
| Variable | Required | Description |
|---|---|---|
PAYRE_SECRET_KEY | Yes | Your developer secret key (pyr_sk_live_xxx) |
Requirements
- Node.js 18+
- TypeScript 5+ (optional, types included)
Quick Test
ts
import { PayrePay } from '@payre/pay';
const payre = new PayrePay({
secretKey: process.env.PAYRE_SECRET_KEY,
});
// Charge a test consumer
const receipt = await payre.charge({
apiKey: 'pyr_ck_live_test_consumer_key',
tool: 'my-tool',
amount: 0.001,
});
console.log('Charge successful:', receipt.chargeId);Next Steps
- PayrePay API -- Full class reference
- Error Handling -- Handle failures gracefully
- Examples -- Complete MCP server integration