@isnap/sdk 2.2.0-next.226 → 2.2.0-next.228

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.
@@ -1056,9 +1056,9 @@ export interface paths {
1056
1056
  * Reserve a line
1057
1057
  * @description Reserves one `available` line for your account for 15 minutes, and returns it with `status: reserved`, `expires_at` set and its full phone number. Accepts an API key; any account can reserve. A reserved line is not billed and cannot send.
1058
1058
  *
1059
- * Within the 15 minutes, a wholesale partner activates it with `POST /v1/lines/{id}/activate`. For any other account, no operation that an API key can call activates it. After `expires_at`, the line returns to `available` with no owner.
1059
+ * Within the 15 minutes, a wholesale partner activates it with `POST /v1/lines/{id}/activate`. For any other account, no operation that an API key can call activates the line or pays for it. Once a payment of the line has started, `expires_at` is 24 hours after the start of that payment, and the line becomes `active` when the payment succeeds. The line returns to `available` with no owner after `expires_at`, or earlier when a started payment has not succeeded after 23 hours.
1060
1060
  *
1061
- * A reservation cannot be extended: reserving a line that you have already reserved returns `409 conflict`. The API sets no limit on the number of lines that an account has reserved at the same time. The `metadata` of the line is left as it is. This operation sends no event, and neither does the end of a reservation.
1061
+ * Reserving a line that you have already reserved returns `409 conflict` and does not extend the reservation. The API sets no limit on the number of lines that an account has reserved at the same time. The `metadata` of the line is left as it is. This operation sends no event, and neither does the end of a reservation.
1062
1062
  */
1063
1063
  post: {
1064
1064
  parameters: {
@@ -2380,7 +2380,7 @@ export interface paths {
2380
2380
  put?: never;
2381
2381
  /**
2382
2382
  * Release a reserved line
2383
- * @description Gives back a line that you have reserved: it returns to `available` immediately and no longer belongs to your account. Accepts an API key. Any other line returns `404 not_found`, an `active` line included: to end a line you use, call `POST /v1/lines/{id}/terminate` or `POST /v1/lines/{id}/cancel`. A release changes no billing and leaves the `metadata` of the line as it is. This operation sends no event.
2383
+ * @description Gives back a line that you have reserved: it returns to `available` immediately and no longer belongs to your account. Accepts an API key. Any other line returns `404 not_found`, an `active` line included: to end a line you use, call `POST /v1/lines/{id}/terminate` or `POST /v1/lines/{id}/cancel`. A release cancels the unpaid subscription of a payment that was started for the line, unless that payment has been submitted. A payment that succeeds after the release activates no line: iSnap cancels its subscription and records the charge as a refund owed to the account. A release changes no other billing and leaves the `metadata` of the line as it is. This operation sends no event.
2384
2384
  */
2385
2385
  post: {
2386
2386
  parameters: {
@@ -2972,7 +2972,7 @@ export interface paths {
2972
2972
  parameters: {
2973
2973
  query?: {
2974
2974
  /** @description Keep the pre-orders in this status. */
2975
- status?: "draft" | "provisioning" | "fulfilled" | "cancelled";
2975
+ status?: "draft" | "awaiting_payment" | "provisioning" | "fulfilled" | "cancelled";
2976
2976
  /** @description The `next_cursor` of the previous page. Omit it for the first page. An unreadable cursor restarts from the first page, without an error. */
2977
2977
  cursor?: string;
2978
2978
  /** @description Number of pre-orders per page, from 1 to 100. Default: 25. */
@@ -3036,7 +3036,7 @@ export interface paths {
3036
3036
  * Create a pre-order
3037
3037
  * @description Creates a draft pre-order for one rented iMessage line. Accepts an API key. A line-scoped key is not limited to its list on this operation. A draft has no effect: it creates no line, takes no payment, and never expires. Call `POST /v1/pre-orders/{id}/confirm` to commit it. There is no limit on the number of drafts. `Idempotency-Key` is ignored: a repeated call creates another draft. Creating a draft sends no event.
3038
3038
  *
3039
- * `preferred_area_codes` lists up to 5 area codes in order of preference, and `inbound_only` chooses between an inbound-only line and a two-way line. `billing_tier`, when sent, must be `rental_iphone`: `rental_android` returns `400 android_rental_not_purchasable`, and the four other values return `400 tier_not_pre_orderable`. `billing_anchor_at` is stored on the pre-order and carried onto the line at confirmation: a value more than 31 days after the call returns `400 billing_anchor_too_far`, and the confirmation does not check it again. A key that is not listed, `quantity` included, returns `400 validation_failed`: one pre-order is one line.
3039
+ * `preferred_area_codes` lists up to 5 area codes in order of preference, and `inbound_only` chooses between an inbound-only line and a two-way line. `billing_tier`, when sent, must be `rental_iphone`: `rental_android` returns `400 android_rental_not_purchasable`, and the four other values return `400 tier_not_pre_orderable`. `billing_anchor_at` is stored on the pre-order and carried onto the line when the line is created: a value more than 31 days after the call returns `400 billing_anchor_too_far`, and it is not checked again. A key that is not listed, `quantity` included, returns `400 validation_failed`: one pre-order is one line.
3040
3040
  */
3041
3041
  post: {
3042
3042
  parameters: {
@@ -3162,11 +3162,17 @@ export interface paths {
3162
3162
  put?: never;
3163
3163
  /**
3164
3164
  * Confirm a pre-order
3165
- * @description Commits a draft pre-order. Accepts an API key. A line-scoped key is not limited to its list on this operation: it can confirm any draft of the account. The call sets `status` to `provisioning` and `estimated_fulfillment` to the time of the call plus 72 hours, and creates on your account a rented iMessage line with `status: provisioning`, with the `inbound_only` and the `billing_anchor_at` of the pre-order. When a number in one of your area codes is in stock, it is assigned to the line immediately. The confirmation sends no event: iSnap sends `pre_order.fulfilled`, which carries the `line_id`, when the line is handed over.
3165
+ * @description Commits a draft pre-order. Accepts an API key. A line-scoped key is not limited to its list on this operation: it can confirm any draft of the account. The confirmation sends no event: iSnap sends `pre_order.fulfilled`, which carries the `line_id`, when the line is handed over.
3166
3166
  *
3167
- * A wholesale partner pays nothing at confirmation: `stripe_client_secret` is `null`, and the line is billed on the monthly invoice from the day it is handed over. For a direct account, confirm starts a monthly subscription and returns `stripe_client_secret`, a client secret that your payment page passes to the payment form of Stripe to collect the first month. The line is created whether or not that payment completes. The secret is returned in this response only and confirm cannot be repeated: store the secret before anything else.
3167
+ * The build of a pre-order sets `status` to `provisioning` and `estimated_fulfillment` to the time the build starts plus 72 hours, and creates on your account a rented iMessage line with `status: provisioning`, with the `inbound_only` and the `billing_anchor_at` of the pre-order. When a number is in stock in one of your area codes, in their order of preference, it is assigned to the line when the build starts. A pre-order with no `preferred_area_codes` takes any number in stock.
3168
3168
  *
3169
- * Only a draft can be confirmed: any other pre-order returns `400 pre_order_not_draft`, and a confirmation that runs at the same time as another confirmation or as a cancellation returns `409 pre_order_not_draft`. A confirmed pre-order cannot be canceled through the API.
3169
+ * For a wholesale partner the build starts with the confirmation. A wholesale partner pays nothing at confirmation: `stripe_client_secret` is `null`, and the line is billed on the monthly invoice from the day it is handed over.
3170
+ *
3171
+ * For a direct account the build starts when the first month is paid. Confirm starts a monthly subscription, sets `status` to `awaiting_payment` and returns `stripe_client_secret`, a client secret that your payment page passes to the payment form of Stripe to collect the first month. Only card payments are accepted. Until that payment succeeds, no line is created and `estimated_fulfillment` is `null`. After paying, read the pre-order with `GET /v1/pre-orders/{id}` until `status` is `provisioning`. When the first month is not paid within 23 hours of the confirmation, `status` becomes `cancelled` and iSnap sends `pre_order.cancelled`. When a credit balance of the account at Stripe covers the first month, there is nothing to pay: the build starts with the confirmation and `stripe_client_secret` is `null`. The first month starts at the confirmation, not when the line is handed over, and the next invoice is issued one month after the confirmation. The hand-over of the line takes no payment and does not change when the subscription is invoiced.
3172
+ *
3173
+ * Confirm can be repeated while `status` is `awaiting_payment`: it returns the same client secret and starts no second subscription. Repeated after the payment succeeded, it returns the pre-order in `provisioning`.
3174
+ *
3175
+ * Any other pre-order returns `400 pre_order_not_draft`, including one that was canceled because its first month was not paid in time. A confirmation that runs at the same time as a cancellation, or for a wholesale partner as another confirmation, returns `409 pre_order_not_draft`. When Stripe cannot be reached, the call returns `503 payment_provider_unavailable`: nothing changed, and the call can be repeated. When Stripe refuses the request for the account, the call returns `409 payment_setup_failed`: nothing changed, and repeating the call does not help. Once its build has started, a pre-order cannot be canceled through the API.
3170
3176
  */
3171
3177
  post: {
3172
3178
  parameters: {
@@ -3180,7 +3186,7 @@ export interface paths {
3180
3186
  };
3181
3187
  requestBody?: never;
3182
3188
  responses: {
3183
- /** @description The pre-order, in status `provisioning`. */
3189
+ /** @description The pre-order: in status `awaiting_payment` with its `stripe_client_secret` for a direct account whose first month is due, in status `provisioning` otherwise. */
3184
3190
  200: {
3185
3191
  headers: {
3186
3192
  [name: string]: unknown;
@@ -3200,7 +3206,7 @@ export interface paths {
3200
3206
  };
3201
3207
  };
3202
3208
  };
3203
- /** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. It is `pre_order_not_draft` when the pre-order is not a draft. */
3209
+ /** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. It is `pre_order_not_draft` when the pre-order is neither a draft nor in `awaiting_payment`, except a pre-order in `provisioning` whose first month was paid, which a repeated confirm returns. */
3204
3210
  400: {
3205
3211
  headers: {
3206
3212
  [name: string]: unknown;
@@ -3227,6 +3233,15 @@ export interface paths {
3227
3233
  "application/json": components["schemas"]["ErrorEnvelope"];
3228
3234
  };
3229
3235
  };
3236
+ /** @description Conflict. `error.code` is `pre_order_not_draft` when a cancellation, or for a wholesale partner another confirmation, ran at the same time and won. It is `payment_setup_failed` when Stripe refused the request for the account: repeating the call does not help. */
3237
+ 409: {
3238
+ headers: {
3239
+ [name: string]: unknown;
3240
+ };
3241
+ content: {
3242
+ "application/json": components["schemas"]["ErrorEnvelope"];
3243
+ };
3244
+ };
3230
3245
  /** @description Too many requests. `error.code` is `rate_limit_exceeded` when more than 100 requests came from the same network address in 60 seconds, whatever their API key or account: wait `error.retry_after` seconds. */
3231
3246
  429: {
3232
3247
  headers: {
@@ -3245,6 +3260,15 @@ export interface paths {
3245
3260
  "application/json": components["schemas"]["ErrorEnvelope"];
3246
3261
  };
3247
3262
  };
3263
+ /** @description Service unavailable. `error.code` is `payment_provider_unavailable`: Stripe could not be reached. Nothing changed, and the call can be repeated. */
3264
+ 503: {
3265
+ headers: {
3266
+ [name: string]: unknown;
3267
+ };
3268
+ content: {
3269
+ "application/json": components["schemas"]["ErrorEnvelope"];
3270
+ };
3271
+ };
3248
3272
  };
3249
3273
  };
3250
3274
  delete?: never;
@@ -3262,7 +3286,7 @@ export interface paths {
3262
3286
  };
3263
3287
  /**
3264
3288
  * Get a pre-order
3265
- * @description Returns one pre-order of the account. Accepts an API key. A line-scoped key is not limited to its list on this operation. A pre-order carries no line id: the line it produces is announced by `pre_order.fulfilled`, which carries the `line_id`. `stripe_client_secret` is `null` here. A pre-order of another account, or an unknown id, returns `404 not_found`.
3289
+ * @description Returns one pre-order of the account. Accepts an API key. A line-scoped key is not limited to its list on this operation. A pre-order carries no line id: the line it produces is announced by `pre_order.fulfilled`, which carries the `line_id`. `stripe_client_secret` is `null` here. Reading a pre-order in status `awaiting_payment` checks its first-month payment with Stripe: when that payment has succeeded, the build starts and the pre-order is returned in `provisioning`. When Stripe cannot be reached, the read still answers, with the pre-order in `awaiting_payment`. A pre-order of another account, or an unknown id, returns `404 not_found`.
3266
3290
  */
3267
3291
  get: {
3268
3292
  parameters: {
@@ -3448,7 +3472,7 @@ export interface paths {
3448
3472
  put?: never;
3449
3473
  /**
3450
3474
  * Cancel a pre-order
3451
- * @description Cancels a draft pre-order: nothing was created and nothing was charged. Accepts an API key. A line-scoped key is not limited to its list on this operation. Sets `status` to `cancelled` and sends `pre_order.cancelled`. Only a draft can be canceled: a pre-order that is confirmed, fulfilled or already canceled returns `400 pre_order_already_confirmed`, and a cancellation that runs at the same time as a confirmation or as another cancellation returns `409 pre_order_already_confirmed`. A confirmed pre-order cannot be canceled through the API.
3475
+ * @description Cancels a pre-order in status `draft` or `awaiting_payment`: nothing was created and nothing was charged. Accepts an API key. A line-scoped key is not limited to its list on this operation. Sets `status` to `cancelled` and sends `pre_order.cancelled`. For a pre-order in `awaiting_payment`, the first-month payment is canceled first: the client secret returned by confirm can no longer be used. When that first month is already paid, the call returns `409 pre_order_already_paid` and the build goes on. A pre-order that is `provisioning`, `fulfilled` or already `cancelled` returns `400 pre_order_already_confirmed`, and the cancellation of a draft that runs at the same time as another cancellation, or as the confirmation of a wholesale partner, returns `409 pre_order_already_confirmed`. When Stripe cannot be reached, the call returns `503 payment_provider_unavailable`: nothing changed, and the call can be repeated. When Stripe refuses the request for the account, the call returns `409 payment_setup_failed`: nothing changed, and repeating the call does not help. Once its build has started, a pre-order cannot be canceled through the API.
3452
3476
  */
3453
3477
  post: {
3454
3478
  parameters: {
@@ -3482,7 +3506,7 @@ export interface paths {
3482
3506
  };
3483
3507
  };
3484
3508
  };
3485
- /** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. It is `pre_order_already_confirmed` when the pre-order is not a draft: it is confirmed, fulfilled or already canceled. */
3509
+ /** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. It is `pre_order_already_confirmed` when the pre-order is `provisioning`, `fulfilled` or already `cancelled`. */
3486
3510
  400: {
3487
3511
  headers: {
3488
3512
  [name: string]: unknown;
@@ -3509,7 +3533,7 @@ export interface paths {
3509
3533
  "application/json": components["schemas"]["ErrorEnvelope"];
3510
3534
  };
3511
3535
  };
3512
- /** @description Conflict. `error.code` is `pre_order_already_confirmed`: a confirmation or another cancellation of the same pre-order ran at the same time and won. */
3536
+ /** @description Conflict. `error.code` is `pre_order_already_paid` when the first month is already paid. It is `pre_order_already_confirmed` when a confirmation or another cancellation of the same draft ran at the same time and won. It is `payment_setup_failed` when Stripe refused the request for the account: repeating the call does not help. */
3513
3537
  409: {
3514
3538
  headers: {
3515
3539
  [name: string]: unknown;
@@ -3536,6 +3560,15 @@ export interface paths {
3536
3560
  "application/json": components["schemas"]["ErrorEnvelope"];
3537
3561
  };
3538
3562
  };
3563
+ /** @description Service unavailable. `error.code` is `payment_provider_unavailable`: Stripe could not be reached. Nothing changed, and the call can be repeated. */
3564
+ 503: {
3565
+ headers: {
3566
+ [name: string]: unknown;
3567
+ };
3568
+ content: {
3569
+ "application/json": components["schemas"]["ErrorEnvelope"];
3570
+ };
3571
+ };
3539
3572
  };
3540
3573
  };
3541
3574
  delete?: never;
@@ -3555,7 +3588,11 @@ export interface paths {
3555
3588
  put?: never;
3556
3589
  /**
3557
3590
  * Start the payment of a reserved line
3558
- * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Creates a payment page for a rented line that the account reserved with `POST /v1/lines/{id}/reserve`, and returns its URL. The line is activated when the payment completes. Only a rented line in status `reserved` can be paid for here. The response is not wrapped in the standard envelope.
3591
+ * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Creates the per-line subscription of a rented line that the account reserved with `POST /v1/lines/{id}/reserve`, and returns `client_secret`, the client secret of its first payment, for the payment form of Stripe. Only a rented line in status `reserved` can be paid for here. A wholesale partner gets `403 wholesale_partner_no_checkout`.
3592
+ *
3593
+ * The line becomes `active` when the first payment succeeds, and stays `reserved` until then. The call moves the `expires_at` of the line to 24 hours after the creation of the subscription. A subscription whose first payment has not succeeded 23 hours after its creation ends, and the line returns to `available`. A payment that succeeds for a line that the account no longer has reserved activates no line: iSnap cancels the subscription and records the charge as a refund owed to the account. No operation of this API makes that refund.
3594
+ *
3595
+ * A reserved line has at most one unpaid subscription. A repeated call with the same `inbound_only` returns the same `subscription_id` and `client_secret`. A call with the other value of `inbound_only` cancels the unpaid subscription and creates another one. Once the first payment of a subscription of the reservation has been submitted, and until the line is `active`, every call returns `409 purchase_payment_in_progress`, whatever `inbound_only` it sends, and cancels or creates nothing: read the line with `GET /v1/lines/{id}` until it is `active`. A canceled unpaid subscription can no longer be paid. `POST /v1/lines/{id}/release` cancels the unpaid subscription.
3559
3596
  */
3560
3597
  post: {
3561
3598
  parameters: {
@@ -3581,13 +3618,13 @@ export interface paths {
3581
3618
  };
3582
3619
  };
3583
3620
  responses: {
3584
- /** @description The URL of the payment page. */
3621
+ /** @description The subscription and the client secret of its first payment. */
3585
3622
  200: {
3586
3623
  headers: {
3587
3624
  [name: string]: unknown;
3588
3625
  };
3589
3626
  content: {
3590
- "application/json": components["schemas"]["Checkout"];
3627
+ "application/json": components["schemas"]["CheckoutEnvelope"];
3591
3628
  };
3592
3629
  };
3593
3630
  /** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. It is `bad_request` when the line is not in status `reserved`, `tier_not_checkoutable` when the line is not a rented line, and `android_rental_not_purchasable` for an Android line. */
@@ -3608,6 +3645,15 @@ export interface paths {
3608
3645
  "application/json": components["schemas"]["ErrorEnvelope"];
3609
3646
  };
3610
3647
  };
3648
+ /** @description Refused. `error.code` is `wholesale_partner_no_checkout` when the account is a wholesale partner. It is `forbidden` when the request carries no header `X-Requested-With: XMLHttpRequest`. */
3649
+ 403: {
3650
+ headers: {
3651
+ [name: string]: unknown;
3652
+ };
3653
+ content: {
3654
+ "application/json": components["schemas"]["ErrorEnvelope"];
3655
+ };
3656
+ };
3611
3657
  /** @description Not found. `error.code` is `not_found`: the account reserved no line with this id. */
3612
3658
  404: {
3613
3659
  headers: {
@@ -3617,6 +3663,15 @@ export interface paths {
3617
3663
  "application/json": components["schemas"]["ErrorEnvelope"];
3618
3664
  };
3619
3665
  };
3666
+ /** @description Conflict. `error.code` is `line_not_reserved` when the reservation of the line has ended. It is `purchase_payment_in_progress` when the first payment of a subscription of the reservation has been submitted and the line is not `active` yet: nothing is canceled or created. It is `purchase_in_progress` when the request has waited 10 seconds for another request that starts a payment for the same account: resend the request. */
3667
+ 409: {
3668
+ headers: {
3669
+ [name: string]: unknown;
3670
+ };
3671
+ content: {
3672
+ "application/json": components["schemas"]["ErrorEnvelope"];
3673
+ };
3674
+ };
3620
3675
  /** @description Too many requests. `error.code` is `rate_limit_exceeded` when more than 100 requests came from the same network address in 60 seconds, whatever their API key or account: wait `error.retry_after` seconds. */
3621
3676
  429: {
3622
3677
  headers: {
@@ -3626,7 +3681,7 @@ export interface paths {
3626
3681
  "application/json": components["schemas"]["ErrorEnvelope"];
3627
3682
  };
3628
3683
  };
3629
- /** @description Unexpected failure. `error.code` is `internal_error`. An operation that takes a JSON body also returns it when the body, sent as `application/json`, is not valid JSON. Quote `trace_id` when you report it to iSnap. */
3684
+ /** @description Unexpected failure. `error.code` is `stripe_payment_not_started` when Stripe returned no payment to confirm: nothing was charged, and the call can be made again. In any other case `error.code` is `internal_error`. An operation that takes a JSON body also returns it when the body, sent as `application/json`, is not valid JSON. Quote `trace_id` when you report it to iSnap. */
3630
3685
  500: {
3631
3686
  headers: {
3632
3687
  [name: string]: unknown;
@@ -3654,7 +3709,11 @@ export interface paths {
3654
3709
  put?: never;
3655
3710
  /**
3656
3711
  * Start the payment of BYOD slots
3657
- * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Creates a payment page for a subscription to `device_count` BYOD slots, with the billing period chosen in `billing_cycle`, and returns its URL and its expiry. Each slot allows one BYOD line: `POST /v1/byod/pair` needs a free slot. The customer can change the number of slots on the payment page, from 1 to 50.
3712
+ * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Creates a subscription to `device_count` BYOD slots, with the billing period chosen in `billing_cycle`, and returns `client_secret`, the client secret of its first payment, for the payment form of Stripe, with the recurring total for that number of slots. Each slot allows one BYOD line: `POST /v1/byod/pair` needs a free slot. A wholesale partner gets `403 wholesale_partner_no_checkout`.
3713
+ *
3714
+ * The slots are available when the first payment succeeds. A subscription whose first payment has not succeeded 23 hours after its creation ends without providing a slot.
3715
+ *
3716
+ * An account has at most one unpaid subscription to BYOD slots. A repeated call with the same `device_count` and `billing_cycle` returns the same `subscription_id` and `client_secret`. A call with another `device_count` or `billing_cycle` cancels the unpaid subscription and creates another one. Once the first payment of a subscription to BYOD slots has been submitted, every call returns `409 purchase_payment_in_progress` and cancels or creates nothing, until `byod_slots.paid` in `GET /v1/billing/coverage` counts its slots and for one hour at most after that payment succeeded. After that, a call creates another subscription. A canceled unpaid subscription can no longer be paid. `DELETE /v1/billing/subscriptions/{id}` cancels an unpaid subscription immediately.
3658
3717
  */
3659
3718
  post: {
3660
3719
  parameters: {
@@ -3669,7 +3728,7 @@ export interface paths {
3669
3728
  };
3670
3729
  };
3671
3730
  responses: {
3672
- /** @description The URL of the payment page and its expiry. */
3731
+ /** @description The subscription, the client secret of its first payment and the recurring total. */
3673
3732
  200: {
3674
3733
  headers: {
3675
3734
  [name: string]: unknown;
@@ -3696,6 +3755,24 @@ export interface paths {
3696
3755
  "application/json": components["schemas"]["ErrorEnvelope"];
3697
3756
  };
3698
3757
  };
3758
+ /** @description Refused. `error.code` is `wholesale_partner_no_checkout` when the account is a wholesale partner. It is `forbidden` when the request carries no header `X-Requested-With: XMLHttpRequest`. */
3759
+ 403: {
3760
+ headers: {
3761
+ [name: string]: unknown;
3762
+ };
3763
+ content: {
3764
+ "application/json": components["schemas"]["ErrorEnvelope"];
3765
+ };
3766
+ };
3767
+ /** @description Conflict. `error.code` is `purchase_payment_in_progress` when the first payment of a subscription to the same product has been submitted and what it buys is not counted yet in `GET /v1/billing/coverage`, for one hour at most after that payment succeeded: nothing is canceled or created. It is `purchase_in_progress` when the request has waited 10 seconds for another request that starts a payment for the same account: resend the request. */
3768
+ 409: {
3769
+ headers: {
3770
+ [name: string]: unknown;
3771
+ };
3772
+ content: {
3773
+ "application/json": components["schemas"]["ErrorEnvelope"];
3774
+ };
3775
+ };
3699
3776
  /** @description Too many requests. `error.code` is `rate_limit_exceeded` when more than 100 requests came from the same network address in 60 seconds, whatever their API key or account: wait `error.retry_after` seconds. */
3700
3777
  429: {
3701
3778
  headers: {
@@ -3705,7 +3782,7 @@ export interface paths {
3705
3782
  "application/json": components["schemas"]["ErrorEnvelope"];
3706
3783
  };
3707
3784
  };
3708
- /** @description Unexpected failure. `error.code` is `internal_error`. An operation that takes a JSON body also returns it when the body, sent as `application/json`, is not valid JSON. Quote `trace_id` when you report it to iSnap. */
3785
+ /** @description Unexpected failure. `error.code` is `stripe_payment_not_started` when Stripe returned no payment to confirm: nothing was charged, and the call can be made again. In any other case `error.code` is `internal_error`. An operation that takes a JSON body also returns it when the body, sent as `application/json`, is not valid JSON. Quote `trace_id` when you report it to iSnap. */
3709
3786
  500: {
3710
3787
  headers: {
3711
3788
  [name: string]: unknown;
@@ -3733,7 +3810,13 @@ export interface paths {
3733
3810
  put?: never;
3734
3811
  /**
3735
3812
  * Start the payment of hosted macOS sessions
3736
- * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Creates a payment page for a subscription to `quantity` hosted macOS sessions, with the billing period chosen in `billing_cycle`, and returns its URL, its expiry and an estimate of the recurring total. `quantity` must be a whole number of packs, and at least one pack: otherwise the call returns `422 mac_quantity_not_a_pack`, with the size of a pack in `error.issues[0].min`. The account cannot hold more hosted macOS sessions than BYOD lines: otherwise the call returns `422 mac_sessions_exceed_byop_lines`. The quantity cannot be changed on the payment page: change it later with `PATCH /v1/billing/subscriptions/{id}`.
3813
+ * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Creates a subscription to `quantity` hosted macOS sessions, with the billing period chosen in `billing_cycle`, and returns `client_secret`, the client secret of its first payment, for the payment form of Stripe, with an estimate of the recurring total. `GET /v1/billing/mac-quote` returns the same estimate and creates nothing. A wholesale partner gets `403 wholesale_partner_no_checkout`.
3814
+ *
3815
+ * `quantity` must be a whole number of packs, and at least one pack: otherwise the call returns `422 mac_quantity_not_a_pack`, with the size of a pack in `error.issues[0].min`. The account cannot hold more hosted macOS sessions than BYOD lines: otherwise the call returns `422 mac_sessions_exceed_byop_lines`. The sessions of an unpaid subscription count in that comparison for 24 hours at most.
3816
+ *
3817
+ * The sessions are available when the first payment succeeds. A subscription whose first payment has not succeeded 23 hours after its creation ends without providing a session.
3818
+ *
3819
+ * An account has at most one unpaid subscription to hosted macOS sessions. A repeated call with the same `quantity` and `billing_cycle` returns the same `subscription_id` and `client_secret`. A call with another `quantity` or `billing_cycle` cancels the unpaid subscription and creates another one. Once the first payment of a subscription to hosted macOS sessions has been submitted, every call returns `409 purchase_payment_in_progress` and cancels or creates nothing, until `mac_sessions.paid` in `GET /v1/billing/coverage` counts its sessions and for one hour at most after that payment succeeded. After that, a call creates another subscription. A canceled unpaid subscription can no longer be paid. `DELETE /v1/billing/subscriptions/{id}` cancels an unpaid subscription immediately. To change the quantity of a subscription whose first payment succeeded, call `PATCH /v1/billing/subscriptions/{id}`.
3737
3820
  */
3738
3821
  post: {
3739
3822
  parameters: {
@@ -3748,7 +3831,7 @@ export interface paths {
3748
3831
  };
3749
3832
  };
3750
3833
  responses: {
3751
- /** @description The URL of the payment page, its expiry and the estimated total. */
3834
+ /** @description The subscription, the client secret of its first payment and the estimated total. */
3752
3835
  200: {
3753
3836
  headers: {
3754
3837
  [name: string]: unknown;
@@ -3775,6 +3858,15 @@ export interface paths {
3775
3858
  "application/json": components["schemas"]["ErrorEnvelope"];
3776
3859
  };
3777
3860
  };
3861
+ /** @description Refused. `error.code` is `wholesale_partner_no_checkout` when the account is a wholesale partner. It is `forbidden` when the request carries no header `X-Requested-With: XMLHttpRequest`. */
3862
+ 403: {
3863
+ headers: {
3864
+ [name: string]: unknown;
3865
+ };
3866
+ content: {
3867
+ "application/json": components["schemas"]["ErrorEnvelope"];
3868
+ };
3869
+ };
3778
3870
  /** @description Not found. `error.code` is `not_found`: the account of the session no longer exists. */
3779
3871
  404: {
3780
3872
  headers: {
@@ -3784,6 +3876,15 @@ export interface paths {
3784
3876
  "application/json": components["schemas"]["ErrorEnvelope"];
3785
3877
  };
3786
3878
  };
3879
+ /** @description Conflict. `error.code` is `purchase_payment_in_progress` when the first payment of a subscription to the same product has been submitted and what it buys is not counted yet in `GET /v1/billing/coverage`, for one hour at most after that payment succeeded: nothing is canceled or created. It is `purchase_in_progress` when the request has waited 10 seconds for another request that starts a payment for the same account: resend the request. */
3880
+ 409: {
3881
+ headers: {
3882
+ [name: string]: unknown;
3883
+ };
3884
+ content: {
3885
+ "application/json": components["schemas"]["ErrorEnvelope"];
3886
+ };
3887
+ };
3787
3888
  /** @description The request breaks a rule of this operation. `error.code` is `mac_quantity_not_a_pack` when `quantity` is not a whole number of packs or is below one pack. It is `mac_sessions_exceed_byop_lines` when the account would hold more hosted macOS sessions than BYOD lines. */
3788
3889
  422: {
3789
3890
  headers: {
@@ -3802,6 +3903,168 @@ export interface paths {
3802
3903
  "application/json": components["schemas"]["ErrorEnvelope"];
3803
3904
  };
3804
3905
  };
3906
+ /** @description Unexpected failure. `error.code` is `stripe_payment_not_started` when Stripe returned no payment to confirm: nothing was charged, and the call can be made again. `error.code` is `mac_pack_size_unconfigured` or `mac_price_not_graduated` when the price of hosted macOS sessions is misconfigured. In any other case `error.code` is `internal_error`. An operation that takes a JSON body also returns it when the body, sent as `application/json`, is not valid JSON. Quote `trace_id` when you report it to iSnap. */
3907
+ 500: {
3908
+ headers: {
3909
+ [name: string]: unknown;
3910
+ };
3911
+ content: {
3912
+ "application/json": components["schemas"]["ErrorEnvelope"];
3913
+ };
3914
+ };
3915
+ };
3916
+ };
3917
+ delete?: never;
3918
+ options?: never;
3919
+ head?: never;
3920
+ patch?: never;
3921
+ trace?: never;
3922
+ };
3923
+ "/v1/billing/mac-quote": {
3924
+ parameters: {
3925
+ query?: never;
3926
+ header?: never;
3927
+ path?: never;
3928
+ cookie?: never;
3929
+ };
3930
+ /**
3931
+ * Get a quote for hosted macOS sessions
3932
+ * @description Dashboard session only: an API key is refused with `401`. Returns the price tiers of hosted macOS sessions for the billing period chosen in `billing_cycle`, and `estimated_total_cents`, the recurring total for `quantity` sessions. Each tier prices only the sessions that fall inside it. `quantity` must be a whole number of packs, and at least one pack: otherwise the call returns `422 mac_quantity_not_a_pack`, with the size of a pack in `error.issues[0].min`. The call creates nothing and does not compare `quantity` with the number of BYOD lines of the account.
3933
+ */
3934
+ get: {
3935
+ parameters: {
3936
+ query: {
3937
+ /** @description Number of hosted macOS sessions to price: a whole number of packs, and at least one pack. The size of a pack is returned as `pack_size`, and as `error.issues[0].min` of the `422 mac_quantity_not_a_pack` refusal. */
3938
+ quantity?: number | null;
3939
+ /** @description Billing period to price: `monthly`, `quarterly` or `annual`. */
3940
+ billing_cycle: "monthly" | "quarterly" | "annual";
3941
+ };
3942
+ header?: never;
3943
+ path?: never;
3944
+ cookie?: never;
3945
+ };
3946
+ requestBody?: never;
3947
+ responses: {
3948
+ /** @description The price tiers and the estimated total. */
3949
+ 200: {
3950
+ headers: {
3951
+ [name: string]: unknown;
3952
+ };
3953
+ content: {
3954
+ "application/json": components["schemas"]["MacQuoteEnvelope"];
3955
+ };
3956
+ };
3957
+ /** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. */
3958
+ 400: {
3959
+ headers: {
3960
+ [name: string]: unknown;
3961
+ };
3962
+ content: {
3963
+ "application/json": components["schemas"]["ErrorEnvelope"];
3964
+ };
3965
+ };
3966
+ /** @description No valid credential. `error.code` is `unauthorized`. */
3967
+ 401: {
3968
+ headers: {
3969
+ [name: string]: unknown;
3970
+ };
3971
+ content: {
3972
+ "application/json": components["schemas"]["ErrorEnvelope"];
3973
+ };
3974
+ };
3975
+ /** @description The request breaks a rule of this operation. `error.code` is `mac_quantity_not_a_pack`: `quantity` is not a whole number of packs or is below one pack. */
3976
+ 422: {
3977
+ headers: {
3978
+ [name: string]: unknown;
3979
+ };
3980
+ content: {
3981
+ "application/json": components["schemas"]["ErrorEnvelope"];
3982
+ };
3983
+ };
3984
+ /** @description Too many requests. `error.code` is `rate_limit_exceeded` when more than 100 requests came from the same network address in 60 seconds, whatever their API key or account: wait `error.retry_after` seconds. */
3985
+ 429: {
3986
+ headers: {
3987
+ [name: string]: unknown;
3988
+ };
3989
+ content: {
3990
+ "application/json": components["schemas"]["ErrorEnvelope"];
3991
+ };
3992
+ };
3993
+ /** @description Unexpected failure. `error.code` is `mac_pack_size_unconfigured` or `mac_price_not_graduated` when the price of hosted macOS sessions is misconfigured. In any other case `error.code` is `internal_error`. An operation that takes a JSON body also returns it when the body, sent as `application/json`, is not valid JSON. Quote `trace_id` when you report it to iSnap. */
3994
+ 500: {
3995
+ headers: {
3996
+ [name: string]: unknown;
3997
+ };
3998
+ content: {
3999
+ "application/json": components["schemas"]["ErrorEnvelope"];
4000
+ };
4001
+ };
4002
+ };
4003
+ };
4004
+ put?: never;
4005
+ post?: never;
4006
+ delete?: never;
4007
+ options?: never;
4008
+ head?: never;
4009
+ patch?: never;
4010
+ trace?: never;
4011
+ };
4012
+ "/v1/billing/config": {
4013
+ parameters: {
4014
+ query?: never;
4015
+ header?: never;
4016
+ path?: never;
4017
+ cookie?: never;
4018
+ };
4019
+ /**
4020
+ * Get the payment configuration
4021
+ * @description Dashboard session only: an API key is refused with `401`. Returns `publishable_key`, the Stripe publishable key that the payment form of Stripe is loaded with, and `wholesale`, which is `true` for a wholesale partner. A wholesale partner cannot start a payment with this API: for such an account, `publishable_key` is `null` when iSnap has no publishable key to return. Any other account then gets `503 stripe_not_configured`.
4022
+ */
4023
+ get: {
4024
+ parameters: {
4025
+ query?: never;
4026
+ header?: never;
4027
+ path?: never;
4028
+ cookie?: never;
4029
+ };
4030
+ requestBody?: never;
4031
+ responses: {
4032
+ /** @description The Stripe publishable key and the type of the account. */
4033
+ 200: {
4034
+ headers: {
4035
+ [name: string]: unknown;
4036
+ };
4037
+ content: {
4038
+ "application/json": components["schemas"]["BillingConfigEnvelope"];
4039
+ };
4040
+ };
4041
+ /** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. */
4042
+ 400: {
4043
+ headers: {
4044
+ [name: string]: unknown;
4045
+ };
4046
+ content: {
4047
+ "application/json": components["schemas"]["ErrorEnvelope"];
4048
+ };
4049
+ };
4050
+ /** @description No valid credential. `error.code` is `unauthorized`. */
4051
+ 401: {
4052
+ headers: {
4053
+ [name: string]: unknown;
4054
+ };
4055
+ content: {
4056
+ "application/json": components["schemas"]["ErrorEnvelope"];
4057
+ };
4058
+ };
4059
+ /** @description Too many requests. `error.code` is `rate_limit_exceeded` when more than 100 requests came from the same network address in 60 seconds, whatever their API key or account: wait `error.retry_after` seconds. */
4060
+ 429: {
4061
+ headers: {
4062
+ [name: string]: unknown;
4063
+ };
4064
+ content: {
4065
+ "application/json": components["schemas"]["ErrorEnvelope"];
4066
+ };
4067
+ };
3805
4068
  /** @description Unexpected failure. `error.code` is `internal_error`. An operation that takes a JSON body also returns it when the body, sent as `application/json`, is not valid JSON. Quote `trace_id` when you report it to iSnap. */
3806
4069
  500: {
3807
4070
  headers: {
@@ -3811,8 +4074,94 @@ export interface paths {
3811
4074
  "application/json": components["schemas"]["ErrorEnvelope"];
3812
4075
  };
3813
4076
  };
4077
+ /** @description Unavailable. `error.code` is `stripe_not_configured`: iSnap has no publishable key to return, and the account is not a wholesale partner. */
4078
+ 503: {
4079
+ headers: {
4080
+ [name: string]: unknown;
4081
+ };
4082
+ content: {
4083
+ "application/json": components["schemas"]["ErrorEnvelope"];
4084
+ };
4085
+ };
3814
4086
  };
3815
4087
  };
4088
+ put?: never;
4089
+ post?: never;
4090
+ delete?: never;
4091
+ options?: never;
4092
+ head?: never;
4093
+ patch?: never;
4094
+ trace?: never;
4095
+ };
4096
+ "/v1/billing/coverage": {
4097
+ parameters: {
4098
+ query?: never;
4099
+ header?: never;
4100
+ path?: never;
4101
+ cookie?: never;
4102
+ };
4103
+ /**
4104
+ * Get the coverage of the account
4105
+ * @description Dashboard session only: an API key is refused with `401`. Returns the numbers that the purchase and pairing operations compare: the BYOD slots that the account has paid for and the BYOD lines that use them, the hosted macOS sessions that it has paid for and the ones assigned to it, and the sessions of unpaid subscriptions. A subscription counts in `paid` once iSnap has recorded its first payment. The API does not bound the delay between a payment and that record: read this operation until the count changes.
4106
+ */
4107
+ get: {
4108
+ parameters: {
4109
+ query?: never;
4110
+ header?: never;
4111
+ path?: never;
4112
+ cookie?: never;
4113
+ };
4114
+ requestBody?: never;
4115
+ responses: {
4116
+ /** @description The coverage of the account. */
4117
+ 200: {
4118
+ headers: {
4119
+ [name: string]: unknown;
4120
+ };
4121
+ content: {
4122
+ "application/json": components["schemas"]["BillingCoverageEnvelope"];
4123
+ };
4124
+ };
4125
+ /** @description Invalid request. `error.code` is `validation_failed` when a parameter, a header or the body does not match its schema: `error.issues` then lists each problem. */
4126
+ 400: {
4127
+ headers: {
4128
+ [name: string]: unknown;
4129
+ };
4130
+ content: {
4131
+ "application/json": components["schemas"]["ErrorEnvelope"];
4132
+ };
4133
+ };
4134
+ /** @description No valid credential. `error.code` is `unauthorized`. */
4135
+ 401: {
4136
+ headers: {
4137
+ [name: string]: unknown;
4138
+ };
4139
+ content: {
4140
+ "application/json": components["schemas"]["ErrorEnvelope"];
4141
+ };
4142
+ };
4143
+ /** @description Too many requests. `error.code` is `rate_limit_exceeded` when more than 100 requests came from the same network address in 60 seconds, whatever their API key or account: wait `error.retry_after` seconds. */
4144
+ 429: {
4145
+ headers: {
4146
+ [name: string]: unknown;
4147
+ };
4148
+ content: {
4149
+ "application/json": components["schemas"]["ErrorEnvelope"];
4150
+ };
4151
+ };
4152
+ /** @description Unexpected failure. `error.code` is `internal_error`. An operation that takes a JSON body also returns it when the body, sent as `application/json`, is not valid JSON. Quote `trace_id` when you report it to iSnap. */
4153
+ 500: {
4154
+ headers: {
4155
+ [name: string]: unknown;
4156
+ };
4157
+ content: {
4158
+ "application/json": components["schemas"]["ErrorEnvelope"];
4159
+ };
4160
+ };
4161
+ };
4162
+ };
4163
+ put?: never;
4164
+ post?: never;
3816
4165
  delete?: never;
3817
4166
  options?: never;
3818
4167
  head?: never;
@@ -3831,7 +4180,9 @@ export interface paths {
3831
4180
  post?: never;
3832
4181
  /**
3833
4182
  * Cancel a subscription
3834
- * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Schedules the subscription of a line to end at the end of the billing period already paid. The line works until then, and `cancel_at_period_end` reads `true` in `GET /v1/billing/subscriptions`. Only the subscription of a line of the account can be canceled here: any other subscription, a subscription to BYOD slots or to hosted macOS sessions included, returns `403 forbidden`. The response is not wrapped in the standard envelope.
4183
+ * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Schedules a subscription of the account to end at the end of the billing period already paid: the subscription of a line, a subscription to BYOD slots or a subscription to hosted macOS sessions. The line, the slots or the sessions work until then, and `cancel_at_period_end` reads `true` in `GET /v1/billing/subscriptions`. A subscription to BYOD slots or to hosted macOS sessions whose first payment has not succeeded is canceled immediately instead, and can no longer be paid; when that payment has been submitted, the call returns `409 purchase_payment_in_progress` and cancels nothing.
4184
+ *
4185
+ * Canceling a subscription to BYOD slots returns `422 byop_reduction_strands_mac_sessions` when the account would hold fewer BYOD slots than hosted macOS sessions at the end of the billing period: cancel the subscription to hosted macOS sessions first. When the subscription to BYOD slots ends, the `active` BYOD lines of the account that its remaining BYOD slots no longer cover take the status `cancelled`, oldest first. A subscription to BYOD slots or to hosted macOS sessions that has already ended returns `409 subscription_already_ended`. Any other subscription, a subscription of another account included, returns `403 forbidden`. The response is not wrapped in the standard envelope.
3835
4186
  */
3836
4187
  delete: {
3837
4188
  parameters: {
@@ -3872,6 +4223,15 @@ export interface paths {
3872
4223
  "application/json": components["schemas"]["ErrorEnvelope"];
3873
4224
  };
3874
4225
  };
4226
+ /** @description Refused. `error.code` is `forbidden`: this operation cannot cancel the subscription, or the subscription belongs to another account, or the request carries no header `X-Requested-With: XMLHttpRequest`. */
4227
+ 403: {
4228
+ headers: {
4229
+ [name: string]: unknown;
4230
+ };
4231
+ content: {
4232
+ "application/json": components["schemas"]["ErrorEnvelope"];
4233
+ };
4234
+ };
3875
4235
  /** @description Not found. `error.code` is `not_found`: the account has no billing account yet. iSnap creates one when the account starts a payment. */
3876
4236
  404: {
3877
4237
  headers: {
@@ -3881,7 +4241,7 @@ export interface paths {
3881
4241
  "application/json": components["schemas"]["ErrorEnvelope"];
3882
4242
  };
3883
4243
  };
3884
- /** @description Conflict. The resource is not in a state that allows this operation; `error.code` names the reason. */
4244
+ /** @description Conflict. The resource is not in a state that allows this operation; `error.code` names the reason. It is `subscription_already_ended` when a subscription to BYOD slots or to hosted macOS sessions has already ended. It is `purchase_payment_in_progress` when the first payment of an unpaid subscription has been submitted. */
3885
4245
  409: {
3886
4246
  headers: {
3887
4247
  [name: string]: unknown;
@@ -3890,6 +4250,15 @@ export interface paths {
3890
4250
  "application/json": components["schemas"]["ErrorEnvelope"];
3891
4251
  };
3892
4252
  };
4253
+ /** @description The request breaks a rule of this operation. `error.code` is `byop_reduction_strands_mac_sessions`: the account would hold fewer BYOD slots than hosted macOS sessions. */
4254
+ 422: {
4255
+ headers: {
4256
+ [name: string]: unknown;
4257
+ };
4258
+ content: {
4259
+ "application/json": components["schemas"]["ErrorEnvelope"];
4260
+ };
4261
+ };
3893
4262
  /** @description Too many requests. `error.code` is `rate_limit_exceeded` when more than 100 requests came from the same network address in 60 seconds, whatever their API key or account: wait `error.retry_after` seconds. */
3894
4263
  429: {
3895
4264
  headers: {
@@ -3914,7 +4283,7 @@ export interface paths {
3914
4283
  head?: never;
3915
4284
  /**
3916
4285
  * Change the quantity of a subscription
3917
- * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Sets the quantity of a subscription to hosted macOS sessions, or of a subscription to BYOD slots. A number of hosted macOS sessions must be a whole number of packs (`422 mac_quantity_not_a_pack`) and cannot exceed the number of BYOD lines of the account (`422 mac_sessions_exceed_byop_lines`). A number of BYOD slots cannot fall below the number of hosted macOS sessions that the account holds (`422 byop_reduction_strands_mac_sessions`). Any other subscription, the subscription of a rented line included, returns `409 subscription_not_quantity_adjustable`. A subscription of another account returns `403 forbidden`.
4286
+ * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Sets the quantity of a subscription to hosted macOS sessions, or of a subscription to BYOD slots. A number of hosted macOS sessions must be a whole number of packs (`422 mac_quantity_not_a_pack`) and cannot exceed the number of BYOD lines of the account (`422 mac_sessions_exceed_byop_lines`). A number of BYOD slots cannot fall below the number of hosted macOS sessions that the account holds (`422 byop_reduction_strands_mac_sessions`), and cannot be reduced below the number of BYOD lines of the account that are not `cancelled` (`422 byop_reduction_strands_byod_lines`, with that number in `error.issues[0].min`): end BYOD lines first. A subscription that has already ended returns `409 subscription_already_ended`. A subscription whose first payment has not succeeded returns `409 subscription_awaiting_payment`: start the payment again with another quantity instead. Any other subscription, the subscription of a rented line included, returns `409 subscription_not_quantity_adjustable`. A subscription of another account returns `403 forbidden`.
3918
4287
  */
3919
4288
  patch: {
3920
4289
  parameters: {
@@ -3977,7 +4346,7 @@ export interface paths {
3977
4346
  "application/json": components["schemas"]["ErrorEnvelope"];
3978
4347
  };
3979
4348
  };
3980
- /** @description Conflict. `error.code` is `subscription_not_quantity_adjustable`: the subscription is neither a subscription to hosted macOS sessions nor a subscription to BYOD slots. */
4349
+ /** @description Conflict. `error.code` is `subscription_already_ended` when the subscription has already ended. It is `subscription_awaiting_payment` when the first payment of the subscription has not succeeded. It is `subscription_not_quantity_adjustable` when the subscription is neither a subscription to hosted macOS sessions nor a subscription to BYOD slots. */
3981
4350
  409: {
3982
4351
  headers: {
3983
4352
  [name: string]: unknown;
@@ -3986,7 +4355,7 @@ export interface paths {
3986
4355
  "application/json": components["schemas"]["ErrorEnvelope"];
3987
4356
  };
3988
4357
  };
3989
- /** @description The request breaks a rule of this operation. `error.code` is `mac_quantity_not_a_pack` when the number of hosted macOS sessions is not a whole number of packs or is below one pack. It is `mac_sessions_exceed_byop_lines` when the account would hold more hosted macOS sessions than BYOD lines. It is `byop_reduction_strands_mac_sessions` when the account would hold fewer BYOD slots than hosted macOS sessions. */
4358
+ /** @description The request breaks a rule of this operation. `error.code` is `mac_quantity_not_a_pack` when the number of hosted macOS sessions is not a whole number of packs or is below one pack. It is `mac_sessions_exceed_byop_lines` when the account would hold more hosted macOS sessions than BYOD lines. It is `byop_reduction_strands_mac_sessions` when the account would hold fewer BYOD slots than hosted macOS sessions. It is `byop_reduction_strands_byod_lines` when a reduction would leave the account with fewer BYOD slots than BYOD lines that are not `cancelled`. */
3990
4359
  422: {
3991
4360
  headers: {
3992
4361
  [name: string]: unknown;
@@ -4004,7 +4373,7 @@ export interface paths {
4004
4373
  "application/json": components["schemas"]["ErrorEnvelope"];
4005
4374
  };
4006
4375
  };
4007
- /** @description Unexpected failure. `error.code` is `internal_error`. An operation that takes a JSON body also returns it when the body, sent as `application/json`, is not valid JSON. Quote `trace_id` when you report it to iSnap. */
4376
+ /** @description Unexpected failure. `error.code` is `mac_pack_size_unconfigured` or `mac_price_not_graduated` when the price of hosted macOS sessions is misconfigured. In any other case `error.code` is `internal_error`. An operation that takes a JSON body also returns it when the body, sent as `application/json`, is not valid JSON. Quote `trace_id` when you report it to iSnap. */
4008
4377
  500: {
4009
4378
  headers: {
4010
4379
  [name: string]: unknown;
@@ -4026,7 +4395,7 @@ export interface paths {
4026
4395
  };
4027
4396
  /**
4028
4397
  * List subscriptions
4029
- * @description Dashboard session only: an API key is refused with `401`. Returns the subscriptions of the account, in every status, ended ones included: the 100 most recent at most, without pagination.
4398
+ * @description Dashboard session only: an API key is refused with `401`. Returns the subscriptions of the account, ended ones included: the 100 most recent at most, without pagination. A subscription whose first payment has not succeeded is returned with `status: incomplete` while it can still be paid. A subscription that expired unpaid, or that an operation of this API canceled while it was unpaid, is not returned.
4030
4399
  */
4031
4400
  get: {
4032
4401
  parameters: {
@@ -4101,7 +4470,7 @@ export interface paths {
4101
4470
  };
4102
4471
  /**
4103
4472
  * List invoices
4104
- * @description Dashboard session only: an API key is refused with `401`. Returns the invoices of the account, newest first: the 100 most recent at most, without pagination.
4473
+ * @description Dashboard session only: an API key is refused with `401`. Returns the invoices of the account, newest first: the 100 most recent at most, without pagination. The void first invoice of a subscription whose first payment was not made is not returned.
4105
4474
  */
4106
4475
  get: {
4107
4476
  parameters: {
@@ -4176,7 +4545,7 @@ export interface paths {
4176
4545
  };
4177
4546
  /**
4178
4547
  * List payment methods
4179
- * @description Dashboard session only: an API key is refused with `401`. Returns the cards saved on the account: the brand, the last four digits, the expiry, and which card is the default payment method. The full card number is never returned. Returns `404 not_found` while the account has no billing account.
4548
+ * @description Dashboard session only: an API key is refused with `401`. Returns the cards saved on the account: the brand, the last four digits, the expiry, and which card is the default payment method. The full card number is never returned. An account that has no billing account gets an empty list.
4180
4549
  */
4181
4550
  get: {
4182
4551
  parameters: {
@@ -4237,7 +4606,7 @@ export interface paths {
4237
4606
  put?: never;
4238
4607
  /**
4239
4608
  * Start adding a payment method
4240
- * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Returns `client_secret`, a client secret for the payment form of Stripe: the form saves a new card on the account. The response is not wrapped in the standard envelope. Returns `404 not_found` while the account has no billing account.
4609
+ * @description Dashboard session only: an API key is refused with `401`. The request must carry the header `X-Requested-With: XMLHttpRequest`, or it is refused with `403 forbidden`. Returns `client_secret`, a client secret for the payment form of Stripe: the form saves a new card on the account. Only a card can be saved. The call creates the billing account of an account that has none. The response is not wrapped in the standard envelope.
4241
4610
  */
4242
4611
  post: {
4243
4612
  parameters: {
@@ -8174,7 +8543,7 @@ export interface components {
8174
8543
  message: string;
8175
8544
  /** @description Kind of problem. On `validation_failed`, for example `invalid_type`, `invalid_value`, `invalid_format`, `invalid_union`, `invalid_key`, `invalid_element`, `too_small`, `too_big`, `not_multiple_of`, `unrecognized_keys` or `custom`. The list is open: read `path` and `message`. */
8176
8545
  code: string;
8177
- /** @description Smallest accepted value. Present only on `limit_out_of_bounds`, `mac_quantity_not_a_pack` and `byop_reduction_strands_mac_sessions`. */
8546
+ /** @description Smallest accepted value. Present only on `limit_out_of_bounds`, `mac_quantity_not_a_pack`, `byop_reduction_strands_mac_sessions` and `byop_reduction_strands_byod_lines`. */
8178
8547
  min?: number;
8179
8548
  /** @description Largest accepted value. Present only on `limit_out_of_bounds` and `mac_sessions_exceed_byop_lines`, and on the `too_big` issue of an `Idempotency-Key` header longer than 255 characters. */
8180
8549
  max?: number;
@@ -8811,12 +9180,12 @@ export interface components {
8811
9180
  preferred_area_codes: string[];
8812
9181
  /** @description `true` for an inbound-only line, `false` for a two-way line. */
8813
9182
  inbound_only: boolean;
8814
- /** @description The billing anchor you set when creating the pre-order, carried onto the line at confirmation. `null` when you set none. */
9183
+ /** @description The billing anchor you set when creating the pre-order, carried onto the line when the line is created. `null` when you set none. */
8815
9184
  billing_anchor_at: string | null;
8816
9185
  status: components["schemas"]["PreOrderStatus"];
8817
- /** @description Client secret for the payment form of Stripe, to collect the first month. Set only in the response of `POST /v1/pre-orders/{id}/confirm`, for an account that is not a wholesale partner. `null` in every other response. */
9186
+ /** @description Client secret for the payment form of Stripe, to collect the first month. Set only in the response of `POST /v1/pre-orders/{id}/confirm`, when that response carries the pre-order in status `awaiting_payment`: the first time and every time confirm is repeated. `null` in every other response. */
8818
9187
  stripe_client_secret: string | null;
8819
- /** @description Estimated time of the hand-over of the line: the time of the confirmation plus 72 hours. Set once at confirmation and never revised. `null` until the pre-order is confirmed. */
9188
+ /** @description Estimated time of the hand-over of the line: the time the build starts plus 72 hours. Set once, when the build starts, and never revised. `null` while the pre-order is `draft` or `awaiting_payment`, and on a pre-order canceled before its build started. */
8820
9189
  estimated_fulfillment: string | null;
8821
9190
  device_status?: components["schemas"]["DeviceFulfillmentStatus"];
8822
9191
  /** @description Timestamp of creation, ISO 8601 in UTC. */
@@ -8834,12 +9203,12 @@ export interface components {
8834
9203
  } | null;
8835
9204
  };
8836
9205
  /**
8837
- * @description `draft`: created, with no effect. `provisioning`: confirmed, and the line is being prepared. `fulfilled`: the line is handed over. `cancelled`: the draft was canceled. A confirmed pre-order never becomes `cancelled`.
9206
+ * @description `draft`: created, with no effect. `awaiting_payment`: confirmed by a direct account, and the first month is due; nothing is built until it is paid. `provisioning`: the build has started, and the line is being prepared. `fulfilled`: the line is handed over. `cancelled`: the pre-order ended with no line. You canceled it, its first month was not paid within 23 hours of the confirmation, or its subscription was canceled before the first payment. A pre-order whose build has started never becomes `cancelled`.
8838
9207
  * @enum {string}
8839
9208
  */
8840
- PreOrderStatus: "draft" | "provisioning" | "fulfilled" | "cancelled";
9209
+ PreOrderStatus: "draft" | "awaiting_payment" | "provisioning" | "fulfilled" | "cancelled";
8841
9210
  /**
8842
- * @description Progress of the line. `awaiting_hardware`: the line is not ready; also the value of a draft and of a canceled draft. `ready`: the line is prepared. `deployed`: the line is handed over. `received` and `setup_in_progress` are declared and never returned. Always present on a pre-order, and never `null`.
9211
+ * @description Progress of the line. `awaiting_hardware`: the line is not ready; also the value of a pre-order that has no line: a draft, a pre-order in `awaiting_payment`, a canceled pre-order. `ready`: the line is prepared. `deployed`: the line is handed over. `received` and `setup_in_progress` are declared and never returned. Always present on a pre-order, and never `null`.
8843
9212
  * @enum {string|null}
8844
9213
  */
8845
9214
  DeviceFulfillmentStatus: "awaiting_hardware" | "received" | "setup_in_progress" | "ready" | "deployed" | null;
@@ -8876,13 +9245,24 @@ export interface components {
8876
9245
  [key: string]: unknown;
8877
9246
  };
8878
9247
  };
8879
- /** @description The payment page of a reserved line. */
8880
- Checkout: {
9248
+ CheckoutEnvelope: {
8881
9249
  /**
8882
- * Format: uri
8883
- * @description URL of the payment page: redirect the customer to it.
9250
+ * @description Always `true` on a success response.
9251
+ * @enum {boolean}
8884
9252
  */
8885
- url: string;
9253
+ success: true;
9254
+ data: components["schemas"]["Checkout"];
9255
+ /** @description Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap. */
9256
+ trace_id: string;
9257
+ /** @description Id of the request that produced this response: `req_` followed by 25 letters or digits. */
9258
+ request_id: string;
9259
+ };
9260
+ /** @description The first payment of a reserved line. */
9261
+ Checkout: {
9262
+ /** @description Id of the subscription. The subscription provides nothing until its first payment succeeds, and ends when that payment has not succeeded 23 hours after its creation. */
9263
+ subscription_id: string;
9264
+ /** @description Client secret of the first payment of the subscription, for the payment form of Stripe: the form takes the payment. `null` when the credit balance of the account has paid the first invoice: there is no payment to make. */
9265
+ client_secret: string | null;
8886
9266
  };
8887
9267
  ByodCheckoutEnvelope: {
8888
9268
  /**
@@ -8896,18 +9276,16 @@ export interface components {
8896
9276
  /** @description Id of the request that produced this response: `req_` followed by 25 letters or digits. */
8897
9277
  request_id: string;
8898
9278
  };
8899
- /** @description The payment page of a purchase of BYOD slots. */
9279
+ /** @description The first payment of a purchase of BYOD slots. */
8900
9280
  ByodCheckoutResponse: {
8901
- /**
8902
- * Format: uri
8903
- * @description URL of the payment page: redirect the customer to it.
8904
- */
8905
- checkout_url: string;
8906
- /**
8907
- * Format: date-time
8908
- * @description Timestamp at which the payment page expires.
8909
- */
8910
- expires_at: string;
9281
+ /** @description Id of the subscription. The subscription provides nothing until its first payment succeeds, and ends when that payment has not succeeded 23 hours after its creation. */
9282
+ subscription_id: string;
9283
+ /** @description Client secret of the first payment of the subscription, for the payment form of Stripe: the form takes the payment. `null` when the credit balance of the account has paid the first invoice: there is no payment to make. */
9284
+ client_secret: string | null;
9285
+ /** @description Number of BYOD slots ordered. */
9286
+ quantity: number;
9287
+ /** @description Recurring total per billing period, in cents. `null` when it cannot be computed. It excludes tax, proration and discounts. */
9288
+ estimated_total_cents: number | null;
8911
9289
  };
8912
9290
  /** @description A purchase of BYOD slots. */
8913
9291
  ByodCheckoutBody: {
@@ -8935,18 +9313,12 @@ export interface components {
8935
9313
  /** @description Id of the request that produced this response: `req_` followed by 25 letters or digits. */
8936
9314
  request_id: string;
8937
9315
  };
8938
- /** @description The payment page of a purchase of hosted macOS sessions. */
9316
+ /** @description The first payment of a purchase of hosted macOS sessions. */
8939
9317
  MacCheckoutResponse: {
8940
- /**
8941
- * Format: uri
8942
- * @description URL of the payment page: redirect the customer to it.
8943
- */
8944
- checkout_url: string;
8945
- /**
8946
- * Format: date-time
8947
- * @description Timestamp at which the payment page expires.
8948
- */
8949
- expires_at: string;
9318
+ /** @description Id of the subscription. The subscription provides nothing until its first payment succeeds, and ends when that payment has not succeeded 23 hours after its creation. */
9319
+ subscription_id: string;
9320
+ /** @description Client secret of the first payment of the subscription, for the payment form of Stripe: the form takes the payment. `null` when the credit balance of the account has paid the first invoice: there is no payment to make. */
9321
+ client_secret: string | null;
8950
9322
  /** @description Number of hosted macOS sessions ordered. */
8951
9323
  quantity: number;
8952
9324
  /** @description Size of a pack: a quantity is a multiple of it, and at least equal to it. */
@@ -8968,6 +9340,90 @@ export interface components {
8968
9340
  */
8969
9341
  billing_cycle: "monthly" | "quarterly" | "annual";
8970
9342
  };
9343
+ MacQuoteEnvelope: {
9344
+ /**
9345
+ * @description Always `true` on a success response.
9346
+ * @enum {boolean}
9347
+ */
9348
+ success: true;
9349
+ data: components["schemas"]["MacQuote"];
9350
+ /** @description Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap. */
9351
+ trace_id: string;
9352
+ /** @description Id of the request that produced this response: `req_` followed by 25 letters or digits. */
9353
+ request_id: string;
9354
+ };
9355
+ /** @description The price of a number of hosted macOS sessions. */
9356
+ MacQuote: {
9357
+ /** @description Number of hosted macOS sessions priced. */
9358
+ quantity: number;
9359
+ /** @description Size of a pack: a quantity is a multiple of it, and at least equal to it. */
9360
+ pack_size: number;
9361
+ /** @description Three-letter currency code of every amount, in lowercase. */
9362
+ currency: string;
9363
+ /** @description The tiers of the price, from the first session up. Each tier prices only the sessions that fall inside it. */
9364
+ tiers: components["schemas"]["MacQuoteTier"][];
9365
+ /** @description Recurring total per billing period, in cents. It excludes tax, proration and discounts. */
9366
+ estimated_total_cents: number;
9367
+ };
9368
+ /** @description A tier of the price of hosted macOS sessions. */
9369
+ MacQuoteTier: {
9370
+ /** @description Highest number of sessions that the tier covers, counted from the first session. `null` for the last tier, which has no upper bound. */
9371
+ up_to: number | null;
9372
+ /** @description Price of one session inside the tier, per billing period, in cents. */
9373
+ unit_amount_cents: number;
9374
+ /** @description Amount added once per billing period when the quantity reaches the tier, in cents. */
9375
+ flat_amount_cents: number;
9376
+ };
9377
+ BillingConfigEnvelope: {
9378
+ /**
9379
+ * @description Always `true` on a success response.
9380
+ * @enum {boolean}
9381
+ */
9382
+ success: true;
9383
+ data: components["schemas"]["BillingConfig"];
9384
+ /** @description Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap. */
9385
+ trace_id: string;
9386
+ /** @description Id of the request that produced this response: `req_` followed by 25 letters or digits. */
9387
+ request_id: string;
9388
+ };
9389
+ /** @description What the payment form needs, and the type of the account. */
9390
+ BillingConfig: {
9391
+ /** @description Stripe publishable key that the payment form of Stripe is loaded with. It starts with `pk_test_` in test mode and with `pk_live_` in live mode. `null` only for a wholesale partner, when iSnap has no publishable key to return. */
9392
+ publishable_key: string | null;
9393
+ /** @description `true` for a wholesale partner. A wholesale partner is billed on the monthly wholesale invoice: it has no card payment to make, and the operations that start a payment return `403 wholesale_partner_no_checkout` to it. */
9394
+ wholesale: boolean;
9395
+ };
9396
+ BillingCoverageEnvelope: {
9397
+ /**
9398
+ * @description Always `true` on a success response.
9399
+ * @enum {boolean}
9400
+ */
9401
+ success: true;
9402
+ data: components["schemas"]["BillingCoverage"];
9403
+ /** @description Trace id of the request that produced this response: 32 lowercase hexadecimal characters. Quote it when you report a problem to iSnap. */
9404
+ trace_id: string;
9405
+ /** @description Id of the request that produced this response: `req_` followed by 25 letters or digits. */
9406
+ request_id: string;
9407
+ };
9408
+ /** @description What the account has paid for, and what it uses. */
9409
+ BillingCoverage: {
9410
+ /** @description BYOD slots. `POST /v1/byod/pair` needs `paid` to be greater than `in_use`. */
9411
+ byod_slots: {
9412
+ /** @description Number of BYOD slots that the subscriptions of the account provide. A subscription counts once iSnap has recorded its first payment. */
9413
+ paid: number;
9414
+ /** @description Number of BYOD lines of the account that are not `cancelled`. A `suspended` line counts. */
9415
+ in_use: number;
9416
+ };
9417
+ /** @description Hosted macOS sessions. */
9418
+ mac_sessions: {
9419
+ /** @description Number of hosted macOS sessions that the subscriptions of the account provide. A subscription counts once iSnap has recorded its first payment. */
9420
+ paid: number;
9421
+ /** @description Number of hosted macOS sessions assigned to the account, delivered or not. */
9422
+ in_use: number;
9423
+ /** @description Number of hosted macOS sessions of subscriptions whose first payment has not succeeded. They count with `paid` in the comparison with the BYOD lines of the account, for 24 hours at most. */
9424
+ held: number;
9425
+ };
9426
+ };
8971
9427
  SubscriptionQuantityEnvelope: {
8972
9428
  /**
8973
9429
  * @description Always `true` on a success response.
@@ -9014,7 +9470,7 @@ export interface components {
9014
9470
  Subscription: {
9015
9471
  /** @description Id of the subscription. */
9016
9472
  id: string;
9017
- /** @description Status of the subscription, for example `active`. */
9473
+ /** @description Status of the subscription, for example `active`. It is `incomplete` while the first payment has not succeeded. */
9018
9474
  status: string;
9019
9475
  /** @description Start of the current billing period, in Unix seconds. */
9020
9476
  current_period_start: number;
@@ -9022,14 +9478,26 @@ export interface components {
9022
9478
  current_period_end: number;
9023
9479
  /** @description `true` when the end of this subscription is scheduled for the end of the current billing period. */
9024
9480
  cancel_at_period_end: boolean;
9025
- /** @description Id of the line that the subscription pays for. It is a UUID, not the `line_` id of the line. `null` on a subscription to BYOD slots or to hosted macOS sessions. It can also be `null` on the subscription of a line: match `id` with the `stripe_subscription_id` of the line instead. */
9481
+ /** @description Id of the line that the subscription pays for, in the `line_` form that the line operations take. `null` on a subscription to BYOD slots or to hosted macOS sessions, and when the line no longer exists or no longer belongs to the account. */
9026
9482
  line_id: string | null;
9027
9483
  /** @description Id of the price. `null` when the subscription has no item. */
9028
9484
  price_id: string | null;
9029
- /** @description Unit amount of the first item of the subscription, in cents. `null` when the price has no unit amount. */
9485
+ /** @description Unit amount of the first item of the subscription, in cents. `null` when the price has no unit amount: the price of hosted macOS sessions is tiered and has none, and `GET /v1/billing/mac-quote` returns its total for a quantity. */
9030
9486
  amount: number | null;
9031
9487
  /** @description Three-letter currency code, in lowercase. `null` when the subscription has no item. */
9032
9488
  currency: string | null;
9489
+ /**
9490
+ * @description What the subscription sells: `outbound`, `inbound` or `shared` for a line, `byop` for BYOD slots, `mac` for hosted macOS sessions. `null` when the subscription has several items, or an item that is none of these.
9491
+ * @enum {string|null}
9492
+ */
9493
+ product: "outbound" | "inbound" | "shared" | "byop" | "mac" | null;
9494
+ /** @description Quantity of the item of the subscription: the number of BYOD slots for `byop`, the number of hosted macOS sessions for `mac`, and `1` for a line. `null` when the subscription has several items. */
9495
+ quantity: number | null;
9496
+ /**
9497
+ * @description Billing period of the subscription: `monthly`, `quarterly` or `annual`. `null` when `product` is `null`.
9498
+ * @enum {string|null}
9499
+ */
9500
+ billing_cycle: "monthly" | "quarterly" | "annual" | null;
9033
9501
  /** @description Time of creation, in Unix seconds. */
9034
9502
  created_at: number;
9035
9503
  };
@@ -28,14 +28,34 @@ export declare class PreOrdersResource extends BaseResource {
28
28
  create(body: CreatePreOrderBody, opts?: RequestOptions): Promise<PreOrder>;
29
29
  /**
30
30
  * `POST /v1/pre-orders/{id}/confirm` — confirm a `draft` pre-order. The
31
- * binding step: engages the one-month commitment (full month, no proration)
32
- * and triggers procurement (mints the provisioning line + fulfillment task,
33
- * notifies ops). Returns the pre-order in `provisioning`; ops procures the
34
- * hardware and the partner is notified via the `pre_order.fulfilled` webhook
35
- * when a matching line is ready. Direct customers get a Stripe
36
- * `stripe_client_secret` to confirm the first-month charge; wholesale
37
- * partners are billed EOM (no per-line Stripe sub). Only a draft can be
38
- * confirmed.
31
+ * binding step: engages the one-month commitment (full month, no proration).
32
+ *
33
+ * A wholesale partner (billed at the end of the month) gets the pre-order
34
+ * back in `provisioning`: the line is being built, and the
35
+ * `pre_order.fulfilled` webhook fires when it is live.
36
+ *
37
+ * A direct account gets it back in `awaiting_payment` with
38
+ * `stripe_client_secret`, the client secret of the first-month payment, to
39
+ * confirm with the Stripe Payment Element (card only). Nothing is built until
40
+ * that payment succeeds; the pre-order then moves to `provisioning`: read it
41
+ * with `get()` until it leaves `awaiting_payment`. Calling `confirm()` again
42
+ * while it is `awaiting_payment` returns the same secret. When the first
43
+ * month is already paid (the account's credit balance covers it, or
44
+ * `confirm()` is repeated after the payment), the pre-order comes back in
45
+ * `provisioning` with `stripe_client_secret: null`.
46
+ *
47
+ * The first month starts at the confirmation, not when the line is handed
48
+ * over, and the next invoice is issued one month after the confirmation. The
49
+ * hand-over of the line takes no payment and does not change when the
50
+ * subscription is invoiced.
51
+ *
52
+ * An unpaid first month cancels the pre-order 23 hours after the
53
+ * confirmation; `confirm()` on it then throws a `BadRequestError` (400
54
+ * `pre_order_not_draft`), like any confirm of a pre-order that is not a
55
+ * draft. A 503 `payment_provider_unavailable` means nothing changed and the
56
+ * call can be repeated (the SDK retries it). A `ConflictError` with 409
57
+ * `payment_setup_failed` means the payment provider refused the request for
58
+ * the account: it is not retried, and repeating it does not help.
39
59
  */
40
60
  confirm(id: string, opts?: RequestOptions): Promise<PreOrder>;
41
61
  /**
@@ -51,7 +71,12 @@ export declare class PreOrdersResource extends BaseResource {
51
71
  * `has_more` is false.
52
72
  */
53
73
  list(query?: ListPreOrdersQuery, opts?: RequestOptions): Promise<PreOrderListData>;
54
- /** `GET /v1/pre-orders/{id}` — fetch a single pre-order by id. */
74
+ /**
75
+ * `GET /v1/pre-orders/{id}` — fetch a single pre-order by id. Reading a
76
+ * pre-order that is `awaiting_payment` checks its first-month payment: once
77
+ * it has succeeded, the pre-order comes back in `provisioning`.
78
+ * `stripe_client_secret` is always `null` here.
79
+ */
55
80
  get(id: string, opts?: RequestOptions): Promise<PreOrder>;
56
81
  /**
57
82
  * `PATCH /v1/pre-orders/{id}` — merge `metadata` into the pre-order's tags.
@@ -64,9 +89,13 @@ export declare class PreOrdersResource extends BaseResource {
64
89
  */
65
90
  update(id: string, body: PatchPreOrderBody, opts?: RequestOptions): Promise<PreOrder>;
66
91
  /**
67
- * `POST /v1/pre-orders/{id}/cancel` — cancel a pre-order before it is
68
- * fulfilled. Refunds the Stripe payment intent (if charged) and releases the
69
- * procurement task. No-op on an already-cancelled / fulfilled pre-order.
92
+ * `POST /v1/pre-orders/{id}/cancel` — cancel a `draft` or `awaiting_payment`
93
+ * pre-order. Free: nothing is charged or built in either status. For an
94
+ * `awaiting_payment` pre-order the first-month payment is voided first, so
95
+ * its client secret can no longer charge; a first month already paid throws
96
+ * a `ConflictError` (409 `pre_order_already_paid`). A pre-order that is
97
+ * `provisioning`, `fulfilled` or already `cancelled` is refused (400
98
+ * `pre_order_already_confirmed`).
70
99
  */
71
100
  cancel(id: string, opts?: RequestOptions): Promise<PreOrder>;
72
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"preorders.d.ts","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAA;AACxD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAA;AAIpE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAC1C,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAC/C,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAChC,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AACnG,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAA;AAEtE,qBAAa,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI1E;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAS7D;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,KAAK,GAAE,kBAAuB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAOtF,kEAAkE;IAClE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IASzD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IASrF;;;;OAIG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;CAQ7D"}
1
+ {"version":3,"file":"preorders.d.ts","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAA;AACxD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAA;AAIpE,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5E,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAC1C,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAC/C,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAA;AAChC,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AACnG,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAA;AAEtE,qBAAa,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IAS7D;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,KAAK,GAAE,kBAAuB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAOtF;;;;;OAKG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IASzD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;IASrF;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC;CAQ7D"}
@@ -22,14 +22,34 @@ export class PreOrdersResource extends BaseResource {
22
22
  }
23
23
  /**
24
24
  * `POST /v1/pre-orders/{id}/confirm` — confirm a `draft` pre-order. The
25
- * binding step: engages the one-month commitment (full month, no proration)
26
- * and triggers procurement (mints the provisioning line + fulfillment task,
27
- * notifies ops). Returns the pre-order in `provisioning`; ops procures the
28
- * hardware and the partner is notified via the `pre_order.fulfilled` webhook
29
- * when a matching line is ready. Direct customers get a Stripe
30
- * `stripe_client_secret` to confirm the first-month charge; wholesale
31
- * partners are billed EOM (no per-line Stripe sub). Only a draft can be
32
- * confirmed.
25
+ * binding step: engages the one-month commitment (full month, no proration).
26
+ *
27
+ * A wholesale partner (billed at the end of the month) gets the pre-order
28
+ * back in `provisioning`: the line is being built, and the
29
+ * `pre_order.fulfilled` webhook fires when it is live.
30
+ *
31
+ * A direct account gets it back in `awaiting_payment` with
32
+ * `stripe_client_secret`, the client secret of the first-month payment, to
33
+ * confirm with the Stripe Payment Element (card only). Nothing is built until
34
+ * that payment succeeds; the pre-order then moves to `provisioning`: read it
35
+ * with `get()` until it leaves `awaiting_payment`. Calling `confirm()` again
36
+ * while it is `awaiting_payment` returns the same secret. When the first
37
+ * month is already paid (the account's credit balance covers it, or
38
+ * `confirm()` is repeated after the payment), the pre-order comes back in
39
+ * `provisioning` with `stripe_client_secret: null`.
40
+ *
41
+ * The first month starts at the confirmation, not when the line is handed
42
+ * over, and the next invoice is issued one month after the confirmation. The
43
+ * hand-over of the line takes no payment and does not change when the
44
+ * subscription is invoiced.
45
+ *
46
+ * An unpaid first month cancels the pre-order 23 hours after the
47
+ * confirmation; `confirm()` on it then throws a `BadRequestError` (400
48
+ * `pre_order_not_draft`), like any confirm of a pre-order that is not a
49
+ * draft. A 503 `payment_provider_unavailable` means nothing changed and the
50
+ * call can be repeated (the SDK retries it). A `ConflictError` with 409
51
+ * `payment_setup_failed` means the payment provider refused the request for
52
+ * the account: it is not retried, and repeating it does not help.
33
53
  */
34
54
  confirm(id, opts) {
35
55
  return this.client.request('POST', `/v1/pre-orders/${encodeURIComponent(id)}/confirm`, undefined, opts);
@@ -52,7 +72,12 @@ export class PreOrdersResource extends BaseResource {
52
72
  query: { ...opts?.query, ...query }
53
73
  });
54
74
  }
55
- /** `GET /v1/pre-orders/{id}` — fetch a single pre-order by id. */
75
+ /**
76
+ * `GET /v1/pre-orders/{id}` — fetch a single pre-order by id. Reading a
77
+ * pre-order that is `awaiting_payment` checks its first-month payment: once
78
+ * it has succeeded, the pre-order comes back in `provisioning`.
79
+ * `stripe_client_secret` is always `null` here.
80
+ */
56
81
  get(id, opts) {
57
82
  return this.client.request('GET', `/v1/pre-orders/${encodeURIComponent(id)}`, undefined, opts);
58
83
  }
@@ -69,9 +94,13 @@ export class PreOrdersResource extends BaseResource {
69
94
  return this.client.request('PATCH', `/v1/pre-orders/${encodeURIComponent(id)}`, body, opts);
70
95
  }
71
96
  /**
72
- * `POST /v1/pre-orders/{id}/cancel` — cancel a pre-order before it is
73
- * fulfilled. Refunds the Stripe payment intent (if charged) and releases the
74
- * procurement task. No-op on an already-cancelled / fulfilled pre-order.
97
+ * `POST /v1/pre-orders/{id}/cancel` — cancel a `draft` or `awaiting_payment`
98
+ * pre-order. Free: nothing is charged or built in either status. For an
99
+ * `awaiting_payment` pre-order the first-month payment is voided first, so
100
+ * its client secret can no longer charge; a first month already paid throws
101
+ * a `ConflictError` (409 `pre_order_already_paid`). A pre-order that is
102
+ * `provisioning`, `fulfilled` or already `cancelled` is refused (400
103
+ * `pre_order_already_confirmed`).
75
104
  */
76
105
  cancel(id, opts) {
77
106
  return this.client.request('POST', `/v1/pre-orders/${encodeURIComponent(id)}/cancel`, undefined, opts);
@@ -1 +1 @@
1
- {"version":3,"file":"preorders.js","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAexC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAwB,EAAE,IAAqB;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAW,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAC5E,CAAC;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAU,EAAE,IAAqB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAClD,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,QAA4B,EAAE,EAAE,IAAqB;QACxD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAmB,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE;YAC/E,GAAG,IAAI;YACP,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE;SACpC,CAAC,CAAA;IACJ,CAAC;IAED,kEAAkE;IAClE,GAAG,CAAC,EAAU,EAAE,IAAqB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAC1C,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAU,EAAE,IAAuB,EAAE,IAAqB;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,OAAO,EACP,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAC1C,IAAI,EACJ,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,EAAU,EAAE,IAAqB;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EACjD,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"preorders.js","sourceRoot":"","sources":["../../src/resources/preorders.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAexC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,CAAC,IAAwB,EAAE,IAAqB;QACpD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAW,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IAC5E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,OAAO,CAAC,EAAU,EAAE,IAAqB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAClD,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,QAA4B,EAAE,EAAE,IAAqB;QACxD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAmB,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE;YAC/E,GAAG,IAAI;YACP,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE;SACpC,CAAC,CAAA;IACJ,CAAC;IAED;;;;;OAKG;IACH,GAAG,CAAC,EAAU,EAAE,IAAqB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,KAAK,EACL,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAC1C,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAU,EAAE,IAAuB,EAAE,IAAqB;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,OAAO,EACP,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAC1C,IAAI,EACJ,IAAI,CACL,CAAA;IACH,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAU,EAAE,IAAqB;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CACxB,MAAM,EACN,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EACjD,SAAS,EACT,IAAI,CACL,CAAA;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isnap/sdk",
3
- "version": "2.2.0-next.226",
3
+ "version": "2.2.0-next.228",
4
4
  "description": "Official TypeScript SDK for the iSnap P2P telephony API",
5
5
  "license": "MIT",
6
6
  "type": "module",