# Payeny JavaScript / Node.js SDK (v1)

Official zero-dependency single-file JavaScript / Node.js (v18+) client and HMAC-SHA256 webhook signature verifier for the Payeny Unified Payment Orchestration API (`https://payeny.com/api/v1`).

## Downloads

- **Single-File Source (`payeny.js`):** `https://payeny.com/sdk/js/payeny.js`
- **ZIP Package (`payeny-js-sdk.zip`):** `https://payeny.com/sdk/js/payeny-js-sdk.zip`
- **README (`README.md`):** `https://payeny.com/sdk/js/README.md`

```bash
# Download single-file JS SDK directly (no npm registry package required)
curl -fsSL https://payeny.com/sdk/js/payeny.js -o payeny.js
```

## Supported Subscription Methods

- `payeny.subscriptions.create(params)` — Create a subscription (supports `trial_period_days`, `coupon`, `payment_method` with `pm_card_*` or `tok_*`, `use_test_clock`)
- `payeny.subscriptions.retrieve(id)` / `payeny.subscriptions.get(id)` — Retrieve subscription
- `payeny.subscriptions.list(query)` — List subscriptions
- `payeny.subscriptions.cancel(id, { cancel_at_period_end: true | false })` — Cancel at period end or immediately
- `payeny.subscriptions.resume(id)` — Resume a subscription scheduled to cancel at period end
- `payeny.subscriptions.changePlan(id, { price_id, proration_behavior })` — Upgrade or downgrade subscription plan
- `payeny.subscriptions.advanceClock(id, { days, simulate_payment_failure, simulate_recovery })` — Advance test clock / simulated time (test mode only)
