> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: Sample Flows ## Article: Sample Flows ## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/payments/gift-cards/gift-cards-service-plugin/sample-flows.md ## Article Content: # Sample Flow
__Important:__ - The Wix eCommerce Gift Cards service plugin is available for both REST and SDK integrations. Due to npm package naming limitations, the SDK version is named "Gift Vouchers service plugin". Both names refer to the same extension and provide identical functionality, and may be used interchangeably throughout this sample flow.
This article shares some typical use cases you can support, as well as an example flow that supports each use case. You're certainly not limited to these use cases, but they can be a helpful jumping off point as you plan your implementation. ## Retrieve a Gift Card Balance When a customer begins the checkout flow on a Wix site for a purchase of $100 USD, and they have a gift card balance of $50 USD: 1. A customer chooses to use their gift card to pay for their $100 purchase, enters the gift card code in the designated slot, and clicks **Apply**. 2. The Wix site sends a [Get Balance](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/payments/gift-cards/gift-cards-service-plugin/sample-flows.md) request to your app with the `code`, `appInstanceId`, and optionally `locationId`. Example request object: ```json { "code": "GIFT-CARD-CODE-123", "appInstanceId": "044667f4-c13f-46c2-8506-de9e42293896", "locationId": "store-location-001" } ``` 3. Your app processes the request and returns the current balance and currency of the customer's gift card. Example response: ```json { "balance": 50.00, "currencyCode": "USD" } ``` 4. The Wix site displays the balance to the customer as part of the price summary at Checkout, as though the gift card is used for the purchase. ## Redeem a Gift Card Continuing the example from above, the customer continues with the checkout flow: 1. The customer decides to use their gift card balance toward their purchase, enters credit card details to cover the remaining $50, and clicks **Place Order**. 2. The Wix site sends a [Redeem Gift Card](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/payments/gift-cards/gift-cards-service-plugin/redeem.md) request to your app with the `code`, `amount`, `orderId`, `currencyCode`, and optionally `locationId`. Example request: ```json { "code": "GIFT-CARD-CODE-123", "appInstanceId": "044667f4-c13f-46c2-8506-de9e42293896", "amount": 50.00, "orderId": "00000000-0000-0000-0000-000000000001", "currencyCode": "USD", "locationId": "store-location-001" } ``` 3. Your app processes the request and returns the remaining balance, currency, and transaction ID of the redeem operation. Example response: ```json { "remainingBalance": 0.00, "currencyCode": "USD", "transactionId": "00000000-0000-0000-0000-000000000001" } ``` 4. The customer's payment is processed, and they receive a confirmation showing that $50 has been deducted from his gift card, leaving a balance of $0. ## Void a Transaction Continuing the example from above, the customer chooses to complete the checkout flow: 1. After the gift card was redeemed, the customer's credit card payment is processed, and **fails**. 2. The Wix site sends a [Void](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/payments/gift-cards/gift-cards-service-plugin/void.md) request to your app with the `transactionId`, and optionally `locationId`, in order to restore the redeemed amount to the gift card balance. Example request: ```json { "transactionId": "00000000-0000-0000-0000-000000000001", "appInstanceId": "044667f4-c13f-46c2-8506-de9e42293896", "locationId": "store-location-001" } ``` 3. Your app processes the request and returns the remaining balance and currency of the gift card after the void operation. Example response: ```json { "remainingBalance": 50.00, "currencyCode": "USD" } ```