@linqapp/sdk 0.28.2 → 0.30.0
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/CHANGELOG.md +14 -0
- package/client.d.mts +117 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +117 -0
- package/client.d.ts.map +1 -1
- package/client.js +117 -0
- package/client.js.map +1 -1
- package/client.mjs +117 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/attachments.d.mts +7 -1
- package/resources/attachments.d.mts.map +1 -1
- package/resources/attachments.d.ts +7 -1
- package/resources/attachments.d.ts.map +1 -1
- package/resources/available-number.d.mts +9 -6
- package/resources/available-number.d.mts.map +1 -1
- package/resources/available-number.d.ts +9 -6
- package/resources/available-number.d.ts.map +1 -1
- package/resources/available-number.js +8 -5
- package/resources/available-number.js.map +1 -1
- package/resources/available-number.mjs +8 -5
- package/resources/available-number.mjs.map +1 -1
- package/resources/chats/location.d.mts +52 -11
- package/resources/chats/location.d.mts.map +1 -1
- package/resources/chats/location.d.ts +52 -11
- package/resources/chats/location.d.ts.map +1 -1
- package/resources/chats/location.js +52 -11
- package/resources/chats/location.js.map +1 -1
- package/resources/chats/location.mjs +52 -11
- package/resources/chats/location.mjs.map +1 -1
- package/resources/chats/typing.d.mts +46 -10
- package/resources/chats/typing.d.mts.map +1 -1
- package/resources/chats/typing.d.ts +46 -10
- package/resources/chats/typing.d.ts.map +1 -1
- package/resources/chats/typing.js +46 -10
- package/resources/chats/typing.js.map +1 -1
- package/resources/chats/typing.mjs +46 -10
- package/resources/chats/typing.mjs.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +8 -6
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +8 -6
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +6 -4
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +6 -4
- package/resources/messages.mjs.map +1 -1
- package/resources/payment-requests.d.mts +413 -0
- package/resources/payment-requests.d.mts.map +1 -0
- package/resources/payment-requests.d.ts +413 -0
- package/resources/payment-requests.d.ts.map +1 -0
- package/resources/payment-requests.js +203 -0
- package/resources/payment-requests.js.map +1 -0
- package/resources/payment-requests.mjs +199 -0
- package/resources/payment-requests.mjs.map +1 -0
- package/resources/phone-numbers.d.mts +5 -43
- package/resources/phone-numbers.d.mts.map +1 -1
- package/resources/phone-numbers.d.ts +5 -43
- package/resources/phone-numbers.d.ts.map +1 -1
- package/resources/webhook-events.d.mts +1 -1
- package/resources/webhook-events.d.mts.map +1 -1
- package/resources/webhook-events.d.ts +1 -1
- package/resources/webhook-events.d.ts.map +1 -1
- package/resources/webhooks.d.mts +1 -25
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +1 -25
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +131 -0
- package/src/resources/attachments.ts +7 -0
- package/src/resources/available-number.ts +9 -6
- package/src/resources/chats/location.ts +52 -11
- package/src/resources/chats/typing.ts +46 -10
- package/src/resources/index.ts +7 -0
- package/src/resources/messages.ts +8 -6
- package/src/resources/payment-requests.ts +487 -0
- package/src/resources/phone-numbers.ts +5 -46
- package/src/resources/webhook-events.ts +9 -1
- package/src/resources/webhooks.ts +9 -27
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../core/resource';
|
|
4
|
+
import { APIPromise } from '../core/api-promise';
|
|
5
|
+
import { buildHeaders } from '../internal/headers';
|
|
6
|
+
import { RequestOptions } from '../internal/request-options';
|
|
7
|
+
import { path } from '../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Request a payment from a recipient over iMessage. You create a payment
|
|
11
|
+
* request, send its `checkout_url` to the recipient, and they pay with Apple
|
|
12
|
+
* Pay or card. Funds settle **directly to your own Stripe account** — Linq
|
|
13
|
+
* never holds the money.
|
|
14
|
+
*
|
|
15
|
+
* ## How it works
|
|
16
|
+
*
|
|
17
|
+
* 1. **Create** a payment request with an amount and currency. You get back a
|
|
18
|
+
* `checkout_url` and a `status` of `requested`.
|
|
19
|
+
* 2. **Send** the `checkout_url` to the recipient as a `link` message part so
|
|
20
|
+
* it arrives as a tappable card (see *Sending the link* below).
|
|
21
|
+
* 3. The recipient **pays** on the hosted checkout (Apple Pay App Clip on a
|
|
22
|
+
* supported iPhone, web checkout everywhere else).
|
|
23
|
+
* 4. You receive a **`payment.succeeded`** webhook and the request's `status`
|
|
24
|
+
* becomes `succeeded`. Requests you don't collect eventually `expire`.
|
|
25
|
+
*
|
|
26
|
+
* ## Connected accounts (Stripe Standard, direct charges)
|
|
27
|
+
*
|
|
28
|
+
* Agent Pay runs on **Stripe Connect Standard accounts** using **direct
|
|
29
|
+
* charges**: the charge is created on *your* connected account and **you are
|
|
30
|
+
* the merchant of record**. That means the money, the payout schedule, the
|
|
31
|
+
* customer relationship, and the compliance surface are all yours — Linq
|
|
32
|
+
* orchestrates the request and the checkout but is never in the funds flow.
|
|
33
|
+
*
|
|
34
|
+
* **Refunds, disputes, and chargebacks are handled by you, in your own Stripe
|
|
35
|
+
* Dashboard.** Because charges settle directly to your account, Linq has no
|
|
36
|
+
* custody of the funds and cannot issue refunds or contest disputes on your
|
|
37
|
+
* behalf — and there is no refund/dispute endpoint in this API by design. Use
|
|
38
|
+
* the Stripe Dashboard (or the Stripe API on your own account) for the money
|
|
39
|
+
* lifecycle after a payment succeeds.
|
|
40
|
+
*
|
|
41
|
+
* ## Getting set up
|
|
42
|
+
*
|
|
43
|
+
* Open **Agent Pay** in your Linq dashboard
|
|
44
|
+
* (`https://zero.linqapp.com/organization/payments`), click **Connect Stripe**,
|
|
45
|
+
* and complete Stripe's onboarding (business details + a bank account). When
|
|
46
|
+
* your account reaches `charges_enabled`, request creation unlocks; until you
|
|
47
|
+
* connect Stripe, `POST /v3/payment_requests` returns `403`. You can keep
|
|
48
|
+
* collecting even while Stripe finishes background verification.
|
|
49
|
+
*
|
|
50
|
+
* ## Subscriptions
|
|
51
|
+
*
|
|
52
|
+
* Set `mode: subscription` on `POST /v3/payment_requests` to start an
|
|
53
|
+
* **auto-renewing subscription** instead of a one-time charge. Instead of an
|
|
54
|
+
* amount, you pass a `price_id` — an active **recurring Price** on your
|
|
55
|
+
* connected Stripe account (create one in your Stripe Dashboard under
|
|
56
|
+
* Product catalog; if you sell through Stripe Payment Links today, reuse the
|
|
57
|
+
* price your link is built from). The recipient pays the first invoice at
|
|
58
|
+
* the same checkout, and their payment method is saved to the subscription
|
|
59
|
+
* for automatic renewals.
|
|
60
|
+
*
|
|
61
|
+
* The division of labor is deliberate: **Linq handles the first payment,
|
|
62
|
+
* your Stripe account handles the rest.** The request reaches `succeeded`
|
|
63
|
+
* when the first invoice is paid; from then on the subscription lives
|
|
64
|
+
* entirely on your connected account. The response's `stripe` object gives
|
|
65
|
+
* you the join keys — `customer_id` and `subscription_id` — so renewals,
|
|
66
|
+
* plan changes, dunning, and cancellation are managed with your own Stripe
|
|
67
|
+
* Dashboard/API and your own Stripe webhooks. Your `metadata` is stamped on
|
|
68
|
+
* the Customer and Subscription, so correlating in either direction is
|
|
69
|
+
* trivial. There are no renewal webhooks from Linq by design.
|
|
70
|
+
*
|
|
71
|
+
* ### Free trials
|
|
72
|
+
*
|
|
73
|
+
* Add `trial_period_days` (or a fixed `trial_end` timestamp) to start the
|
|
74
|
+
* subscription with a free trial. The checkout still collects the
|
|
75
|
+
* recipient's payment method — the pay sheet shows "$0 due today" with the
|
|
76
|
+
* first charge date — and saves it to the subscription; Stripe bills it
|
|
77
|
+
* automatically when the trial ends. The request reaches `succeeded` when
|
|
78
|
+
* the card is collected, and the response carries `trial_end`. If the trial
|
|
79
|
+
* would end without a payment method on file, the subscription cancels
|
|
80
|
+
* rather than generating unpayable invoices. Trial lifecycle after checkout
|
|
81
|
+
* (extending, ending early) is managed in your own Stripe account via
|
|
82
|
+
* `stripe.subscription_id`.
|
|
83
|
+
*
|
|
84
|
+
* A subscription request you cancel (or that expires unpaid) cancels the
|
|
85
|
+
* incomplete Stripe subscription — nothing lingers on your account.
|
|
86
|
+
*
|
|
87
|
+
* ## Pre-created customers
|
|
88
|
+
*
|
|
89
|
+
* By default each request stands alone: payment mode attaches no Customer,
|
|
90
|
+
* and subscription mode creates a fresh one. If you already manage
|
|
91
|
+
* Customers on your connected account, pass their id as `customer_id`
|
|
92
|
+
* (`cus_...`) on create — in payment mode the charge lands on that
|
|
93
|
+
* customer's payment history, and in subscription mode the subscription is
|
|
94
|
+
* created on them instead of on a new Customer. The id must reference an
|
|
95
|
+
* existing, non-deleted customer on your connected account or the request
|
|
96
|
+
* fails with `400`. We never modify a customer you pass — no metadata is
|
|
97
|
+
* stamped on it.
|
|
98
|
+
*
|
|
99
|
+
* ## Sending the link
|
|
100
|
+
*
|
|
101
|
+
* Deliver the `checkout_url` as a **`link` message part** via
|
|
102
|
+
* `POST /v3/chats/{chatId}/messages` — it renders as a rich card with your
|
|
103
|
+
* branding (title, amount, image) instead of a bare URL, which converts far
|
|
104
|
+
* better. A `link` part must be the only part in the message. See
|
|
105
|
+
* [Rich Link Previews](/guides/messaging/sending-messages).
|
|
106
|
+
*
|
|
107
|
+
* On a supported iPhone the link opens an **Apple Pay App Clip** — a native,
|
|
108
|
+
* no-install checkout sheet. Everywhere else (Android, desktop, iPhones
|
|
109
|
+
* without the App Clip yet) the same URL opens the web checkout, so the link
|
|
110
|
+
* always works. The App Clip experience for your payment links is registered
|
|
111
|
+
* automatically by Linq and refreshed whenever you update your Agent Pay
|
|
112
|
+
* branding; a newly registered experience can take up to ~24 hours to
|
|
113
|
+
* activate on Apple's side, during which links open the web checkout.
|
|
114
|
+
*
|
|
115
|
+
* ## Webhooks
|
|
116
|
+
*
|
|
117
|
+
* Subscribe to payment lifecycle events to reconcile server-side rather than
|
|
118
|
+
* polling: `payment.succeeded`, `payment.canceled`, and `payment.expired`.
|
|
119
|
+
* Each event carries the payment request id, amount, currency, and your
|
|
120
|
+
* `metadata`. See [Webhooks](/guides/webhooks).
|
|
121
|
+
*/
|
|
122
|
+
export class PaymentRequests extends APIResource {
|
|
123
|
+
/**
|
|
124
|
+
* Creates a payment request and returns a `checkout_url` the recipient opens to
|
|
125
|
+
* pay with Apple Pay or card. Funds settle directly to your connected Stripe
|
|
126
|
+
* account. A payment request is independent of any chat; to associate one with a
|
|
127
|
+
* chat for your records, store the chat id in `metadata`. Requires your connected
|
|
128
|
+
* account to be `charges_enabled` (returns `403` otherwise).
|
|
129
|
+
*
|
|
130
|
+
* Set `mode: subscription` with a recurring `price_id` from your connected Stripe
|
|
131
|
+
* account to start an **auto-renewing subscription** instead of a one-time charge
|
|
132
|
+
* — the recipient pays the first invoice at checkout and the response's `stripe`
|
|
133
|
+
* object carries the customer and subscription ids for the ongoing lifecycle in
|
|
134
|
+
* your own Stripe account. See the _Subscriptions_ section of the tag overview.
|
|
135
|
+
*
|
|
136
|
+
* In either mode, pass `customer_id` to attach the request to an **existing
|
|
137
|
+
* Customer** on your connected account instead of creating a new one — see
|
|
138
|
+
* _Pre-created customers_ in the tag overview.
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* const paymentRequest = await client.paymentRequests.create({
|
|
143
|
+
* amount: 497,
|
|
144
|
+
* currency: 'usd',
|
|
145
|
+
* description: 'Coffee with Ava',
|
|
146
|
+
* metadata: { order_id: 'order_8675309' },
|
|
147
|
+
* });
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
create(params: PaymentRequestCreateParams, options?: RequestOptions): APIPromise<PaymentRequest> {
|
|
151
|
+
const { 'Idempotency-Key': idempotencyKey, ...body } = params;
|
|
152
|
+
return this._client.post('/v3/payment_requests', {
|
|
153
|
+
body,
|
|
154
|
+
...options,
|
|
155
|
+
headers: buildHeaders([
|
|
156
|
+
{ ...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined) },
|
|
157
|
+
options?.headers,
|
|
158
|
+
]),
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Returns a payment request's status and details.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* const paymentRequest =
|
|
168
|
+
* await client.paymentRequests.retrieve(
|
|
169
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
170
|
+
* );
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
retrieve(paymentRequestID: string, options?: RequestOptions): APIPromise<PaymentRequest> {
|
|
174
|
+
return this._client.get(path`/v3/payment_requests/${paymentRequestID}`, options);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Lists your payment requests, newest first, for reconciliation. Paginate with
|
|
179
|
+
* `limit` + `offset`; `has_more` indicates whether another page exists.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* const paymentRequests = await client.paymentRequests.list();
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
list(
|
|
187
|
+
query: PaymentRequestListParams | null | undefined = {},
|
|
188
|
+
options?: RequestOptions,
|
|
189
|
+
): APIPromise<PaymentRequestListResponse> {
|
|
190
|
+
return this._client.get('/v3/payment_requests', { query, ...options });
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Cancels an unpaid payment request: the underlying payment intent is canceled and
|
|
195
|
+
* the request moves to `canceled`. A request that is already paid, canceled, or
|
|
196
|
+
* expired returns 409.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* const paymentRequest = await client.paymentRequests.cancel(
|
|
201
|
+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
202
|
+
* );
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
cancel(paymentRequestID: string, options?: RequestOptions): APIPromise<PaymentRequest> {
|
|
206
|
+
return this._client.post(path`/v3/payment_requests/${paymentRequestID}/cancel`, options);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface PaymentRequest {
|
|
211
|
+
/**
|
|
212
|
+
* Unique identifier of the payment request.
|
|
213
|
+
*/
|
|
214
|
+
id: string;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Amount in the currency's minor units. In `subscription` mode this is the
|
|
218
|
+
* recurring amount (price × quantity) the recipient pays per interval, starting at
|
|
219
|
+
* checkout.
|
|
220
|
+
*/
|
|
221
|
+
amount: number;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* URL the recipient opens to pay:
|
|
225
|
+
* `https://zero.linqapp.com/pay/{slug}?session=...`, where `{slug}` is your
|
|
226
|
+
* partner checkout slug.
|
|
227
|
+
*/
|
|
228
|
+
checkout_url: string;
|
|
229
|
+
|
|
230
|
+
created_at: string;
|
|
231
|
+
|
|
232
|
+
currency: string;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Whether this request collects a one-time charge or starts a subscription.
|
|
236
|
+
*/
|
|
237
|
+
mode: 'payment' | 'subscription';
|
|
238
|
+
|
|
239
|
+
object: string;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Lifecycle status of the payment request.
|
|
243
|
+
*/
|
|
244
|
+
status: 'requested' | 'succeeded' | 'canceled' | 'expired';
|
|
245
|
+
|
|
246
|
+
description?: string;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* When an unpaid request auto-expires.
|
|
250
|
+
*/
|
|
251
|
+
expires_at?: string;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Subscription mode — how often the subscription renews.
|
|
255
|
+
*/
|
|
256
|
+
interval?: 'day' | 'week' | 'month' | 'year';
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Subscription mode — intervals per renewal (e.g. `3` + `month` = quarterly).
|
|
260
|
+
*/
|
|
261
|
+
interval_count?: number;
|
|
262
|
+
|
|
263
|
+
metadata?: { [key: string]: string };
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Natural-rail join keys, present when `rail: natural`.
|
|
267
|
+
*/
|
|
268
|
+
natural?: PaymentRequest.Natural;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* When the request was paid. Absent until it succeeds.
|
|
272
|
+
*/
|
|
273
|
+
paid_at?: string;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Subscription mode — the recurring price this request subscribes to.
|
|
277
|
+
*/
|
|
278
|
+
price_id?: string;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Subscription mode — units of the price subscribed to.
|
|
282
|
+
*/
|
|
283
|
+
quantity?: number;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* The rail this request settled on.
|
|
287
|
+
*/
|
|
288
|
+
rail?: 'stripe' | 'natural';
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Ids of the Stripe objects created **on your connected account** — your join keys
|
|
292
|
+
* into your own Stripe Dashboard, webhooks, and API. After a subscription's first
|
|
293
|
+
* payment succeeds, its ongoing lifecycle (renewals, plan changes, cancellation)
|
|
294
|
+
* is managed in your Stripe account using `subscription_id`.
|
|
295
|
+
*/
|
|
296
|
+
stripe?: PaymentRequest.Stripe;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Subscription mode — when the free trial ends and the first charge happens.
|
|
300
|
+
* Present only on trial requests; `paid_at`/`succeeded` mean the payment method
|
|
301
|
+
* was collected (no funds move until this time).
|
|
302
|
+
*/
|
|
303
|
+
trial_end?: string;
|
|
304
|
+
|
|
305
|
+
updated_at?: string;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export namespace PaymentRequest {
|
|
309
|
+
/**
|
|
310
|
+
* Natural-rail join keys, present when `rail: natural`.
|
|
311
|
+
*/
|
|
312
|
+
export interface Natural {
|
|
313
|
+
/**
|
|
314
|
+
* The Natural payment request (`prq_...`).
|
|
315
|
+
*/
|
|
316
|
+
payment_request_id?: string;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* The settled transaction (`txn_...`).
|
|
320
|
+
*/
|
|
321
|
+
transaction_id?: string;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Ids of the Stripe objects created **on your connected account** — your join keys
|
|
326
|
+
* into your own Stripe Dashboard, webhooks, and API. After a subscription's first
|
|
327
|
+
* payment succeeds, its ongoing lifecycle (renewals, plan changes, cancellation)
|
|
328
|
+
* is managed in your Stripe account using `subscription_id`.
|
|
329
|
+
*/
|
|
330
|
+
export interface Stripe {
|
|
331
|
+
/**
|
|
332
|
+
* The Customer this request is attached to (`cus_...`). Always set in subscription
|
|
333
|
+
* mode (created for you unless you passed `customer_id`); set in payment mode only
|
|
334
|
+
* when you passed one.
|
|
335
|
+
*/
|
|
336
|
+
customer_id?: string;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* The PaymentIntent collected at checkout (`pi_...`).
|
|
340
|
+
*/
|
|
341
|
+
payment_intent_id?: string;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Subscription mode — the Subscription (`sub_...`).
|
|
345
|
+
*/
|
|
346
|
+
subscription_id?: string;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface PaymentRequestListResponse {
|
|
351
|
+
data: Array<PaymentRequest>;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Whether more results exist beyond this page.
|
|
355
|
+
*/
|
|
356
|
+
has_more: boolean;
|
|
357
|
+
|
|
358
|
+
object: 'list';
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface PaymentRequestCreateParams {
|
|
362
|
+
/**
|
|
363
|
+
* Body param: Amount to charge, in the currency's minor units (e.g. cents). Must
|
|
364
|
+
* be at least the payment provider's minimum (50 for `usd`). Required in `payment`
|
|
365
|
+
* mode; must be omitted in `subscription` mode (the amount comes from the price).
|
|
366
|
+
*/
|
|
367
|
+
amount?: number;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Body param: Three-letter ISO 4217 currency code. Only `usd` is currently
|
|
371
|
+
* supported. Required in `payment` mode; must be omitted in `subscription` mode
|
|
372
|
+
* (the currency comes from the price).
|
|
373
|
+
*/
|
|
374
|
+
currency?: string;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Body param: Optional id of an **existing Customer** on your connected Stripe
|
|
378
|
+
* account (`cus_...`) to attach this request to, instead of a new Customer being
|
|
379
|
+
* created. In `payment` mode the charge lands on that customer's payment history;
|
|
380
|
+
* in `subscription` mode the subscription is created on them. The customer must
|
|
381
|
+
* exist (and not be deleted) on your connected account.
|
|
382
|
+
*/
|
|
383
|
+
customer_id?: string;
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Body param: Optional description shown to the recipient at checkout.
|
|
387
|
+
*/
|
|
388
|
+
description?: string;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Body param: Required for `rail: natural`. The line the request is sent from, in
|
|
392
|
+
* E.164 format. Must be a phone number your organization owns.
|
|
393
|
+
*/
|
|
394
|
+
from?: string;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Body param: Optional key/value metadata (up to 49 keys) echoed back on retrieval
|
|
398
|
+
* and on `payment.*` webhooks, and stamped on the Stripe objects we create on your
|
|
399
|
+
* connected account (the PaymentIntent, and in subscription mode the Subscription
|
|
400
|
+
* and any Customer created for you — a customer you pass via `customer_id` is
|
|
401
|
+
* never modified) — use it to correlate a request with your own records (e.g. a
|
|
402
|
+
* chat id). Keys starting with `linq_` are reserved.
|
|
403
|
+
*/
|
|
404
|
+
metadata?: { [key: string]: string };
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Body param: `payment` (default) collects a one-time charge for `amount` +
|
|
408
|
+
* `currency`. `subscription` starts an auto-renewing subscription from a recurring
|
|
409
|
+
* `price_id` on your connected Stripe account: the recipient pays the first
|
|
410
|
+
* invoice at checkout and Stripe renews it automatically from then on.
|
|
411
|
+
*/
|
|
412
|
+
mode?: 'payment' | 'subscription';
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Body param: Required for `rail: natural`. The payer to bill, in E.164 format.
|
|
416
|
+
*/
|
|
417
|
+
payer_handle?: string;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Body param: Subscription mode only (required there): id of an **active recurring
|
|
421
|
+
* Price** on your connected Stripe account (`price_...`). If you sell through
|
|
422
|
+
* Stripe Payment Links today, pass the same price the link was built from to get
|
|
423
|
+
* the native iMessage checkout for it.
|
|
424
|
+
*/
|
|
425
|
+
price_id?: string;
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Body param: Subscription mode only — units of the price to subscribe to.
|
|
429
|
+
*/
|
|
430
|
+
quantity?: number;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Body param: Payment rail. `stripe` (default) is the direct-charge flow that
|
|
434
|
+
* settles to your connected Stripe account. `natural` collects through the Natural
|
|
435
|
+
* custodial wallet; it requires `from` + `payer_handle` and that your organization
|
|
436
|
+
* has completed Natural merchant onboarding.
|
|
437
|
+
*/
|
|
438
|
+
rail?: 'stripe' | 'natural';
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Body param: Subscription mode only — end the free trial at a fixed timestamp
|
|
442
|
+
* (must be in the future) instead of a day count. Mutually exclusive with
|
|
443
|
+
* `trial_period_days`.
|
|
444
|
+
*/
|
|
445
|
+
trial_end?: string;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Body param: Subscription mode only — start with a free trial of this many days.
|
|
449
|
+
* The recipient's card is still collected at checkout (Apple Pay or card), saved
|
|
450
|
+
* to the subscription, and first charged when the trial ends. Mutually exclusive
|
|
451
|
+
* with `trial_end`.
|
|
452
|
+
*/
|
|
453
|
+
trial_period_days?: number;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Header param: Optional idempotency key (max 200 characters). Reuse the same key
|
|
457
|
+
* to safely retry without creating a second payment request. Reusing a key with
|
|
458
|
+
* different request parameters returns 409.
|
|
459
|
+
*/
|
|
460
|
+
'Idempotency-Key'?: string;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
export interface PaymentRequestListParams {
|
|
464
|
+
/**
|
|
465
|
+
* Max results to return (default 20, max 100).
|
|
466
|
+
*/
|
|
467
|
+
limit?: number;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Number of results to skip.
|
|
471
|
+
*/
|
|
472
|
+
offset?: number;
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Filter by lifecycle status.
|
|
476
|
+
*/
|
|
477
|
+
status?: 'requested' | 'authorized' | 'succeeded' | 'canceled' | 'expired' | 'declined';
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
export declare namespace PaymentRequests {
|
|
481
|
+
export {
|
|
482
|
+
type PaymentRequest as PaymentRequest,
|
|
483
|
+
type PaymentRequestListResponse as PaymentRequestListResponse,
|
|
484
|
+
type PaymentRequestCreateParams as PaymentRequestCreateParams,
|
|
485
|
+
type PaymentRequestListParams as PaymentRequestListParams,
|
|
486
|
+
};
|
|
487
|
+
}
|
|
@@ -83,19 +83,6 @@ export namespace PhoneNumberListResponse {
|
|
|
83
83
|
*/
|
|
84
84
|
id: string;
|
|
85
85
|
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated **[BETA]** Current reputation for a phone line. Always present —
|
|
88
|
-
* lines start at `HEALTHY` and may shift based on aggregate engagement and
|
|
89
|
-
* delivery signals across all conversations on the line.
|
|
90
|
-
*
|
|
91
|
-
* Unlike chat health, line reputation does not include `opted_out` — opt-out
|
|
92
|
-
* applies to individual recipients, not the whole line.
|
|
93
|
-
*
|
|
94
|
-
* See the [Phone Reputation guide](/guides/phone-numbers/phone-reputation) for
|
|
95
|
-
* what each status means and how to react.
|
|
96
|
-
*/
|
|
97
|
-
health_status: PhoneNumber.HealthStatus;
|
|
98
|
-
|
|
99
86
|
/**
|
|
100
87
|
* Phone number in E.164 format
|
|
101
88
|
*/
|
|
@@ -122,37 +109,6 @@ export namespace PhoneNumberListResponse {
|
|
|
122
109
|
}
|
|
123
110
|
|
|
124
111
|
export namespace PhoneNumber {
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated **[BETA]** Current reputation for a phone line. Always present —
|
|
127
|
-
* lines start at `HEALTHY` and may shift based on aggregate engagement and
|
|
128
|
-
* delivery signals across all conversations on the line.
|
|
129
|
-
*
|
|
130
|
-
* Unlike chat health, line reputation does not include `opted_out` — opt-out
|
|
131
|
-
* applies to individual recipients, not the whole line.
|
|
132
|
-
*
|
|
133
|
-
* See the [Phone Reputation guide](/guides/phone-numbers/phone-reputation) for
|
|
134
|
-
* what each status means and how to react.
|
|
135
|
-
*/
|
|
136
|
-
export interface HealthStatus {
|
|
137
|
-
/**
|
|
138
|
-
* Deep-link to the relevant section of the Phone Reputation guide for this status.
|
|
139
|
-
*/
|
|
140
|
-
doc_url: string;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Current reputation of this phone line.
|
|
144
|
-
*
|
|
145
|
-
* - `HEALTHY` — The line is in good standing. Send normally.
|
|
146
|
-
* - `AT_RISK` — The line's overall engagement is trending down. Slow the line's
|
|
147
|
-
* send pace and review your messaging patterns.
|
|
148
|
-
* - `CRITICAL` — Strong signals that messages from this line aren't landing well.
|
|
149
|
-
* Pause outbound on the line until it recovers.
|
|
150
|
-
*
|
|
151
|
-
* Defaults to `HEALTHY` for lines that have not yet been scored.
|
|
152
|
-
*/
|
|
153
|
-
status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL';
|
|
154
|
-
}
|
|
155
|
-
|
|
156
112
|
/**
|
|
157
113
|
* **[BETA]** Current reputation for a phone line. Always present — lines start at
|
|
158
114
|
* `HEALTHY` and may shift based on aggregate engagement and delivery signals
|
|
@@ -174,8 +130,11 @@ export namespace PhoneNumberListResponse {
|
|
|
174
130
|
* Current reputation of this phone line.
|
|
175
131
|
*
|
|
176
132
|
* - `HEALTHY` — The line is in good standing. Send normally.
|
|
177
|
-
* - `AT_RISK` —
|
|
178
|
-
*
|
|
133
|
+
* - `AT_RISK` — Warning signs on the line: engagement is low across many of its
|
|
134
|
+
* conversations, or it's starting too many brand-new conversations in a single
|
|
135
|
+
* day — and a spike in send volume can add to either. Slow the line's send pace,
|
|
136
|
+
* avoid opening many new conversations at once, and review your messaging
|
|
137
|
+
* patterns.
|
|
179
138
|
* - `CRITICAL` — Strong signals that messages from this line aren't landing well.
|
|
180
139
|
* Pause outbound on the line until it recovers.
|
|
181
140
|
*
|
|
@@ -166,6 +166,7 @@ export type WebhookEventType =
|
|
|
166
166
|
| 'chat.group_icon_updated'
|
|
167
167
|
| 'chat.group_name_update_failed'
|
|
168
168
|
| 'chat.group_icon_update_failed'
|
|
169
|
+
| 'chat.background_updated'
|
|
169
170
|
| 'chat.typing_indicator.started'
|
|
170
171
|
| 'chat.typing_indicator.stopped'
|
|
171
172
|
| 'phone_number.status_updated'
|
|
@@ -177,7 +178,14 @@ export type WebhookEventType =
|
|
|
177
178
|
| 'call.declined'
|
|
178
179
|
| 'call.no_answer'
|
|
179
180
|
| 'location.sharing.started'
|
|
180
|
-
| 'location.sharing.stopped'
|
|
181
|
+
| 'location.sharing.stopped'
|
|
182
|
+
| 'payment.succeeded'
|
|
183
|
+
| 'payment.canceled'
|
|
184
|
+
| 'payment.expired'
|
|
185
|
+
| 'payment.declined'
|
|
186
|
+
| 'payment.authorized'
|
|
187
|
+
| 'connection.created'
|
|
188
|
+
| 'connection.revoked';
|
|
181
189
|
|
|
182
190
|
export interface WebhookEventListResponse {
|
|
183
191
|
/**
|
|
@@ -2079,6 +2079,7 @@ export interface PhoneNumberStatusUpdatedWebhookEvent {
|
|
|
2079
2079
|
| 'chat.group_icon_updated'
|
|
2080
2080
|
| 'chat.group_name_update_failed'
|
|
2081
2081
|
| 'chat.group_icon_update_failed'
|
|
2082
|
+
| 'chat.background_updated'
|
|
2082
2083
|
| 'chat.typing_indicator.started'
|
|
2083
2084
|
| 'chat.typing_indicator.stopped'
|
|
2084
2085
|
| 'phone_number.status_updated'
|
|
@@ -2090,7 +2091,14 @@ export interface PhoneNumberStatusUpdatedWebhookEvent {
|
|
|
2090
2091
|
| 'call.declined'
|
|
2091
2092
|
| 'call.no_answer'
|
|
2092
2093
|
| 'location.sharing.started'
|
|
2093
|
-
| 'location.sharing.stopped'
|
|
2094
|
+
| 'location.sharing.stopped'
|
|
2095
|
+
| 'payment.succeeded'
|
|
2096
|
+
| 'payment.canceled'
|
|
2097
|
+
| 'payment.expired'
|
|
2098
|
+
| 'payment.declined'
|
|
2099
|
+
| 'payment.authorized'
|
|
2100
|
+
| 'connection.created'
|
|
2101
|
+
| 'connection.revoked';
|
|
2094
2102
|
|
|
2095
2103
|
/**
|
|
2096
2104
|
* Partner identifier. Present on all webhooks for cross-referencing.
|
|
@@ -2120,19 +2128,6 @@ export namespace PhoneNumberStatusUpdatedWebhookEvent {
|
|
|
2120
2128
|
*/
|
|
2121
2129
|
changed_at: string;
|
|
2122
2130
|
|
|
2123
|
-
/**
|
|
2124
|
-
* @deprecated Current reputation of this phone line.
|
|
2125
|
-
*
|
|
2126
|
-
* - `HEALTHY` — The line is in good standing. Send normally.
|
|
2127
|
-
* - `AT_RISK` — The line's overall engagement is trending down. Slow the line's
|
|
2128
|
-
* send pace and review your messaging patterns.
|
|
2129
|
-
* - `CRITICAL` — Strong signals that messages from this line aren't landing well.
|
|
2130
|
-
* Pause outbound on the line until it recovers.
|
|
2131
|
-
*
|
|
2132
|
-
* Defaults to `HEALTHY` for lines that have not yet been scored.
|
|
2133
|
-
*/
|
|
2134
|
-
new_health_status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL';
|
|
2135
|
-
|
|
2136
2131
|
/**
|
|
2137
2132
|
* The new line reputation
|
|
2138
2133
|
*/
|
|
@@ -2148,19 +2143,6 @@ export namespace PhoneNumberStatusUpdatedWebhookEvent {
|
|
|
2148
2143
|
*/
|
|
2149
2144
|
phone_number: string;
|
|
2150
2145
|
|
|
2151
|
-
/**
|
|
2152
|
-
* @deprecated Current reputation of this phone line.
|
|
2153
|
-
*
|
|
2154
|
-
* - `HEALTHY` — The line is in good standing. Send normally.
|
|
2155
|
-
* - `AT_RISK` — The line's overall engagement is trending down. Slow the line's
|
|
2156
|
-
* send pace and review your messaging patterns.
|
|
2157
|
-
* - `CRITICAL` — Strong signals that messages from this line aren't landing well.
|
|
2158
|
-
* Pause outbound on the line until it recovers.
|
|
2159
|
-
*
|
|
2160
|
-
* Defaults to `HEALTHY` for lines that have not yet been scored.
|
|
2161
|
-
*/
|
|
2162
|
-
previous_health_status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL';
|
|
2163
|
-
|
|
2164
2146
|
/**
|
|
2165
2147
|
* The previous line reputation
|
|
2166
2148
|
*/
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.30.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.30.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.30.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.30.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|