@fonderie/client 0.13.0 → 0.14.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.
@@ -194,6 +194,9 @@ new BillingClient(http: HttpClient, tokens: TokenStore): BillingClient
194
194
  .createWalletCheckout(input: IWalletCheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>
195
195
  .getWalletTransactions(opts?: (IReadOptions & { cursor?: string; limit?: number; }) | undefined): Promise<IApiResponse<IWalletTransactionsResult>>
196
196
  .getPaymentMethod(opts?: IReadOptions | undefined): Promise<IApiResponse<IPaymentMethodResult>>
197
+ .setupPaymentMethod(): Promise<IApiResponse<ISetupIntentResult>>
198
+ .savePaymentMethod(input: ISavePaymentMethodInput): Promise<IApiResponse<IPaymentMethodResult>>
199
+ .removePaymentMethod(): Promise<IApiResponse<IPaymentMethodResult>>
197
200
  .listInvoices(opts?: IReadOptions | undefined): Promise<IApiResponse<IInvoicesResult>>
198
201
 
199
202
  interface IConfigAdminClientOptions {
package/dist/index.cjs CHANGED
@@ -572,6 +572,37 @@ var BillingClient = class {
572
572
  bust: opts?.bust
573
573
  });
574
574
  }
575
+ // Begin in-app card entry — returns a SetupIntent client secret for the
576
+ // provider's embedded card element (Stripe Payment Element); the user never
577
+ // leaves the site. 501 when the provider has no in-app card support.
578
+ setupPaymentMethod() {
579
+ return this.http.request({
580
+ method: "POST",
581
+ path: "/billing/payment-method/setup",
582
+ token: this.tokens.get(),
583
+ workspaceId: this.workspaceId
584
+ });
585
+ }
586
+ // Save the card after the client confirms the SetupIntent: makes it the
587
+ // default and records it. 422 when the card isn't attached to this customer.
588
+ savePaymentMethod(input) {
589
+ return this.http.request({
590
+ method: "PUT",
591
+ path: "/billing/payment-method",
592
+ body: input,
593
+ token: this.tokens.get(),
594
+ workspaceId: this.workspaceId
595
+ });
596
+ }
597
+ // Remove the saved card (detach at the provider + clear the record).
598
+ removePaymentMethod() {
599
+ return this.http.request({
600
+ method: "DELETE",
601
+ path: "/billing/payment-method",
602
+ token: this.tokens.get(),
603
+ workspaceId: this.workspaceId
604
+ });
605
+ }
575
606
  // The customer's invoices, newest first — each links out to the hosted
576
607
  // invoice / PDF. 501 when the provider can't list them.
577
608
  listInvoices(opts) {