/** * A loyalty coupon is created when a customer redeems their loyalty points for a reward. Creating a loyalty coupon * also creates a corresponding "reference" coupon with the [Coupons API](https://dev.wix.com/api/rest/coupons/about-wix-coupons). */ export interface LoyaltyCoupon { /** * Loyalty coupon ID. * @readonly */ id?: string; /** * [Loyalty account ID](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/account-object) of the customer that redeemed points for a coupon. * @readonly */ accountId?: string; /** * [Member ID](https://dev.wix.com/api/rest/members/members/member-object) of the customer that redeemed points for a coupon. * @readonly * @deprecated [Member ID](https://dev.wix.com/api/rest/members/members/member-object) of the customer that redeemed points for a coupon. * @replacedBy member_id * @targetRemovalDate 2024-06-01 */ memberIdDeprecated?: string; /** * [Member ID](https://dev.wix.com/docs/rest/crm/members-contacts/members/members/member-object) of the customer that redeemed points for a coupon. * @readonly */ memberId?: string | null; /** * Transaction ID for the transaction that created a coupon. * @readonly */ transactionId?: string | null; /** * Reference coupon information for the corresponding [coupon](https://dev.wix.com/api/rest/coupons/about-wix-coupons) * that is created along with the loyalty coupon. * @readonly */ couponReference?: CouponReference; /** * Loyalty coupon status. * * This status relates to the corresponding coupon that is created * at the same time as the loyalty coupon and is included in `couponReference`. * @readonly */ status?: Status; /** * Name of reward that was redeemed to create this coupon. * @readonly */ rewardName?: string; /** * Revision number, which increments by 1 each time the loyalty coupon is updated. * * To prevent conflicting changes, the current `revision` must be passed when updating the loyalty coupon. */ revision?: string | null; /** * Date and time the loyalty coupon was created. * @readonly */ createdDate?: Date | null; /** * Date and time the loyalty coupon was last updated. * @readonly */ updatedDate?: Date | null; } export interface CouponReference { /** * Coupon ID. * @readonly */ couponId?: string; /** * Coupon code. * * Unique code entered by a customer to apply the coupon. * @readonly */ code?: string; /** * Name of coupon. * @readonly */ name?: string | null; /** * The information to use when creating the coupon. * @readonly */ specification?: Specification; /** * Whether the referenced coupon was deleted. * @readonly */ deleted?: boolean | null; } export interface Specification extends SpecificationTypeDetailsOneOf, SpecificationScopeOrMinSubtotalOneOf { /** Fixed price discount. */ moneyOffAmount?: number; /** Discount as a percentage. */ percentOffRate?: number; /** Free shipping. If true, the coupon applies to all items in all `namespaces` in the site. */ freeShipping?: boolean; /** Specific sale price. Currently only supported for coupons with a `stores` `namespace`. */ fixedPriceAmount?: number; /** * Free products when making a purchase. `buyXGetY` is an object that specifies `x` and `y` in the * following scenario: if a visitor purchases x number of products, they receive y number of products for free. C * urrently only supported for coupons with a `stores` `namespace`. */ buyXGetY?: BuyXGetY; /** * Scope of the coupon. When no scope is defined, the coupon applies to all * items in all `namespaces` in the site. */ scope?: Scope; /** The coupon is only applicable when the order subtotal is over this amount. */ minimumSubtotal?: number | null; /** Name of coupon. */ name?: string | null; type?: Type; /** * Whether the coupon is limited to 1 discount per order. If true and a customer pays for multiple items * that the coupon applies to, only the lowest priced item is discounted. * Coupons with a `bookings` `namespace` are always limited to 1 item. */ limitedToOneItem?: boolean | null; /** Whether the coupon also applies to subscriptions. */ appliesToSubscriptions?: boolean | null; /** * Specifies the amount of cycles to apply the discount to for a subscription item. * * Can only be set when `appliesToSubscriptions` is `TRUE` and `specification.scope.namespace` is `pricingPlans`. * If `discountedCycleCount` is empty, the coupon applies to all available cycles. * * Min: `1` * * Max: `999` */ discountedCycleCount?: number | null; } /** @oneof */ export interface SpecificationTypeDetailsOneOf { /** Fixed price discount. */ moneyOffAmount?: number; /** Discount as a percentage. */ percentOffRate?: number; /** Free shipping. If true, the coupon applies to all items in all `namespaces` in the site. */ freeShipping?: boolean; /** Specific sale price. Currently only supported for coupons with a `stores` `namespace`. */ fixedPriceAmount?: number; /** * Free products when making a purchase. `buyXGetY` is an object that specifies `x` and `y` in the * following scenario: if a visitor purchases x number of products, they receive y number of products for free. C * urrently only supported for coupons with a `stores` `namespace`. */ buyXGetY?: BuyXGetY; } /** @oneof */ export interface SpecificationScopeOrMinSubtotalOneOf { /** * Scope of the coupon. When no scope is defined, the coupon applies to all * items in all `namespaces` in the site. */ scope?: Scope; /** The coupon is only applicable when the order subtotal is over this amount. */ minimumSubtotal?: number | null; } export declare enum Type { UNKNOWN = "UNKNOWN", MONEY_OFF_AMOUNT = "MONEY_OFF_AMOUNT", PERCENT_OFF_RATE = "PERCENT_OFF_RATE", FREE_SHIPPING = "FREE_SHIPPING", FIXED_PRICE_AMOUNT = "FIXED_PRICE_AMOUNT", BUY_X_GET_Y = "BUY_X_GET_Y" } export interface BuyXGetY { /** Number of purchased items required to receive free items. */ x?: number; /** Number of items received for free if required number of items were purchased. */ y?: number; } export interface Scope { /** * Group within a `namespace` for which the coupon is applicable. * * If no group is specified, the coupon applies to all items in the namespace. * `group` is required in some namespaces. See [Scope Values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values) * for a list of currently supported groups for each namespace. */ name?: string | null; /** * ID of the specific entity in the group for which the coupon is applicable. * * If no `entityId` is specified, the coupon applies to all entities in the group. In some cases when a group is specified, * an `entityId` is required. See [Scope Values](https://dev.wix.com/api/rest/coupons/coupons/valid-scope-values) * for a list of currently supported entities for each namespace and group. */ entityId?: string | null; /** * Wix application for which the coupon is applicable. * * One of the following: * + `"stores"` * + `"bookings"` * + `"events"` * + `"pricingPlans"` */ namespace?: string; } export declare enum Status { /** Unknown status. */ UNKNOWN = "UNKNOWN", /** The reference coupon was created but the loyalty points have not been redeemed yet. */ PENDING = "PENDING", /** The reference coupon is active and available to the customer. */ ACTIVE = "ACTIVE", /** The reference coupon was applied and is no longer available for use. */ APPLIED = "APPLIED", /** The reference coupon was created but something went wrong when redeeming points from the loyalty account. */ FAILED = "FAILED", /** The reference coupon was deleted. */ ARCHIVED = "ARCHIVED" } export interface RedeemPointsForCouponRequest { /** ID of the [loyalty reward](https://dev.wix.com/docs/rest/crm/loyalty-program/rewards/reward-object) to redeem. */ rewardId: string; /** ID of the [loyalty account](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/account-object) of the customer redeeming points. */ loyaltyAccountId: string; } export interface RedeemPointsForCouponResponse { /** Created loyalty coupon. */ coupon?: LoyaltyCoupon; } export interface RedeemCurrentMemberPointsForCouponRequest { /** ID of the [loyalty reward](https://dev.wix.com/docs/rest/crm/loyalty-program/rewards/reward-object) to redeem. */ rewardId: string; } export interface RedeemCurrentMemberPointsForCouponResponse { /** Created loyalty coupon. */ coupon?: LoyaltyCoupon; } export interface RedeemMemberPointsForDiscountAmountCouponRequest { /** ID of the [loyalty reward](https://dev.wix.com/api/rest/wix-loyalty-program/rewards) to redeem. */ rewardId?: string; /** Loyalty account id. */ loyaltyAccountId?: string; /** Number of points to redeem. */ pointsToRedeem?: number; /** Coupon specification. */ specification?: Specification; } export interface RedeemMemberPointsForDiscountAmountCouponResponse { /** Created loyalty coupon. */ coupon?: LoyaltyCoupon; /** Transaction id of the coupon redemption */ transactionId?: string; } export interface GetLoyaltyCouponRequest { /** ID of the loyalty coupon to retrieve. */ loyaltyCouponId: string; } export interface GetLoyaltyCouponResponse { /** Retrieved loyalty coupon. */ loyaltyCoupon?: LoyaltyCoupon; } export interface BulkGetLoyaltyCouponRequest { /** Query to filter loyalty coupons. */ query?: CursorQuery; } export interface CursorQuery extends CursorQueryPagingMethodOneOf { /** * Cursor paging options. * * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging). */ cursorPaging?: CursorPaging; /** * Filter object. * * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section). */ filter?: Record | null; /** * Sort object. * * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section). */ sort?: Sorting[]; } /** @oneof */ export interface CursorQueryPagingMethodOneOf { /** * Cursor paging options. * * Learn more about [cursor paging](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#cursor-paging). */ cursorPaging?: CursorPaging; } export interface Sorting { /** Name of the field to sort by. */ fieldName?: string; /** Sort order. */ order?: SortOrder; } export declare enum SortOrder { ASC = "ASC", DESC = "DESC" } export interface CursorPaging { /** Maximum number of items to return in the results. */ 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. */ cursor?: string | null; } export interface BulkGetLoyaltyCouponResponse { /** Retrieved loyalty coupons. */ couponsInSite?: CouponsInSite[]; } export interface CouponsInSite { /** Metasite id */ metaSiteId?: string; /** Retrieved loyalty coupons. */ loyaltyCoupons?: LoyaltyCoupon[]; } export interface GetCurrentMemberCouponsRequest { } export interface GetCurrentMemberCouponsResponse { /** Retrieved loyalty coupons. */ loyaltyCoupons?: LoyaltyCoupon[]; } export interface QueryLoyaltyCouponRequest { /** Query options. */ query: QueryV2; } export interface QueryV2 extends QueryV2PagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; /** * Filter object. * * Learn more about the [filter section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-filter-section). */ filter?: Record | null; /** * Sort object. * * Learn more about the [sort section](https://dev.wix.com/docs/rest/articles/getting-started/api-query-language#the-sort-section). */ sort?: Sorting[]; /** Array of projected fields. A list of specific field names to return. If `fieldsets` are also specified, the union of `fieldsets` and `fields` is returned. */ fields?: string[]; /** Array of named, predefined sets of projected fields. A array of predefined named sets of fields to be returned. Specifying multiple `fieldsets` will return the union of fields from all sets. If `fields` are also specified, the union of `fieldsets` and `fields` is returned. */ fieldsets?: string[]; } /** @oneof */ export interface QueryV2PagingMethodOneOf { /** Paging options to limit and skip the number of items. */ paging?: Paging; /** Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. */ cursorPaging?: CursorPaging; } export interface Paging { /** Number of items to load. */ limit?: number | null; /** Number of items to skip in the current sort order. */ offset?: number | null; } export interface QueryLoyaltyCouponResponse { /** Retrieved loyalty coupons. */ loyaltyCoupons?: LoyaltyCoupon[]; /** Metadata. */ metadata?: PagingMetadataV2; } export interface PagingMetadataV2 { /** Number of items returned in the response. */ count?: number | null; /** Offset that was requested. */ offset?: number | null; /** Total number of items that match the query. Returned if offset paging is used and the `tooManyToCount` flag is not set. */ total?: number | null; /** Flag that indicates the server failed to calculate the `total` field. */ tooManyToCount?: boolean | null; /** Cursors to navigate through the result pages using `next` and `prev`. Returned if cursor paging is used. */ cursors?: Cursors; } export interface Cursors { /** Cursor string pointing to the next page in the list of results. */ next?: string | null; /** Cursor pointing to the previous page in the list of results. */ prev?: string | null; } export interface DeleteLoyaltyCouponRequest { /** ID of the loyalty coupon to delete. */ id: string; /** * Revision number, which increments by 1 each time the loyalty coupon is updated. * * To prevent conflicting changes, the current `revision` must be passed when updating the loyalty coupon. */ revision?: string; } export interface DeleteLoyaltyCouponResponse { } export interface DomainEvent extends DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; /** * Unique event ID. * Allows clients to ignore duplicate webhooks. */ id?: string; /** * Assumes actions are also always typed to an entity_type * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction */ entityFqdn?: string; /** * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug) * This is although the created/updated/deleted notion is duplication of the oneof types * 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 defining the order of updates to the underlying entity. * For example, given that some entity was updated at 16:00 and than again at 16:01, * it is guaranteed that the sequence number of the second update is strictly higher than the first. * As the consumer, you can use this value to ensure that you handle messages in the correct order. * To do so, you will need to persist this number on your end, and compare the sequence number from the * message against the one you have stored. Given that the stored number is higher, you should ignore the message. */ entityEventSequence?: string | null; } /** @oneof */ export interface DomainEventBodyOneOf { createdEvent?: EntityCreatedEvent; updatedEvent?: EntityUpdatedEvent; deletedEvent?: EntityDeletedEvent; actionEvent?: ActionEvent; } export interface EntityCreatedEvent { entityAsJson?: string; /** Indicates the event was triggered by a restore-from-trashbin operation for a previously deleted entity */ restoreInfo?: RestoreInfo; } export interface RestoreInfo { deletedDate?: Date | null; } export 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. */ currentEntityAsJson?: string; } export interface EntityDeletedEvent { /** Entity that was deleted */ deletedEntityAsJson?: string | null; } export interface ActionEvent { bodyAsJson?: string; } export interface Empty { } export interface MessageEnvelope { /** App instance ID. */ instanceId?: string | null; /** Event type. */ eventType?: string; /** The identification type and identity data. */ identity?: IdentificationData; /** Stringify payload. */ data?: string; } export interface IdentificationData extends IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; /** @readonly */ identityType?: WebhookIdentityType; } /** @oneof */ export interface IdentificationDataIdOneOf { /** ID of a site visitor that has not logged in to the site. */ anonymousVisitorId?: string; /** ID of a site visitor that has logged in to the site. */ memberId?: string; /** ID of a Wix user (site owner, contributor, etc.). */ wixUserId?: string; /** ID of an app. */ appId?: string; } export declare enum WebhookIdentityType { UNKNOWN = "UNKNOWN", ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR", MEMBER = "MEMBER", WIX_USER = "WIX_USER", APP = "APP" } interface BuyXGetYNonNullableFields { x: number; y: number; } interface ScopeNonNullableFields { namespace: string; } interface SpecificationNonNullableFields { moneyOffAmount: number; percentOffRate: number; freeShipping: boolean; fixedPriceAmount: number; buyXGetY?: BuyXGetYNonNullableFields; scope?: ScopeNonNullableFields; type: Type; } interface CouponReferenceNonNullableFields { couponId: string; code: string; specification?: SpecificationNonNullableFields; } interface LoyaltyCouponNonNullableFields { id: string; accountId: string; memberIdDeprecated: string; couponReference?: CouponReferenceNonNullableFields; status: Status; rewardName: string; } export interface RedeemPointsForCouponResponseNonNullableFields { coupon?: LoyaltyCouponNonNullableFields; } export interface RedeemCurrentMemberPointsForCouponResponseNonNullableFields { coupon?: LoyaltyCouponNonNullableFields; transactionId: string; } export interface GetLoyaltyCouponResponseNonNullableFields { loyaltyCoupon?: LoyaltyCouponNonNullableFields; } interface CouponsInSiteNonNullableFields { metaSiteId: string; loyaltyCoupons: LoyaltyCouponNonNullableFields[]; } export interface BulkGetLoyaltyCouponResponseNonNullableFields { couponsInSite: CouponsInSiteNonNullableFields[]; } export interface GetCurrentMemberCouponsResponseNonNullableFields { loyaltyCoupons: LoyaltyCouponNonNullableFields[]; } export interface QueryLoyaltyCouponResponseNonNullableFields { loyaltyCoupons: LoyaltyCouponNonNullableFields[]; } export {};