perspectapi-ts-sdk 2.2.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -537,7 +537,29 @@ const session = await client.checkout.createCheckoutSession({
537
537
  priceId: 'price_1234567890',
538
538
  successUrl: 'https://myapp.com/success',
539
539
  cancelUrl: 'https://myapp.com/cancel',
540
- customerEmail: 'customer@example.com'
540
+ customerEmail: 'customer@example.com',
541
+ currency: 'usd',
542
+ shipping_amount: 500,
543
+ shipping_address: {
544
+ country: 'US',
545
+ state: 'CA',
546
+ postal_code: '94110'
547
+ },
548
+ billing_address: {
549
+ country: 'US',
550
+ state: 'CA',
551
+ postal_code: '94110'
552
+ },
553
+ tax: {
554
+ strategy: 'manual_rates',
555
+ customer_identifier: 'acct-123',
556
+ customer_display_name: 'Acme Corp',
557
+ customer_exemption: {
558
+ status: 'exempt',
559
+ tax_id: '99-1234567',
560
+ tax_id_type: 'ein'
561
+ }
562
+ }
541
563
  });
542
564
 
543
565
  // Redirect user to checkout
@@ -545,6 +567,7 @@ window.location.href = session.data.url;
545
567
 
546
568
  // Get checkout session status
547
569
  const sessionStatus = await client.checkout.getCheckoutSession('cs_test_123');
