@fonderie/client 0.13.0 → 0.15.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/brain/signatures.md +18 -0
- package/dist/index.cjs +46 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -227,6 +227,18 @@ interface IWalletTransactionsResult {
|
|
|
227
227
|
interface IWalletCheckoutInput {
|
|
228
228
|
packId: string;
|
|
229
229
|
}
|
|
230
|
+
interface IWalletPurchaseInput {
|
|
231
|
+
packId: string;
|
|
232
|
+
idempotencyKey: string;
|
|
233
|
+
}
|
|
234
|
+
interface IWalletPurchaseResult {
|
|
235
|
+
status: 'credited' | 'checkout_required' | 'declined' | 'processing';
|
|
236
|
+
balance?: string;
|
|
237
|
+
currency?: string;
|
|
238
|
+
credits?: string;
|
|
239
|
+
duplicate?: boolean;
|
|
240
|
+
reason?: 'no_saved_card' | 'authentication_required';
|
|
241
|
+
}
|
|
230
242
|
interface ICancelSubscriptionInput {
|
|
231
243
|
atPeriodEnd?: boolean;
|
|
232
244
|
}
|
|
@@ -244,6 +256,12 @@ interface IPaymentMethodDTO {
|
|
|
244
256
|
interface IPaymentMethodResult {
|
|
245
257
|
paymentMethod: IPaymentMethodDTO | null;
|
|
246
258
|
}
|
|
259
|
+
interface ISetupIntentResult {
|
|
260
|
+
clientSecret: string;
|
|
261
|
+
}
|
|
262
|
+
interface ISavePaymentMethodInput {
|
|
263
|
+
paymentMethodId: string;
|
|
264
|
+
}
|
|
247
265
|
interface IInvoiceDTO {
|
|
248
266
|
id: string;
|
|
249
267
|
number: string | null;
|
|
@@ -741,11 +759,15 @@ declare class BillingClient {
|
|
|
741
759
|
getWallet(opts?: IReadOptions): Promise<IApiResponse<IWalletResult>>;
|
|
742
760
|
setWalletPreferences(input: IWalletPreferencesInput): Promise<IApiResponse<IWalletResult>>;
|
|
743
761
|
createWalletCheckout(input: IWalletCheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
762
|
+
purchaseWalletPack(input: IWalletPurchaseInput): Promise<IApiResponse<IWalletPurchaseResult>>;
|
|
744
763
|
getWalletTransactions(opts?: IReadOptions & {
|
|
745
764
|
cursor?: string;
|
|
746
765
|
limit?: number;
|
|
747
766
|
}): Promise<IApiResponse<IWalletTransactionsResult>>;
|
|
748
767
|
getPaymentMethod(opts?: IReadOptions): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
768
|
+
setupPaymentMethod(): Promise<IApiResponse<ISetupIntentResult>>;
|
|
769
|
+
savePaymentMethod(input: ISavePaymentMethodInput): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
770
|
+
removePaymentMethod(): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
749
771
|
listInvoices(opts?: IReadOptions): Promise<IApiResponse<IInvoicesResult>>;
|
|
750
772
|
}
|
|
751
773
|
|
|
@@ -1081,4 +1103,4 @@ declare class CourierAdminClient {
|
|
|
1081
1103
|
rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
|
|
1082
1104
|
}
|
|
1083
1105
|
|
|
1084
|
-
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
|
1106
|
+
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
package/dist/index.d.ts
CHANGED
|
@@ -227,6 +227,18 @@ interface IWalletTransactionsResult {
|
|
|
227
227
|
interface IWalletCheckoutInput {
|
|
228
228
|
packId: string;
|
|
229
229
|
}
|
|
230
|
+
interface IWalletPurchaseInput {
|
|
231
|
+
packId: string;
|
|
232
|
+
idempotencyKey: string;
|
|
233
|
+
}
|
|
234
|
+
interface IWalletPurchaseResult {
|
|
235
|
+
status: 'credited' | 'checkout_required' | 'declined' | 'processing';
|
|
236
|
+
balance?: string;
|
|
237
|
+
currency?: string;
|
|
238
|
+
credits?: string;
|
|
239
|
+
duplicate?: boolean;
|
|
240
|
+
reason?: 'no_saved_card' | 'authentication_required';
|
|
241
|
+
}
|
|
230
242
|
interface ICancelSubscriptionInput {
|
|
231
243
|
atPeriodEnd?: boolean;
|
|
232
244
|
}
|
|
@@ -244,6 +256,12 @@ interface IPaymentMethodDTO {
|
|
|
244
256
|
interface IPaymentMethodResult {
|
|
245
257
|
paymentMethod: IPaymentMethodDTO | null;
|
|
246
258
|
}
|
|
259
|
+
interface ISetupIntentResult {
|
|
260
|
+
clientSecret: string;
|
|
261
|
+
}
|
|
262
|
+
interface ISavePaymentMethodInput {
|
|
263
|
+
paymentMethodId: string;
|
|
264
|
+
}
|
|
247
265
|
interface IInvoiceDTO {
|
|
248
266
|
id: string;
|
|
249
267
|
number: string | null;
|
|
@@ -741,11 +759,15 @@ declare class BillingClient {
|
|
|
741
759
|
getWallet(opts?: IReadOptions): Promise<IApiResponse<IWalletResult>>;
|
|
742
760
|
setWalletPreferences(input: IWalletPreferencesInput): Promise<IApiResponse<IWalletResult>>;
|
|
743
761
|
createWalletCheckout(input: IWalletCheckoutInput): Promise<IApiResponse<ICheckoutUrlResult>>;
|
|
762
|
+
purchaseWalletPack(input: IWalletPurchaseInput): Promise<IApiResponse<IWalletPurchaseResult>>;
|
|
744
763
|
getWalletTransactions(opts?: IReadOptions & {
|
|
745
764
|
cursor?: string;
|
|
746
765
|
limit?: number;
|
|
747
766
|
}): Promise<IApiResponse<IWalletTransactionsResult>>;
|
|
748
767
|
getPaymentMethod(opts?: IReadOptions): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
768
|
+
setupPaymentMethod(): Promise<IApiResponse<ISetupIntentResult>>;
|
|
769
|
+
savePaymentMethod(input: ISavePaymentMethodInput): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
770
|
+
removePaymentMethod(): Promise<IApiResponse<IPaymentMethodResult>>;
|
|
749
771
|
listInvoices(opts?: IReadOptions): Promise<IApiResponse<IInvoicesResult>>;
|
|
750
772
|
}
|
|
751
773
|
|
|
@@ -1081,4 +1103,4 @@ declare class CourierAdminClient {
|
|
|
1081
1103
|
rollback(type: string, input: IRollbackTemplateInput, locale?: string | null): Promise<IApiResponse<ITemplateEntry>>;
|
|
1082
1104
|
}
|
|
1083
1105
|
|
|
1084
|
-
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
|
1106
|
+
export { AuditClient, AuthClient, BillingClient, ConfigAdminClient, CourierAdminClient, type CustomerLabelType, type CustomerSex, type CustomerType, CustomersClient, FonderieApiError, FonderieClient, type IAcceptInvitationResult, type IAddAddressInput, type IAddEmailInput, type IAddPhoneInput, type IAddRelationshipInput, type IAddressDTO, type IApiError, type IApiResponse, type IAuditEventDTO, type IAuditPageResult, type IBlacklistCustomerInput, type ICache, type ICancelSubscriptionInput, type IChangePasswordInput, type ICheckoutInput, type ICheckoutUrlResult, type IClientAuthConfig, type IConfigAdminClientOptions, type IConfigEntry, type IConfigRevision, type ICourierAdminClientOptions, type ICreateCustomerInput, type ICreatePlanInput, type ICreateRoleInput, type ICreateWebhookEndpointInput, type ICreateWorkspaceInput, type ICustomerAddressDTO, type ICustomerAddressListResult, type ICustomerAddressResult, type ICustomerDTO, type ICustomerDetailD2DTO, type ICustomerDetailDTO, type ICustomerEmailDTO, type ICustomerEmailListResult, type ICustomerEmailResult, type ICustomerLabelDTO, type ICustomerLabelListResult, type ICustomerListResult, type ICustomerNoteDTO, type ICustomerNoteListResult, type ICustomerNoteResult, type ICustomerPhoneDTO, type ICustomerPhoneListResult, type ICustomerPhoneResult, type ICustomerRelationshipDTO, type ICustomerRelationshipExpandedD2DTO, type ICustomerRelationshipExpandedDTO, type ICustomerRelationshipListResult, type ICustomerRelationshipResult, type ICustomerResult, type ICustomerShallowDTO, type ICustomerTagListResult, type IFonderieClientOptions, type IGetCustomerInput, type IInvitationDTO, type IInvitationListResult, type IInviteEntry, type IInviteResult, type IInvoiceDTO, type IInvoicesResult, type IListAuditEventsInput, type IListCustomersInput, type ILoginInput, type ILoginResult, type IMeResult, type IMemberDTO, type IMemberListResult, type IMemoryCacheOptions, type IMfaEnabledResult, type IMfaRequiredResult, type IMfaSetupResult, type IPaymentMethodDTO, type IPaymentMethodResult, type IPlanDTO, type IPlanFeature, type IPlanListResult, type IPlanResult, type IPortalUrlResult, type IReadOptions, type IRecordUsageInput, type IRefreshResult, type IRegisterInput, type IRegisterResult, type IRequestConfig, type IResendVerificationResult, type IResetPasswordInput, type IRevealSecretResult, type IRoleDTO, type IRoleListResult, type IRolePermission, type IRolePermissionInput, type IRolePermissionsResult, type IRoleResult, type IRollbackInput, type IRollbackTemplateInput, type ISecretEntry, type ISecretRevision, type ISetConfigInput, type ISetSecretInput, type ISetTemplateInput, type ISubscriptionChangeResult, type ISubscriptionDTO, type ISubscriptionResult, type ITemplateEntry, type ITemplateRevision, type ITestWebhookResult, type ITokens, type IUpdateCustomerInput, type IUpdatePlanInput, type IUpdatePreferencesInput, type IUpdateProfileInput, type IUpdateRoleInput, type IUpdateSettingsInput, type IUpdateWebhookEndpointInput, type IUpdateWorkspaceInput, type IUsageResult, type IUserDTO, type IUserPreferences, type IVerifyEmailResult, type IWalletCheckoutInput, type IWalletDTO, type IWalletPreferencesInput, type IWalletPurchaseInput, type IWalletPurchaseResult, type IWalletResult, type IWalletTransactionDTO, type IWalletTransactionsResult, type IWebhookDeliveryDTO, type IWebhookDeliveryListResult, type IWebhookEndpointCreatedDTO, type IWebhookEndpointDTO, type IWebhookEndpointListResult, type IWorkspaceAddressDTO, type IWorkspaceDTO, type IWorkspaceListResult, type IWorkspaceResult, type IWorkspaceSettingsDTO, type IWorkspaceSettingsResult, type SubscriberType, WebhooksClient, WorkspacesClient, createMemoryCache, isMfaRequired };
|
package/dist/index.js
CHANGED
|
@@ -508,6 +508,21 @@ var BillingClient = class {
|
|
|
508
508
|
workspaceId: this.workspaceId
|
|
509
509
|
});
|
|
510
510
|
}
|
|
511
|
+
// Buy a credit pack in-app by charging the saved card — no redirect. Inspect
|
|
512
|
+
// `result.status`: 'credited' (done — refresh the wallet), 'checkout_required'
|
|
513
|
+
// (no saved card or the card needs 3-D Secure → fall back to
|
|
514
|
+
// createWalletCheckout), 'declined', or 'processing' (indeterminate — retry
|
|
515
|
+
// with the SAME idempotencyKey). Generate one idempotencyKey per attempt and
|
|
516
|
+
// reuse it on retry so a double-submit can't double-charge.
|
|
517
|
+
purchaseWalletPack(input) {
|
|
518
|
+
return this.http.request({
|
|
519
|
+
method: "POST",
|
|
520
|
+
path: "/billing/wallet/purchase",
|
|
521
|
+
body: input,
|
|
522
|
+
token: this.tokens.get(),
|
|
523
|
+
workspaceId: this.workspaceId
|
|
524
|
+
});
|
|
525
|
+
}
|
|
511
526
|
// The wallet ledger, newest first — every credit/debit with a running
|
|
512
527
|
// balanceAfter. Cursor-paginated: pass the previous result's `nextCursor`.
|
|
513
528
|
getWalletTransactions(opts) {
|
|
@@ -535,6 +550,37 @@ var BillingClient = class {
|
|
|
535
550
|
bust: opts?.bust
|
|
536
551
|
});
|
|
537
552
|
}
|
|
553
|
+
// Begin in-app card entry — returns a SetupIntent client secret for the
|
|
554
|
+
// provider's embedded card element (Stripe Payment Element); the user never
|
|
555
|
+
// leaves the site. 501 when the provider has no in-app card support.
|
|
556
|
+
setupPaymentMethod() {
|
|
557
|
+
return this.http.request({
|
|
558
|
+
method: "POST",
|
|
559
|
+
path: "/billing/payment-method/setup",
|
|
560
|
+
token: this.tokens.get(),
|
|
561
|
+
workspaceId: this.workspaceId
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
// Save the card after the client confirms the SetupIntent: makes it the
|
|
565
|
+
// default and records it. 422 when the card isn't attached to this customer.
|
|
566
|
+
savePaymentMethod(input) {
|
|
567
|
+
return this.http.request({
|
|
568
|
+
method: "PUT",
|
|
569
|
+
path: "/billing/payment-method",
|
|
570
|
+
body: input,
|
|
571
|
+
token: this.tokens.get(),
|
|
572
|
+
workspaceId: this.workspaceId
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
// Remove the saved card (detach at the provider + clear the record).
|
|
576
|
+
removePaymentMethod() {
|
|
577
|
+
return this.http.request({
|
|
578
|
+
method: "DELETE",
|
|
579
|
+
path: "/billing/payment-method",
|
|
580
|
+
token: this.tokens.get(),
|
|
581
|
+
workspaceId: this.workspaceId
|
|
582
|
+
});
|
|
583
|
+
}
|
|
538
584
|
// The customer's invoices, newest first — each links out to the hosted
|
|
539
585
|
// invoice / PDF. 501 when the provider can't list them.
|
|
540
586
|
listInvoices(opts) {
|