import { NonNullablePaths } from '@wix/sdk-types'; interface SavedPaymentMethod { /** * Saved payment method ID. * @format GUID * @readonly */ _id?: string | null; /** * Revision number, which increments by 1 each time the saved payment method is updated. * To prevent conflicting changes, the current revision must be passed when updating the saved payment method. * @readonly */ revision?: string | null; /** * Date and time the saved payment method was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the saved payment method was last updated. * @readonly */ _updatedDate?: Date | null; /** * ID of the site member who owns this saved payment method. * @format GUID * @immutable */ siteMemberId?: string | null; /** * Whether this saved payment method is the primary one for the member. Each member can have at most one primary saved payment method. The primary method is selected by default during checkout. * @readonly */ primary?: boolean; /** Payment method details. */ paymentMethod?: PaymentMethod; /** * Whether the merchant can use this payment method for unscheduled payments, such as manual charges. * Even when set to `false`, the payment method can still be used for scheduled payments such as subscription renewals without the buyer being present. */ merchantUseAllowed?: boolean | null; /** * Saved payment method's sensitive information. * @readonly */ sensitiveInfo?: SensitiveInfo; /** * Custom field data for the saved payment method object. * * [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions) must be configured in the app dashboard before they can be accessed with API calls. */ extendedFields?: ExtendedFields; } interface CardInfo { /** * Payment card's last 4 digits. * @minLength 4 * @maxLength 4 * @readonly */ lastFourDigits?: string | null; /** * Payment card's BIN (Bank Identification Number). First 4-6 digits of the card number. * @minLength 4 * @maxLength 6 * @readonly */ bin?: string | null; /** * Payment card's expiration month. * @min 1 * @max 12 * @immutable */ expirationMonth?: number | null; /** * Payment card's expiration year. * @min 2000 * @max 2099 * @immutable */ expirationYear?: number | null; /** * Cardholder's full name as it appears on the card. * @minLength 1 * @maxLength 1000 */ cardholderName?: string | null; } declare enum CardBrand { UNKNOWN_CARD_BRAND = "UNKNOWN_CARD_BRAND", AMEX = "AMEX", DANKORT = "DANKORT", DINERS = "DINERS", DISCOVER = "DISCOVER", ISRACARD = "ISRACARD", JCB = "JCB", MAESTRO = "MAESTRO", MASTERCARD = "MASTERCARD", UNIONPAY = "UNIONPAY", VISA = "VISA", RUPAY = "RUPAY" } /** @enumType */ type CardBrandWithLiterals = CardBrand | 'UNKNOWN_CARD_BRAND' | 'AMEX' | 'DANKORT' | 'DINERS' | 'DISCOVER' | 'ISRACARD' | 'JCB' | 'MAESTRO' | 'MASTERCARD' | 'UNIONPAY' | 'VISA' | 'RUPAY'; interface PaymentMethod { /** * Legacy payment method type ID. Supported values: `creditCard`, `payPal`. * @minLength 1 * @maxLength 100 * @immutable */ typeId?: string; /** * Payment method type ID. * @format GUID * @readonly * @immutable */ paymentMethodTypeId?: string; /** * Payment method brand ID. * @format GUID * @readonly * @immutable */ paymentMethodBrandId?: string | null; /** Payment card details. */ cardInfo?: CardInfo; } interface SensitiveInfo { /** Payment card sensitive details. */ cardSensitiveInfo?: CardSensitiveInfo; } interface CardSensitiveInfo { /** * Persistent token of a payment card tokenized by Wix. * @format GUID */ persistentToken?: string | null; } interface ExtendedFields { /** * Extended field data. Each key corresponds to the namespace of the app that created the extended fields. * The value of each key is structured according to the schema defined when the extended fields were configured. * * You can only access fields for which you have the appropriate permissions. * * Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields). */ namespaces?: Record>; } interface UpsertSavedPaymentMethodRequest { /** Saved payment method to create or update. */ savedPaymentMethod: SavedPaymentMethod; /** * Temporary token of a payment card tokenized by Wix. Used to create a persistent token for future transactions. * @format GUID */ temporaryCardToken: string | null; } interface UpsertSavedPaymentMethodResponse { /** Created or updated saved payment method. */ savedPaymentMethod?: SavedPaymentMethod; } interface GetSavedPaymentMethodRequest { /** * Unique identifier of a saved payment method. * @format GUID */ savedPaymentMethodId: string; /** * Additional fields to return. * @maxSize 1 */ fields?: RequestedFieldsWithLiterals[]; } declare enum RequestedFields { /** Sensitive information such as payment card tokens. */ SENSITIVE_INFO = "SENSITIVE_INFO" } /** @enumType */ type RequestedFieldsWithLiterals = RequestedFields | 'SENSITIVE_INFO'; interface GetSavedPaymentMethodResponse { /** Retrieved saved payment method. */ savedPaymentMethod?: SavedPaymentMethod; } interface DeleteSavedPaymentMethodRequest { /** * Unique identifier of a saved payment method. * @format GUID */ savedPaymentMethodId: string; } interface DeleteSavedPaymentMethodResponse { } interface ListSavedPaymentMethodsRequest { /** * ID of the site member whose saved payment methods to list. Pass `me` to list the current site member's saved payment methods. * @minLength 2 * @maxLength 36 */ siteMemberId?: string | null; /** * Legacy payment method type ID. Supported values: `creditCard`, `payPal`. * @minLength 1 * @maxLength 100 */ paymentMethodTypeId?: string | null; /** Whether to filter by saved payment methods that are allowed for unscheduled merchant-initiated payments. */ merchantUseAllowed?: boolean | null; /** * Additional fields to return. * @maxSize 1 */ fields?: RequestedFieldsWithLiterals[]; /** * Cursor paging parameters. * * Default: `100` results per page. */ paging?: CursorPaging; } interface CursorPaging { /** * Maximum number of items to return in the results. * @max 100 */ limit?: number | null; /** * Pointer to the next or previous page in the list of results. * * Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. * Not relevant for the first request. * @maxLength 16000 */ cursor?: string | null; } interface ListSavedPaymentMethodsResponse { /** List of saved payment methods. */ savedPaymentMethods?: SavedPaymentMethod[]; /** Details on the paged set of results returned. */ pagingMetadata?: CursorPagingMetadata; } interface CursorPagingMetadata { /** Number of items returned in the response. */ count?: number | null; /** Cursor strings that point to the next page, previous page, or both. */ cursors?: Cursors; /** * Whether there are more pages to retrieve following the current page. * * + `true`: Another page of results can be retrieved. * + `false`: This is the last page. */ hasNext?: boolean | null; } interface Cursors { /** * Cursor string pointing to the next page in the list of results. * @maxLength 16000 */ next?: string | null; /** * Cursor pointing to the previous page in the list of results. * @maxLength 16000 */ prev?: string | null; } interface UpdateSavedPaymentMethodRequest { /** Saved payment method to update. */ savedPaymentMethod?: SavedPaymentMethod; } interface UpdateSavedPaymentMethodResponse { /** Updated saved payment method. */ savedPaymentMethod?: SavedPaymentMethod; } interface MarkSavedPaymentMethodPrimaryRequest { /** * Unique identifier of a saved payment method. * @format GUID */ savedPaymentMethodId: string; } interface MarkSavedPaymentMethodPrimaryResponse { } interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** Event ID. With this ID you can easily spot duplicated events and ignore them. */ _id?: string; /** * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`. */ entityFqdn?: string; /** * Event action name, placed at the top level to make it easier for users to dispatch messages. * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`. */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */ eventTime?: Date | null; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number. * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it. */ entityEventSequence?: string | null; } /** @oneof */ interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } interface EntityCreatedEvent { entity?: string; } interface RestoreInfo { deletedDate?: Date | null; } interface EntityUpdatedEvent { /** * Since platformized APIs only expose PATCH and not PUT we can't assume that the fields sent from the client are the actual diff. * This means that to generate a list of changed fields (as opposed to sent fields) one needs to traverse both objects. * We don't want to impose this on all developers and so we leave this traversal to the notification recipients which need it. */ currentEntity?: string; } interface EntityDeletedEvent { /** Entity that was deleted. */ deletedEntity?: string | null; } interface ActionEvent { body?: string; } interface MessageEnvelope { /** * App instance ID. * @format GUID */ instanceId?: string | null; /** * Event type. * @maxLength 150 */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; /** Details related to the account */ accountInfo?: AccountInfo; } interface IdentificationData extends IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; /** @readonly */ identityType?: WebhookIdentityTypeWithLiterals; } /** @oneof */ interface IdentificationDataIdOneOf { /** * ID of a site visitor that has not logged in to the site. * @format GUID */ anonymousVisitorId?: string; /** * ID of a site visitor that has logged in to the site. * @format GUID */ memberId?: string; /** * ID of a Wix user (site owner, contributor, etc.). * @format GUID */ wixUserId?: string; /** * ID of an app. * @format GUID */ appId?: string; } declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } /** @enumType */ type WebhookIdentityTypeWithLiterals = WebhookIdentityType | 'UNKNOWN' | 'ANONYMOUS_VISITOR' | 'MEMBER' | 'WIX_USER' | 'APP'; interface AccountInfo { /** * ID of the Wix account associated with the event. * @format GUID */ accountId?: string | null; /** * ID of the parent Wix account. Only included when accountId belongs to a child account. * @format GUID */ parentAccountId?: string | null; /** * ID of the Wix site associated with the event. Only included when the event is tied to a specific site. * @format GUID */ siteId?: string | null; } interface FindSavedCreditCardRequest { /** * temporary card token * @format GUID */ temporaryCardToken?: string; /** * site member id * @format GUID */ siteMemberId?: string; /** * expiration month * @min 1 * @max 12 */ expirationMonth?: number; /** * expiration year * @min 2000 * @max 2099 */ expirationYear?: number; } interface FindSavedCreditCardResponse { /** * saved payment method id * @format GUID */ savedPaymentMethodId?: string | null; } interface BaseEventMetadata { /** * App instance ID. * @format GUID */ instanceId?: string | null; /** * Event type. * @maxLength 150 */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Details related to the account */ accountInfo?: AccountInfo; } interface EventMetadata extends BaseEventMetadata { /** Event ID. With this ID you can easily spot duplicated events and ignore them. */ _id?: string; /** * Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. * For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`. */ entityFqdn?: string; /** * Event action name, placed at the top level to make it easier for users to dispatch messages. * For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`. */ slug?: string; /** ID of the entity associated with the event. */ entityId?: string; /** Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`. */ eventTime?: Date | null; /** * Whether the event was triggered as a result of a privacy regulation application * (for example, GDPR). */ triggeredByAnonymizeRequest?: boolean | null; /** If present, indicates the action that triggered the event. */ originatedFrom?: string | null; /** * A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number. * You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it. */ entityEventSequence?: string | null; accountInfo?: AccountInfoMetadata; } interface AccountInfoMetadata { /** ID of the Wix account associated with the event */ accountId: string; /** ID of the Wix site associated with the event. Only included when the event is tied to a specific site. */ siteId?: string; /** ID of the parent Wix account. Only included when 'accountId' belongs to a child account. */ parentAccountId?: string; } interface SavedPaymentMethodCreatedEnvelope { entity: SavedPaymentMethod; metadata: EventMetadata; } /** @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_READ * @webhook * @eventType wix.payments.saved_payment_methods.v1.saved_payment_method_created * @serviceIdentifier wix.payments.saved_payment_methods.v1.SavedPaymentMethodService * @slug created * @documentationMaturity preview */ declare function onSavedPaymentMethodCreated(handler: (event: SavedPaymentMethodCreatedEnvelope) => void | Promise): void; interface SavedPaymentMethodDeletedEnvelope { metadata: EventMetadata; } /** @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_READ * @webhook * @eventType wix.payments.saved_payment_methods.v1.saved_payment_method_deleted * @serviceIdentifier wix.payments.saved_payment_methods.v1.SavedPaymentMethodService * @slug deleted * @documentationMaturity preview */ declare function onSavedPaymentMethodDeleted(handler: (event: SavedPaymentMethodDeletedEnvelope) => void | Promise): void; interface SavedPaymentMethodUpdatedEnvelope { entity: SavedPaymentMethod; metadata: EventMetadata; } /** @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_READ * @webhook * @eventType wix.payments.saved_payment_methods.v1.saved_payment_method_updated * @serviceIdentifier wix.payments.saved_payment_methods.v1.SavedPaymentMethodService * @slug updated * @documentationMaturity preview */ declare function onSavedPaymentMethodUpdated(handler: (event: SavedPaymentMethodUpdatedEnvelope) => void | Promise): void; /** * Creates or updates a saved payment method. * * If a saved payment method with matching card details (expiration date, last four digits, and BIN) already exists for the same site member, * the existing saved payment method is updated. Otherwise, a new saved payment method is created. * * Payment cards are currently supported. Support for other payment method types may vary and is subject to change. * * > **Note:** The system may limit the number of saved payment methods per site member. * @param savedPaymentMethod - Saved payment method to create or update. * @public * @documentationMaturity preview * @requiredField options * @requiredField options.temporaryCardToken * @requiredField savedPaymentMethod * @requiredField savedPaymentMethod.paymentMethod * @requiredField savedPaymentMethod.paymentMethod.cardInfo.expirationMonth * @requiredField savedPaymentMethod.paymentMethod.cardInfo.expirationYear * @requiredField savedPaymentMethod.paymentMethod.typeId * @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_UPSERT * @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_UPSERT_WITH_MEMBER_ID * @fqn wix.payments.saved_payment_methods.v1.SavedPaymentMethodService.UpsertSavedPaymentMethod */ declare function upsertSavedPaymentMethod(savedPaymentMethod: NonNullablePaths, options: NonNullablePaths): Promise>; interface UpsertSavedPaymentMethodOptions { /** * Temporary token of a payment card tokenized by Wix. Used to create a persistent token for future transactions. * @format GUID */ temporaryCardToken: string | null; } /** * Retrieves a saved payment method by ID. * @param savedPaymentMethodId - Unique identifier of a saved payment method. * @public * @documentationMaturity preview * @requiredField savedPaymentMethodId * @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_READ * @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_READ_SENSITIVE_INFO * @returns Retrieved saved payment method. * @fqn wix.payments.saved_payment_methods.v1.SavedPaymentMethodService.GetSavedPaymentMethod */ declare function getSavedPaymentMethod(savedPaymentMethodId: string, options?: GetSavedPaymentMethodOptions): Promise>; interface GetSavedPaymentMethodOptions { /** * Additional fields to return. * @maxSize 1 */ fields?: RequestedFieldsWithLiterals[]; } /** * Deletes a saved payment method. * * If the deleted saved payment method was the primary one, the system automatically assigns another saved payment method as primary. * @param savedPaymentMethodId - Unique identifier of a saved payment method. * @public * @documentationMaturity preview * @requiredField savedPaymentMethodId * @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_DELETE * @fqn wix.payments.saved_payment_methods.v1.SavedPaymentMethodService.DeleteSavedPaymentMethod */ declare function deleteSavedPaymentMethod(savedPaymentMethodId: string): Promise; /** * Retrieves a list of saved payment methods, sorted by last updated date in descending order. * @public * @documentationMaturity preview * @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_READ * @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_READ_SENSITIVE_INFO * @fqn wix.payments.saved_payment_methods.v1.SavedPaymentMethodService.ListSavedPaymentMethods */ declare function listSavedPaymentMethods(options?: ListSavedPaymentMethodsOptions): Promise>; interface ListSavedPaymentMethodsOptions { /** * ID of the site member whose saved payment methods to list. Pass `me` to list the current site member's saved payment methods. * @minLength 2 * @maxLength 36 */ siteMemberId?: string | null; /** * Legacy payment method type ID. Supported values: `creditCard`, `payPal`. * @minLength 1 * @maxLength 100 */ paymentMethodTypeId?: string | null; /** Whether to filter by saved payment methods that are allowed for unscheduled merchant-initiated payments. */ merchantUseAllowed?: boolean | null; /** * Additional fields to return. * @maxSize 1 */ fields?: RequestedFieldsWithLiterals[]; /** * Cursor paging parameters. * * Default: `100` results per page. */ paging?: CursorPaging; } /** * Updates a saved payment method. * * Each time the saved payment method is updated, `revision` increments by 1. * The current `revision` must be passed when updating the saved payment method. * This ensures you're working with the latest saved payment method and prevents unintended overwrites. * @param _id - Saved payment method ID. * @public * @documentationMaturity preview * @requiredField _id * @requiredField options.savedPaymentMethod.revision * @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_UPDATE * @returns Updated saved payment method. * @fqn wix.payments.saved_payment_methods.v1.SavedPaymentMethodService.UpdateSavedPaymentMethod */ declare function updateSavedPaymentMethod(_id: string, options?: NonNullablePaths): Promise>; interface UpdateSavedPaymentMethodOptions { savedPaymentMethod?: { /** * Saved payment method ID. * @format GUID * @readonly */ _id?: string | null; /** * Revision number, which increments by 1 each time the saved payment method is updated. * To prevent conflicting changes, the current revision must be passed when updating the saved payment method. * @readonly */ revision?: string | null; /** * Date and time the saved payment method was created. * @readonly */ _createdDate?: Date | null; /** * Date and time the saved payment method was last updated. * @readonly */ _updatedDate?: Date | null; /** * ID of the site member who owns this saved payment method. * @format GUID * @immutable */ siteMemberId?: string | null; /** * Whether this saved payment method is the primary one for the member. Each member can have at most one primary saved payment method. The primary method is selected by default during checkout. * @readonly */ primary?: boolean; /** Payment method details. */ paymentMethod?: PaymentMethod; /** * Whether the merchant can use this payment method for unscheduled payments, such as manual charges. * Even when set to `false`, the payment method can still be used for scheduled payments such as subscription renewals without the buyer being present. */ merchantUseAllowed?: boolean | null; /** * Saved payment method's sensitive information. * @readonly */ sensitiveInfo?: SensitiveInfo; /** * Custom field data for the saved payment method object. * * [Extended fields](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/schema-plugins/about-schema-plugin-extensions) must be configured in the app dashboard before they can be accessed with API calls. */ extendedFields?: ExtendedFields; }; } /** * Marks a saved payment method as primary for the site member who owns it. * A primary saved payment method is selected by default during checkout. * Each site member can have at most one primary saved payment method, so marking one as primary automatically unmarks the previous one. * @param savedPaymentMethodId - Unique identifier of a saved payment method. * @public * @documentationMaturity preview * @requiredField savedPaymentMethodId * @permissionId PAYMENTS.SAVED_PAYMENT_METHOD_MARK_PRIMARY * @fqn wix.payments.saved_payment_methods.v1.SavedPaymentMethodService.MarkSavedPaymentMethodPrimary */ declare function markSavedPaymentMethodPrimary(savedPaymentMethodId: string): Promise; export { type AccountInfo, type AccountInfoMetadata, type ActionEvent, type BaseEventMetadata, CardBrand, type CardBrandWithLiterals, type CardInfo, type CardSensitiveInfo, type CursorPaging, type CursorPagingMetadata, type Cursors, type DeleteSavedPaymentMethodRequest, type DeleteSavedPaymentMethodResponse, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type EventMetadata, type ExtendedFields, type FindSavedCreditCardRequest, type FindSavedCreditCardResponse, type GetSavedPaymentMethodOptions, type GetSavedPaymentMethodRequest, type GetSavedPaymentMethodResponse, type IdentificationData, type IdentificationDataIdOneOf, type ListSavedPaymentMethodsOptions, type ListSavedPaymentMethodsRequest, type ListSavedPaymentMethodsResponse, type MarkSavedPaymentMethodPrimaryRequest, type MarkSavedPaymentMethodPrimaryResponse, type MessageEnvelope, type PaymentMethod, RequestedFields, type RequestedFieldsWithLiterals, type RestoreInfo, type SavedPaymentMethod, type SavedPaymentMethodCreatedEnvelope, type SavedPaymentMethodDeletedEnvelope, type SavedPaymentMethodUpdatedEnvelope, type SensitiveInfo, type UpdateSavedPaymentMethodOptions, type UpdateSavedPaymentMethodRequest, type UpdateSavedPaymentMethodResponse, type UpsertSavedPaymentMethodOptions, type UpsertSavedPaymentMethodRequest, type UpsertSavedPaymentMethodResponse, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, deleteSavedPaymentMethod, getSavedPaymentMethod, listSavedPaymentMethods, markSavedPaymentMethodPrimary, onSavedPaymentMethodCreated, onSavedPaymentMethodDeleted, onSavedPaymentMethodUpdated, updateSavedPaymentMethod, upsertSavedPaymentMethod };