@outseta/react 0.5.11 → 0.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outseta/react",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "description": "React hooks and components for the Outseta API",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -18,7 +18,7 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@outseta/api-client": "0.4.11"
21
+ "@outseta/api-client": "0.4.12"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": "^18.0.0 || ^19.0.0"
@@ -2268,6 +2268,11 @@ export const useSubscriptionSetSubscriptionUpgradeRequired = <TError = void,
2268
2268
  were to register with this subscription. BillingRenewalTerm values: 1 = Monthly,
2269
2269
  2 = Yearly, 3 = Quarterly, 4 = OneTime. Pass asOf=renewal to see the renewal invoice
2270
2270
  instead of the initial invoice.
2271
+
2272
+ To redeem a coupon, send its code in DiscountCouponSubscriptions:
2273
+ "DiscountCouponSubscriptions": [{ "DiscountCoupon": { "UniqueIdentifier": "CODE" } }].
2274
+ DiscountCoupon.UniqueIdentifier is the coupon's code, not its Uid. The invoice then shows the
2275
+ discount. Subscription.DiscountCode is read-only and ignored here.
2271
2276
  * @summary Preview the initial or renewal invoice for a hypothetical subscription.
2272
2277
  */
2273
2278
  export const subscriptionFirstTimeSubscriptionPreview = (
@@ -2353,6 +2358,14 @@ Outseta sets the subscription's dates itself, except ExpirationDate:
2353
2358
 
2354
2359
  To set or remove the end date of a subscription that already exists, use
2355
2360
  PUT /api/v1/crm/accounts/{accountUid}/extend-renewal.
2361
+
2362
+ To redeem a coupon, send its code in DiscountCouponSubscriptions:
2363
+ "DiscountCouponSubscriptions": [{ "DiscountCoupon": { "UniqueIdentifier": "CODE" } }].
2364
+ DiscountCoupon.UniqueIdentifier is the coupon's code, not its Uid. An unknown code, or a
2365
+ DiscountCoupon sent with only a Uid, is rejected with "No discount coupon found for code [...]". The
2366
+ coupon must be active, within its redeem-by date and maximum redemptions, apply to the plan, and not
2367
+ have been redeemed by the account before. Subscription.DiscountCode is read-only: it is ignored on
2368
+ writes, so a coupon sent there is not applied.
2356
2369
  * @summary Add a subscription to an account for the first time.
2357
2370
  */
2358
2371
  export const subscriptionFirstTimeSubscription = (
@@ -2418,6 +2431,15 @@ export const useSubscriptionFirstTimeSubscription = <TError = void,
2418
2431
  /**
2419
2432
  * Returns an invoice object with information about the amount outstanding. This method
2420
2433
  does not commit the subscription change.
2434
+
2435
+ Takes the same body as PUT /api/v1/billing/subscriptions/{subscriptionUid}/changesubscription. A coupon
2436
+ sent in DiscountCouponSubscriptions[].DiscountCoupon.UniqueIdentifier (the coupon's code, not its Uid)
2437
+ shows on the invoice as a discount, together with the credit for the unused part of the current plan,
2438
+ capped as described there. Subscription.DiscountCode is read-only and ignored here. Like
2439
+ changesubscription, the preview rejects a coupon that is inactive, past its redeem-by date or maximum
2440
+ redemptions, or doesn't apply to the new plan. It doesn't reject a coupon the account has redeemed
2441
+ before (a one-time coupon the account was already invoiced for is left off the invoice), while
2442
+ changesubscription rejects it when the plan changes.
2421
2443
  * @summary Preview the invoice for a subscription change.
2422
2444
  */
2423
2445
  export const subscriptionChangeSubscriptionPreview = (
@@ -2504,6 +2526,21 @@ ExpirationDate or ExpiresAfterMonths applies.
2504
2526
  A request with the same plan, BillingRenewalTerm and quantity only changes add-ons; it does not change
2505
2527
  the subscription's dates. To set or remove the end date of the current subscription, use
2506
2528
  PUT /api/v1/crm/accounts/{accountUid}/extend-renewal.
2529
+
2530
+ To redeem a coupon, send its code in DiscountCouponSubscriptions:
2531
+ "DiscountCouponSubscriptions": [{ "DiscountCoupon": { "UniqueIdentifier": "CODE" } }].
2532
+ DiscountCoupon.UniqueIdentifier is the coupon's code, not its Uid. A DiscountCoupon sent with
2533
+ only a Uid is rejected with "Each DiscountCouponSubscription requires DiscountCoupon.UniqueIdentifier.",
2534
+ an unknown code with "No discount coupon found for code [CODE]". Subscription.DiscountCode is read-only:
2535
+ it is ignored on writes, so a coupon sent there is not applied and the new plan is billed in full.
2536
+ The coupon must be active, within its redeem-by date and maximum redemptions, and apply to the new
2537
+ plan; when the plan changes, the account must not have redeemed it before ("This discount code has
2538
+ already been redeemed.").
2539
+
2540
+ When the new plan is billed right away, the invoice credits the unused part of the current plan. That
2541
+ credit is capped at the amount due on the invoice after the discount; the rest is not carried over.
2542
+ Send the same body to PUT /api/v1/billing/subscriptions/{subscriptionUid}/changesubscriptionpreview to
2543
+ see the invoice first.
2507
2544
  * @summary Change a subscription on an account.
2508
2545
  */
2509
2546
  export const subscriptionChangeSubscription = (
@@ -2292,7 +2292,7 @@ export type SubscriptionAllOf = {
2292
2292
  /** @nullable */
2293
2293
  DiscountCouponSubscriptions?: DiscountCouponSubscription[] | null;
2294
2294
  /** @nullable */
2295
- DiscountCode?: string | null;
2295
+ readonly DiscountCode?: string | null;
2296
2296
  /** @nullable */
2297
2297
  DiscountCouponExpirationDate?: string | null;
2298
2298
  /** @nullable */
@@ -5345,6 +5345,7 @@ export interface SetupIntent {
5345
5345
  FirstName?: string | null;
5346
5346
  /** @nullable */
5347
5347
  InvoiceUid?: string | null;
5348
+ IsNewPaymentMethod?: boolean;
5348
5349
  IsSetupIntent?: boolean;
5349
5350
  IsPaymentAuthentication?: boolean;
5350
5351
  /** @nullable */