About the Wix eCommerce Gift Vouchers Service Plugin

The Wix eCommerce Gift Vouchers Provider Service Plugin allows you to integrate with Wix as a gift card service provider, enabling Wix merchants to utilize your gift card functionalities directly on their sites, providing a seamless experience for their customers.

Important:

The Wix eCommerce Gift Cards service plugin is exposed here as the Wix eCommerce Gift Vouchers service plugin due to npm package limitations. Individual methods will refer to gift cards rather than gift vouchers.

By integrating your service with Wix, you can facilitate key gift card operations such as balance retrieval, redemption, and voiding transactions. These operations are seamlessly integrated into the site's checkout page, enhancing the overall customer experience.

The integration process involves creating an app in the Wix App Market via the Wix Dev Center, and configuring the Gift Vouchers Provider service plugin extension.

Terminology

  • Redeem: Applying a gift card balance to a purchase, including subtracting the applied value from the gift card balance.
  • Void: Reversing a redeem action and returning the applied value to the gift card balance.

Get started

Follow these steps to begin implementing your service plugin:

Step 1| Choose a framework

You can implement this service plugin with the following frameworks:

Step 2| Configure your service plugin

To configure and customize your plugin, you need to provide important information in the service plugin configuration file. You can configure your plugin in the Wix Dev Center. For details, see Gift Vouchers Provider Extension Configuration.

Step 3| Define handler functions

Use giftVouchersProvider.provideHandlers() to define the following handler functions that implement your custom business logic. Make sure you define all required functions.

FunctionRequired
getbalance()Yes
redeem()Yes
_void()Yes

Code examples

Below is an example for implementing the Gift Vouchers Provider service plugin in your code.

CLI: Basic code structure

This is the basic code structure for implementing the Gift Vouchers Provider service plugin with the Wix CLI:

Copy

Self-hosted: Basic code structure

This is the basic code structure for implementing a self-hosted Gift Vouchers Provider service plugin:

Copy

See also

Did this help?

Extension Config


To configure and customize your service plugin, you need to provide important details in the plugin.json configuration file.

Note

If you created your service plugin extension with the CLI, required fields are automatically populated for you.

Configuration Params
deploymentUristring

Base URI where the endpoints are called. Wix eCommerce appends the endpoint path to the base URI. For example, to call the Get Balance endpoint at https://my-gift-cards.com/v1/balance, the base URI you provide here is https://my-gift-cards.com/.

Did this help?

_void( )


Important: This is a handler function. Implement it only as part of the service plugin.


This method requests that a gift card transaction be voided by your app. Wix calls this method when a purchase fails after gift card redemption.

Method Declaration
Copy
Method Parameters
payload_voidEnvelope
Returns
Return Type:VoidResponse | Promise<VoidResponse>
Did this help?

getBalance( )


Important: This is a handler function. Implement it only as part of the service plugin.


This method retrieves gift card data from your app. Wix calls this method when a customer applies a gift card as a payment method at checkout.

Method Declaration
Copy
Method Parameters
payloadGetBalanceEnvelope
Returns
Return Type:GetBalanceResponse | Promise<GetBalanceResponse>
Errors
GiftCardDisabledWixErrorclass
GiftCardExpiredWixErrorclass
GiftCardNotFoundWixErrorclass
Did this help?

redeem( )


Important: This is a handler function. Implement it only as part of the service plugin.


This method requests that a transaction be created by your app. Wix calls this method when a customer completes a purchase that includes a gift card as a payment method at checkout.

Method Declaration
Copy
Method Parameters
payloadRedeemEnvelope
Returns
Return Type:RedeemResponse | Promise<RedeemResponse>
Errors
AlreadyRedeemedWixErrorclass
CurrencyNotSupportedWixErrorclass
GiftCardDisabledWixErrorclass
GiftCardExpiredWixErrorclass
GiftCardNotFoundWixErrorclass
InsufficientFundsWixErrorclass
Did this help?