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/.

Gift Vouchers Provider Extension Config
JSON
{ "deploymentUri": "https://my-gift-cards.com/" }
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
function redeem(
  payload: RedeemEnvelope,
): RedeemResponse | Promise<RedeemResponse>;
Method Parameters
payloadRedeemEnvelope
Returns
Return Type:RedeemResponse | Promise<RedeemResponse>
Example of an `giftVouchersProvider` return value @description:
JavaScript
import { giftVouchersProvider } from "@wix/ecom/service-plugins"; giftVouchersProvider.provideHandlers({ redeem: async (payload) => { const { request, metadata } = payload; // Use the `request` and `metadata` received from Wix and // apply custom logic. return { // Return your response exactly as documented to integrate with Wix. // Return value example: remainingBalance: "80.00", currencyCode: "USD", transactionId: "00000000-0000-0000-0000-000000000001", }; }, });
Errors
AlreadyRedeemedWixErrorclass
CurrencyNotSupportedWixErrorclass
GiftCardDisabledWixErrorclass
GiftCardExpiredWixErrorclass
GiftCardNotFoundWixErrorclass
InsufficientFundsWixErrorclass
Did this help?