@proveanything/smartlinks 2.2.10 → 2.2.12

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.
@@ -1,4 +1,4 @@
1
- import type { PaymentsPublicConfig, PaymentIntentInput, PaymentIntentResult, PaymentsStatus, PaymentsConnectInput, PaymentListParams, PaymentList, PaymentDomainResult } from '../types/payments.js';
1
+ import type { PaymentsPublicConfig, PaymentIntentInput, PaymentIntentResult, PaymentsStatus, PaymentsConnectInput, PaymentListParams, PaymentList, PaymentSyncInput, PaymentSyncResult, PaymentDomainResult, PaymentSetupRequest, PaymentSetupRequestInput } from '../types/payments.js';
2
2
  export declare namespace payments {
3
3
  /**
4
4
  * Can this business take payments, and what Stripe.js needs. `ready` is false until the business has
@@ -52,8 +52,29 @@ export declare namespace payments {
52
52
  connected: false;
53
53
  disconnectedAccountId: string | null;
54
54
  }>;
55
+ /**
56
+ * Ask someone outside Studio (the finance team, the client a business was built for) to connect the
57
+ * business's Stripe account. SmartLinks emails them a link to a page that starts Stripe's set-up: no
58
+ * SmartLinks login, nothing else in reach. The link works for 7 days; a new request replaces it. The
59
+ * admin who sent it is emailed when it's done (naming the Stripe account) or if the person wasn't
60
+ * expecting it. Refused (409 ALREADY_CONNECTED) once payments are set up: disconnect first.
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * await payments.admin.requestSetup(collectionId, { email: 'finance@example.org', name: 'Sam' })
65
+ * ```
66
+ */
67
+ function requestSetup(collectionId: string, input: PaymentSetupRequestInput): Promise<PaymentSetupRequest>;
68
+ /** Cancel the waiting set-up request: its link stops working. → the request, or null when there was none. */
69
+ function cancelSetupRequest(collectionId: string): Promise<PaymentSetupRequest | null>;
55
70
  /** An app's in-page payments on the business's account, newest first (for reconciling). */
56
71
  function intents(collectionId: string, params?: PaymentListParams): Promise<PaymentList>;
72
+ /**
73
+ * Bring the app's payment records up to date from Stripe (payments made before payment records
74
+ * existed, or whose events never arrived). One Stripe page per call; call again with `next` while
75
+ * `hasMore`. The records are app records of type `payment`: read them with `app.records.list`.
76
+ */
77
+ function sync(collectionId: string, input?: PaymentSyncInput): Promise<PaymentSyncResult>;
57
78
  /** Let Apple Pay and Google Pay run on a site's own domain (smartlinks.app needs nothing). */
58
79
  function registerDomain(collectionId: string, domain: string): Promise<PaymentDomainResult>;
59
80
  }
@@ -3,7 +3,7 @@
3
3
  // takes money on it: no Stripe keys in apps. Pages use `payments.config` and `payments.createIntent` for
4
4
  // in-page payments (Payment Element, Apple Pay, Google Pay); Studio and admin screens use `payments.admin`.
5
5
  // Fixed-price sales use a hosted checkout instead: `shop.checkout`, `memberships`.
6
- import { request, post } from '../http.js';
6
+ import { request, post, del } from '../http.js';
7
7
  const pub = (collectionId) => `/public/collection/${encodeURIComponent(collectionId)}/payments`;
8
8
  const adm = (collectionId) => `/admin/collection/${encodeURIComponent(collectionId)}/payments`;
9
9
  export var payments;
@@ -70,6 +70,27 @@ export var payments;
70
70
  return post(`${adm(collectionId)}/disconnect`, {});
71
71
  }
72
72
  admin.disconnect = disconnect;
