Setting the file. One moment.
Subchapter 2.76
references/service-plugin/GIFT-CARDS.mdMarkdown3 KBView on GitHub
The Gift Vouchers Provider SPI allows you to integrate external gift card or voucher systems with Wix eCommerce. This enables customers to redeem gift cards, check balances, and void transactions.
| Handler | Description |
|---|---|
redeem | Process a gift card redemption during checkout |
getBalance | Check the current balance of a gift card |
_void | Cancel/void a previous redemption |
Before implementing, call ReadFullDocsMethodSchema on each docs URL to get the full request/response types.
This example shows a basic gift card provider with all three required handlers.
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: metadata.currency || "ILS",
transactionId: "00000000-0000-0000-0000-000000000001",
};
},
_void: 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: 100.00,
currencyCode: metadata.currency || "ILS",
};
},
getBalance: 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:
balance: 100.00,
currencyCode: metadata.currency || "ILS",
};
},
});GIFT_CARDS_PROVIDER is singular — only one component of this type is allowed per app. Do not scaffold or include two Gift Cards service plugins in the same app.
redeem, getBalance, and _voidredeem handler must return a unique transactionId for tracking_void handler should restore the redeemed amount back to the cardmetadata.currency to get the site’s currency setting