@blockmoblabs/cryptopay 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -50,9 +50,9 @@ Non-2xx responses throw `CryptoPayError` with `status` and `body`.
50
50
 
51
51
  ## Subscriptions
52
52
 
53
- Crypto cannot be pulled from a wallet, so a subscription is a recurring invoice. Three days before
54
- each due date the customer is emailed a payment link, then reminded once a day. If it is still
55
- unpaid three days after the due date, the subscription lapses.
53
+ Crypto cannot be pulled from a wallet, so a subscription is a recurring invoice. `noticeDays` before
54
+ each due date (default 3) the customer is emailed a payment link, then reminded once a day. If it is
55
+ still unpaid `graceDays` after the due date (default 3), the subscription lapses.
56
56
 
57
57
  ```ts
58
58
  const sub = await cryptopay.createSubscription({
@@ -62,6 +62,8 @@ const sub = await cryptopay.createSubscription({
62
62
  firstDueAt: '2026-11-02', // later payments stay on the 2nd
63
63
  reference: 'sub_221', // comes back as customer.subscriptionRef
64
64
  description: 'Pro plan', // shown to the customer in the emails
65
+ noticeDays: 5, // optional, 1-14: first email 5 days before each due date
66
+ graceDays: 3, // optional, 0-14: lapses 3 days after it if unpaid
65
67
  });
66
68
  ```
67
69
 
package/dist/index.d.ts CHANGED
@@ -42,9 +42,10 @@ export declare class CryptoPay {
42
42
  nextCursor: string | null;
43
43
  }>;
44
44
  /**
45
- * Bill a customer on a schedule. Three days before each due date they are emailed a payment link,
46
- * then reminded daily; unpaid three days after it, the subscription lapses. Each payment arrives
47
- * as an ordinary `payment.completed` webhook carrying your `reference` as `subscriptionRef`.
45
+ * Bill a customer on a schedule. `noticeDays` (default 3) before each due date they are emailed a
46
+ * payment link, then reminded daily; unpaid `graceDays` (default 3) after it, the subscription
47
+ * lapses. Each payment arrives as an ordinary `payment.completed` webhook carrying your
48
+ * `reference` as `subscriptionRef`.
48
49
  */
49
50
  createSubscription(input: CreateSubscriptionInput): Promise<Subscription>;
50
51
  getSubscription(id: string): Promise<Subscription>;
package/dist/index.js CHANGED
@@ -54,9 +54,10 @@ export class CryptoPay {
54
54
  return this.request('GET', `/payment-intents${suffix ? `?${suffix}` : ''}`);
55
55
  }
56
56
  /**
57
- * Bill a customer on a schedule. Three days before each due date they are emailed a payment link,
58
- * then reminded daily; unpaid three days after it, the subscription lapses. Each payment arrives
59
- * as an ordinary `payment.completed` webhook carrying your `reference` as `subscriptionRef`.
57
+ * Bill a customer on a schedule. `noticeDays` (default 3) before each due date they are emailed a
58
+ * payment link, then reminded daily; unpaid `graceDays` (default 3) after it, the subscription
59
+ * lapses. Each payment arrives as an ordinary `payment.completed` webhook carrying your
60
+ * `reference` as `subscriptionRef`.
60
61
  */
61
62
  createSubscription(input) {
62
63
  return this.request('POST', '/subscriptions', { body: input });
package/dist/types.d.ts CHANGED
@@ -85,6 +85,10 @@ export type CreateSubscriptionInput = {
85
85
  interval: 'week' | 'month' | 'year';
86
86
  /** When the first payment is due (ISO date). Left out: now. Later ones keep the same day. */
87
87
  firstDueAt?: string;
88
+ /** Days before each due date the customer is first emailed. 1 to 14, default 3. */
89
+ noticeDays?: number;
90
+ /** Days after the due date an unpaid subscription lapses. 0 to 14, default 3. */
91
+ graceDays?: number;
88
92
  customerRef?: string;
89
93
  /** Your own id for this subscription. Comes back as `customer.subscriptionRef` on every payment. */
90
94
  reference?: string;
@@ -102,6 +106,8 @@ export type Subscription = {
102
106
  description: string | null;
103
107
  amountUsd: number;
104
108
  interval: 'week' | 'month' | 'year';
109
+ noticeDays: number;
110
+ graceDays: number;
105
111
  /** When the period now being collected is due. Null once the subscription has ended. */
106
112
  dueAt: string | null;
107
113
  periodsPaid: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockmoblabs/cryptopay",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "CryptoPay crypto payment infrastructure: create payment intents, open the checkout, verify webhooks.",
5
5
  "license": "MIT",
6
6
  "type": "module",