73
+ /**
74
+ * Ask someone outside Studio (the finance team, the client a business was built for) to connect the
75
+ * business's Stripe account. SmartLinks emails them a link to a page that starts Stripe's set-up: no
76
+ * SmartLinks login, nothing else in reach. The link works for 7 days; a new request replaces it. The
77
+ * admin who sent it is emailed when it's done (naming the Stripe account) or if the person wasn't
78
+ * expecting it. Refused (409 ALREADY_CONNECTED) once payments are set up: disconnect first.
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * await payments.admin.requestSetup(collectionId, { email: 'finance@example.org', name: 'Sam' })
83
+ * ```
84
+ */
85
+ async function requestSetup(collectionId, input) {
86
+ return post(`${adm(collectionId)}/setup-request`, input);
87
+ }
88
+ admin.requestSetup = requestSetup;
89
+ /** Cancel the waiting set-up request: its link stops working. → the request, or null when there was none. */
90
+ async function cancelSetupRequest(collectionId) {
91
+ return del(`${adm(collectionId)}/setup-request`);
92
+ }
93
+ admin.cancelSetupRequest = cancelSetupRequest;
73
94
  /** An app's in-page payments on the business's account, newest first (for reconciling). */
74
95
  async function intents(collectionId, params) {
75
96
  const q = new URLSearchParams();
@@ -85,6 +106,15 @@ export var payments;
85
106
  return request(`${adm(collectionId)}/intents${s ? `?${s}` : ''}`);
86
107
  }
87
108
  admin.intents = intents;
109
+ /**
110
+ * Bring the app's payment records up to date from Stripe (payments made before payment records
111
+ * existed, or whose events never arrived). One Stripe page per call; call again with `next` while
112
+ * `hasMore`. The records are app records of type `payment`: read them with `app.records.list`.
113
+ */
114
+ async function sync(collectionId, input = {}) {
115
+ return post(`${adm(collectionId)}/sync`, input);
116
+ }
117
+ admin.sync = sync;
88
118
  /** Let Apple Pay and Google Pay run on a site's own domain (smartlinks.app needs nothing). */