570
+ console.log(sessionStatus.data.tax?.amount); // Display assessed tax (if calculated)
548
571
  ```
549
572
 
550
573
  ### Contact Forms
package/dist/index.d.mts CHANGED
@@ -426,6 +426,14 @@ type CheckoutMetadataValue = string | number | boolean | null | CheckoutMetadata
426
426
  type CheckoutMetadata = Record<string, CheckoutMetadataValue>;
427
427
  type CheckoutTaxStrategy = 'disabled' | 'gateway_auto' | 'manual_rates' | 'external_service';
428
428
  type CheckoutTaxExemptionStatus = 'none' | 'exempt' | 'reverse_charge';
429
+ interface CheckoutAddress {
430
+ line1?: string;
431
+ line2?: string;
432
+ city?: string;
433
+ state?: string;
434
+ postal_code?: string;
435
+ country?: string;
436
+ }
429
437
  interface CheckoutTaxCustomerExemptionRequest {
430
438
  status?: CheckoutTaxExemptionStatus;
431
439
  reason?: string;
@@ -474,6 +482,7 @@ interface CreateCheckoutSessionRequest {
474
482
  cancelUrl?: string;
475
483
  customer_email?: string;
476
484
  customerEmail?: string;
485
+ currency?: string;
477
486
  metadata?: CheckoutMetadata;
478
487
  mode?: 'payment' | 'subscription' | 'setup';
479
488
  automatic_tax?: {
@@ -483,12 +492,35 @@ interface CreateCheckoutSessionRequest {
483
492
  allowed_countries: string[];
484
493
  };
485
494
  billing_address_collection?: 'auto' | 'required';
495
+ shipping_amount?: number;
496
+ shippingAmount?: number;
497
+ shipping_address?: CheckoutAddress;
498
+ shippingAddress?: CheckoutAddress;
499
+ billing_address?: CheckoutAddress;
500
+ billingAddress?: CheckoutAddress;
486
501
  tax?: CheckoutTaxRequest;
487
502
  }
503
+ interface CheckoutTaxBreakdownItem {
504
+ jurisdiction: string;
505
+ rate_percent: number;
506
+ tax_amount: number;
507
+ taxable_amount: number;
508
+ source: 'manual_map' | 'manual_percent' | 'gateway' | 'external';
509
+ }
510
+ interface CheckoutSessionTax {
511
+ amount: number;
512
+ currency: string;
513
+ strategy: CheckoutTaxStrategy;
514
+ exemption_applied: boolean;
515
+ exemption_status: CheckoutTaxExemptionStatus;
516
+ breakdown?: CheckoutTaxBreakdownItem[] | null;
517
+ }
488
518
  interface CheckoutSession {
489
519
  id: string;
490
520
  url: string;
491
521
  status: string;
522
+ payment_status?: string;
523
+ tax?: CheckoutSessionTax | null;
492
524
  }
493
525
  interface ContactSubmission {
494
526
  id: string;
@@ -2347,6 +2379,22 @@ interface CheckoutSessionOptions {
2347
2379
  logger?: LoaderLogger;
2348
2380
  fallbackProducts?: Product[];
2349
2381
  metadata?: CheckoutMetadata;
2382
+ /**
2383
+ * Optional currency override; defaults to the currency defined on each Stripe price.
2384
+ */
2385
+ currency?: string;
2386
+ /**
2387
+ * Optional shipping amount (in the smallest currency unit).
2388
+ */
2389
+ shippingAmount?: number;
2390
+ /**
2391
+ * Shipping address forwarded to the checkout API for tax estimation.
2392
+ */
2393
+ shippingAddress?: CheckoutAddress;
2394
+ /**
2395
+ * Billing address forwarded to the checkout API for tax estimation.
2396
+ */
2397
+ billingAddress?: CheckoutAddress;
2350
2398
  /**
2351
2399
  * Optional resolver to convert a product record into a Stripe price ID.
2352
2400
  */
@@ -2364,4 +2412,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
2364
2412
  error: string;
2365
2413
  }>;
2366
2414
 
2367
- export { type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, type AuthResponse, BaseClient, type BlogPost, type CacheConfig, CacheManager, CategoriesClient, type Category, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateSiteRequest, type CreateWebhookRequest, DEFAULT_IMAGE_SIZES, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, NewsletterClient, type NewsletterConfirmResponse, type NewsletterList, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, type Product, type ProductQueryParams, ProductsClient, type RequestOptions, type ResponsiveImageSizes, type SignInRequest, type SignUpRequest, type Site, SitesClient, type UpdateApiKeyRequest, type UpdateContentRequest, type User, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
2415
+ export { type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, type AuthResponse, BaseClient, type BlogPost, type CacheConfig, CacheManager, CategoriesClient, type Category, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateSiteRequest, type CreateWebhookRequest, DEFAULT_IMAGE_SIZES, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, NewsletterClient, type NewsletterConfirmResponse, type NewsletterList, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, type Product, type ProductQueryParams, ProductsClient, type RequestOptions, type ResponsiveImageSizes, type SignInRequest, type SignUpRequest, type Site, SitesClient, type UpdateApiKeyRequest, type UpdateContentRequest, type User, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
package/dist/index.d.ts CHANGED
@@ -426,6 +426,14 @@ type CheckoutMetadataValue = string | number | boolean | null | CheckoutMetadata
426
426
  type CheckoutMetadata = Record<string, CheckoutMetadataValue>;
427
427
  type CheckoutTaxStrategy = 'disabled' | 'gateway_auto' | 'manual_rates' | 'external_service';
428
428
  type CheckoutTaxExemptionStatus = 'none' | 'exempt' | 'reverse_charge';
429
+ interface CheckoutAddress {
430
+ line1?: string;
431
+ line2?: string;
432
+ city?: string;
433
+ state?: string;
434
+ postal_code?: string;
435
+ country?: string;
436
+ }
429
437
  interface CheckoutTaxCustomerExemptionRequest {
430
438
  status?: CheckoutTaxExemptionStatus;
431
439
  reason?: string;
@@ -474,6 +482,7 @@ interface CreateCheckoutSessionRequest {
474
482
  cancelUrl?: string;
475
483
  customer_email?: string;
476
484
  customerEmail?: string;
485
+ currency?: string;
477
486
  metadata?: CheckoutMetadata;
478
487
  mode?: 'payment' | 'subscription' | 'setup';
479
488
  automatic_tax?: {
@@ -483,12 +492,35 @@ interface CreateCheckoutSessionRequest {
483
492
  allowed_countries: string[];
484
493
  };
485
494
  billing_address_collection?: 'auto' | 'required';
495
+ shipping_amount?: number;
496
+ shippingAmount?: number;
497
+ shipping_address?: CheckoutAddress;
498
+ shippingAddress?: CheckoutAddress;
499
+ billing_address?: CheckoutAddress;
500
+ billingAddress?: CheckoutAddress;
486
501
  tax?: CheckoutTaxRequest;
487
502
  }
503
+ interface CheckoutTaxBreakdownItem {
504
+ jurisdiction: string;
505
+ rate_percent: number;
506
+ tax_amount: number;
507
+ taxable_amount: number;
508
+ source: 'manual_map' | 'manual_percent' | 'gateway' | 'external';
509
+ }
510
+ interface CheckoutSessionTax {
511
+ amount: number;
512
+ currency: string;
513
+ strategy: CheckoutTaxStrategy;
514
+ exemption_applied: boolean;
515
+ exemption_status: CheckoutTaxExemptionStatus;
516
+ breakdown?: CheckoutTaxBreakdownItem[] | null;
517
+ }
488
518
  interface CheckoutSession {
489
519
  id: string;
490
520
  url: string;
491
521
  status: string;
522
+ payment_status?: string;
523
+ tax?: CheckoutSessionTax | null;
492
524
  }
493
525
  interface ContactSubmission {
494
526
  id: string;
@@ -2347,6 +2379,22 @@ interface CheckoutSessionOptions {
2347
2379
  logger?: LoaderLogger;
2348
2380
  fallbackProducts?: Product[];
2349
2381
  metadata?: CheckoutMetadata;
2382
+ /**
2383
+ * Optional currency override; defaults to the currency defined on each Stripe price.
2384
+ */
2385
+ currency?: string;
2386
+ /**
2387
+ * Optional shipping amount (in the smallest currency unit).
2388
+ */
2389
+ shippingAmount?: number;
2390
+ /**
2391
+ * Shipping address forwarded to the checkout API for tax estimation.
2392
+ */
2393
+ shippingAddress?: CheckoutAddress;
2394
+ /**
2395
+ * Billing address forwarded to the checkout API for tax estimation.
2396
+ */
2397
+ billingAddress?: CheckoutAddress;
2350
2398
  /**
2351
2399
  * Optional resolver to convert a product record into a Stripe price ID.
2352
2400
  */
@@ -2364,4 +2412,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
2364
2412
  error: string;
2365
2413
  }>;
2366
2414
 
2367
- export { type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, type AuthResponse, BaseClient, type BlogPost, type CacheConfig, CacheManager, CategoriesClient, type Category, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateSiteRequest, type CreateWebhookRequest, DEFAULT_IMAGE_SIZES, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, NewsletterClient, type NewsletterConfirmResponse, type NewsletterList, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, type Product, type ProductQueryParams, ProductsClient, type RequestOptions, type ResponsiveImageSizes, type SignInRequest, type SignUpRequest, type Site, SitesClient, type UpdateApiKeyRequest, type UpdateContentRequest, type User, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
2415
+ export { type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, type AuthResponse, BaseClient, type BlogPost, type CacheConfig, CacheManager, CategoriesClient, type Category, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateSiteRequest, type CreateWebhookRequest, DEFAULT_IMAGE_SIZES, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, NewsletterClient, type NewsletterConfirmResponse, type NewsletterList, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, type Product, type ProductQueryParams, ProductsClient, type RequestOptions, type ResponsiveImageSizes, type SignInRequest, type SignUpRequest, type Site, SitesClient, type UpdateApiKeyRequest, type UpdateContentRequest, type User, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
package/dist/index.js CHANGED
@@ -2573,6 +2573,10 @@ async function createCheckoutSession(options) {
2573
2573
  logger = noopLogger,
2574
2574
  fallbackProducts,
2575
2575
  metadata,
2576
+ currency,
2577
+ shippingAmount,
2578
+ shippingAddress,
2579
+ billingAddress,
2576
2580
  priceIdResolver,
2577
2581
  tax
2578
2582
  } = options;
@@ -2628,6 +2632,21 @@ async function createCheckoutSession(options) {
2628
2632
  mode: mode === "test" ? "payment" : "payment",
2629
2633
  metadata
2630
2634
  };
2635
+ if (currency) {
2636
+ checkoutData.currency = currency;
2637
+ }
2638
+ if (typeof shippingAmount === "number") {
2639
+ checkoutData.shipping_amount = shippingAmount;
2640
+ checkoutData.shippingAmount = shippingAmount;
2641
+ }
2642
+ if (shippingAddress) {
2643
+ checkoutData.shipping_address = shippingAddress;
2644
+ checkoutData.shippingAddress = shippingAddress;
2645
+ }
2646
+ if (billingAddress) {
2647
+ checkoutData.billing_address = billingAddress;
2648
+ checkoutData.billingAddress = billingAddress;
2649
+ }
2631
2650
  if (resolvedTax) {
2632
2651
  checkoutData.tax = resolvedTax;
2633
2652
  }
package/dist/index.mjs CHANGED
@@ -2512,6 +2512,10 @@ async function createCheckoutSession(options) {
2512
2512
  logger = noopLogger,
2513
2513
  fallbackProducts,
2514
2514
  metadata,
2515
+ currency,
2516
+ shippingAmount,
2517
+ shippingAddress,
2518
+ billingAddress,
2515
2519
  priceIdResolver,
2516
2520
  tax
2517
2521
  } = options;
@@ -2567,6 +2571,21 @@ async function createCheckoutSession(options) {
2567
2571
  mode: mode === "test" ? "payment" : "payment",
2568
2572
  metadata
2569
2573
  };
2574
+ if (currency) {
2575
+ checkoutData.currency = currency;
2576
+ }
2577
+ if (typeof shippingAmount === "number") {
2578
+ checkoutData.shipping_amount = shippingAmount;
2579
+ checkoutData.shippingAmount = shippingAmount;
2580
+ }
2581
+ if (shippingAddress) {
2582
+ checkoutData.shipping_address = shippingAddress;
2583
+ checkoutData.shippingAddress = shippingAddress;
2584
+ }
2585
+ if (billingAddress) {
2586
+ checkoutData.billing_address = billingAddress;
2587
+ checkoutData.billingAddress = billingAddress;
2588
+ }
2570
2589
  if (resolvedTax) {
2571
2590
  checkoutData.tax = resolvedTax;
2572
2591
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perspectapi-ts-sdk",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "TypeScript SDK for PerspectAPI - Cloudflare Workers compatible",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/loaders.ts CHANGED
@@ -18,7 +18,8 @@ import type {
18
18
  CreateCheckoutSessionRequest,
19
19
  CheckoutSession,
20
20
  CheckoutMetadata,
21
- CheckoutTaxRequest
21
+ CheckoutTaxRequest,
22
+ CheckoutAddress
22
23
  } from './types';
23
24
  import {
24
25
  MAX_API_QUERY_LIMIT,
@@ -585,6 +586,22 @@ export interface CheckoutSessionOptions {
585
586
  logger?: LoaderLogger;
586
587
  fallbackProducts?: Product[];
587
588
  metadata?: CheckoutMetadata;
589
+ /**
590
+ * Optional currency override; defaults to the currency defined on each Stripe price.
591
+ */
592
+ currency?: string;
593
+ /**
594
+ * Optional shipping amount (in the smallest currency unit).
595
+ */
596
+ shippingAmount?: number;
597
+ /**
598
+ * Shipping address forwarded to the checkout API for tax estimation.
599
+ */
600
+ shippingAddress?: CheckoutAddress;
601
+ /**
602
+ * Billing address forwarded to the checkout API for tax estimation.
603
+ */
604
+ billingAddress?: CheckoutAddress;
588
605
  /**
589
606
  * Optional resolver to convert a product record into a Stripe price ID.
590
607
  */
@@ -613,6 +630,10 @@ export async function createCheckoutSession(
613
630
  logger = noopLogger,
614
631
  fallbackProducts,
615
632
  metadata,
633
+ currency,
634
+ shippingAmount,
635
+ shippingAddress,
636
+ billingAddress,
616
637
  priceIdResolver,
617
638
  tax
618
639
  } = options;
@@ -686,6 +707,25 @@ export async function createCheckoutSession(
686
707
  metadata,
687
708
  };
688
709
 
710
+ if (currency) {
711
+ checkoutData.currency = currency;
712
+ }
713
+
714
+ if (typeof shippingAmount === 'number') {
715
+ checkoutData.shipping_amount = shippingAmount;
716
+ checkoutData.shippingAmount = shippingAmount;
717
+ }
718
+
719
+ if (shippingAddress) {
720
+ checkoutData.shipping_address = shippingAddress;
721
+ checkoutData.shippingAddress = shippingAddress;
722
+ }
723
+
724
+ if (billingAddress) {
725
+ checkoutData.billing_address = billingAddress;
726
+ checkoutData.billingAddress = billingAddress;
727
+ }
728
+
689
729
  if (resolvedTax) {
690
730
  checkoutData.tax = resolvedTax;
691
731
  }
@@ -410,6 +410,15 @@ export type CheckoutTaxExemptionStatus =
410
410
  | 'exempt'
411
411
  | 'reverse_charge';
412
412
 
413
+ export interface CheckoutAddress {
414
+ line1?: string;
415
+ line2?: string;
416
+ city?: string;
417
+ state?: string;
418
+ postal_code?: string;
419
+ country?: string;
420
+ }
421
+
413
422
  export interface CheckoutTaxCustomerExemptionRequest {
414
423
  status?: CheckoutTaxExemptionStatus;
415
424
  reason?: string;
@@ -467,6 +476,7 @@ export interface CreateCheckoutSessionRequest {
467
476
  cancelUrl?: string; // Alternative naming
468
477
  customer_email?: string;
469
478
  customerEmail?: string; // Alternative naming
479
+ currency?: string;
470
480
  metadata?: CheckoutMetadata;
471
481
  mode?: 'payment' | 'subscription' | 'setup';
472
482
  automatic_tax?: {
@@ -476,13 +486,38 @@ export interface CreateCheckoutSessionRequest {
476
486
  allowed_countries: string[];
477
487
  };
478
488
  billing_address_collection?: 'auto' | 'required';
489
+ shipping_amount?: number;
490
+ shippingAmount?: number;
491
+ shipping_address?: CheckoutAddress;
492
+ shippingAddress?: CheckoutAddress;
493
+ billing_address?: CheckoutAddress;
494
+ billingAddress?: CheckoutAddress;
479
495
  tax?: CheckoutTaxRequest;
480
496
  }
481
497
 
498
+ export interface CheckoutTaxBreakdownItem {
499
+ jurisdiction: string;
500
+ rate_percent: number;
501
+ tax_amount: number;
502
+ taxable_amount: number;
503
+ source: 'manual_map' | 'manual_percent' | 'gateway' | 'external';
504
+ }
505
+
506
+ export interface CheckoutSessionTax {
507
+ amount: number;
508
+ currency: string;
509
+ strategy: CheckoutTaxStrategy;
510
+ exemption_applied: boolean;
511
+ exemption_status: CheckoutTaxExemptionStatus;
512
+ breakdown?: CheckoutTaxBreakdownItem[] | null;
513
+ }
514
+
482
515
  export interface CheckoutSession {
483
516
  id: string;
484
517
  url: string;
485
518
  status: string;
519
+ payment_status?: string;
520
+ tax?: CheckoutSessionTax | null;
486
521
  }
487
522
 
488
523
  // Contact Forms