89
119
  async function registerDomain(collectionId, domain) {
90
120
  return post(`${adm(collectionId)}/domains`, { domain });
@@ -1,6 +1,6 @@
1
1
  # Smartlinks API Summary
2
2
 
3
- Version: 2.2.10 | Generated: 2026-12-04T20:36:14.716Z
3
+ Version: 2.2.12 | Generated: 2026-12-05T13:57:29.945Z
4
4
 
5
5
  This is a concise summary of all available API functions and types.
6
6
 
@@ -11673,12 +11673,41 @@ interface PaymentIntentResult {
11673
11673
  interface PaymentsStatus {
11674
11674
  connected: boolean
11675
11675
  accountId?: string
11676
+ name?: string | null
11676
11677
  chargesEnabled?: boolean | null
11677
11678
  detailsSubmitted?: boolean | null
11678
11679
  payoutsEnabled?: boolean | null
11679
11680
  platformReady: boolean
11680
11681
  publishableKeySet: boolean
11681
11682
  fees: Array<{ appId: string; bps: number; percent: number }>
11683
+ setupRequest?: PaymentSetupRequest | null
11684
+ }
11685
+ ```
11686
+
11687
+ **PaymentSetupRequest** (interface)
11688
+ ```typescript
11689
+ interface PaymentSetupRequest {
11690
+ id: string
11691
+ email: string
11692
+ name: string | null
11693
+ note: string | null
11694
+ sentByEmail: string | null
11695
+ sentByName: string | null
11696
+ sentAt: string
11697
+ expiresAt: string
11698
+ status: 'pending' | 'expired' | 'done' | 'cancelled' | 'reported'
11699
+ startedAt: string | null
11700
+ finishedAt: string | null
11701
+ stripeAccountName: string | null
11702
+ }
11703
+ ```
11704
+
11705
+ **PaymentSetupRequestInput** (interface)
11706
+ ```typescript
11707
+ interface PaymentSetupRequestInput {
11708
+ email: string
11709
+ name?: string
11710
+ note?: string
11682
11711
  }
11683
11712
  ```
11684
11713
 
@@ -11724,6 +11753,42 @@ interface PaymentList {
11724
11753
  }
11725
11754
  ```
11726
11755
 
11756
+ **PaymentSyncInput** (interface)
11757
+ ```typescript
11758
+ interface PaymentSyncInput {
11759
+ appId?: string
11760
+ since?: string
11761
+ after?: string
11762
+ }
11763
+ ```
11764
+
11765
+ **PaymentSyncResult** (interface)
11766
+ ```typescript
11767
+ interface PaymentSyncResult {
11768
+ checked: number
11769
+ saved: number
11770
+ hasMore: boolean
11771
+ next: string | null
11772
+ }
11773
+ ```
11774
+
11775
+ **AppPaymentRecordData** (interface)
11776
+ ```typescript
11777
+ interface AppPaymentRecordData {
11778
+ paymentIntentId: string
11779
+ amount: number
11780
+ currency: string
11781
+ amountRefunded: number
11782
+ fee: number
11783
+ email: string | null
11784
+ reference: string | null
11785
+ metadata: Record<string, string>
11786
+ paidAt: string
11787
+ refundedAt: string | null
11788
+ dispute?: { status: string; reason: string | null; amount: number | null; at: string }
11789
+ }
11790
+ ```
11791
+
11727
11792
  **PaymentDomainResult** (interface)
11728
11793
  ```typescript
11729
11794
  interface PaymentDomainResult {
@@ -11733,6 +11798,8 @@ interface PaymentDomainResult {
11733
11798
  }
11734
11799
  ```
11735
11800
 
11801
+ **AppPaymentStatus** = `'paid' | 'partially_refunded' | 'refunded' | 'disputed' | 'dispute_lost'`
11802
+
11736
11803
  ### product
11737
11804
 
11738
11805
  **ProductKey** (interface)
@@ -16431,9 +16498,18 @@ Stripe's page to connect (or finish connecting) the business's Stripe account. S
16431
16498
  **disconnect**(collectionId: string) → `Promise<`
16432
16499
  Stop using the business's Stripe account. SmartLinks forgets it (apps can no longer take payments until one is connected again); the Stripe account itself stays the business's own, with the payments already in it. Connecting again makes a new account.
16433
16500
 
16501
+ **requestSetup**(collectionId: string, input: PaymentSetupRequestInput) → `Promise<PaymentSetupRequest>`
16502
+ Ask someone outside Studio (the finance team, the client a business was built for) to connect the business's Stripe account. SmartLinks emails them a link to a page that starts Stripe's set-up: no SmartLinks login, nothing else in reach. The link works for 7 days; a new request replaces it. The admin who sent it is emailed when it's done (naming the Stripe account) or if the person wasn't expecting it. Refused (409 ALREADY_CONNECTED) once payments are set up: disconnect first. ```typescript await payments.admin.requestSetup(collectionId, { email: 'finance@example.org', name: 'Sam' }) ```
16503
+
16504
+ **cancelSetupRequest**(collectionId: string) → `Promise<PaymentSetupRequest | null>`
16505
+ Cancel the waiting set-up request: its link stops working. → the request, or null when there was none.
16506
+
16434
16507
  **intents**(collectionId: string, params?: PaymentListParams) → `Promise<PaymentList>`
16435
16508
  An app's in-page payments on the business's account, newest first (for reconciling).
16436
16509
 
16510
+ **sync**(collectionId: string, input: PaymentSyncInput = {}) → `Promise<PaymentSyncResult>`
16511
+ Bring the app's payment records up to date from Stripe (payments made before payment records existed, or whose events never arrived). One Stripe page per call; call again with `next` while `hasMore`. The records are app records of type `payment`: read them with `app.records.list`.
16512
+
16437
16513
  **registerDomain**(collectionId: string, domain: string) → `Promise<PaymentDomainResult>`
16438
16514
  Let Apple Pay and Google Pay run on a site's own domain (smartlinks.app needs nothing).
16439
16515