The Wix eCommerce Gift Cards 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.
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 Studio workspace, and configuring the Gift Cards Provider service plugin extension.
It's important to ensure that your implementation of the gift cards provider service plugin endpoints adheres to the provided specifications.
Implementation of this Service Plugin is dependent on configuration of the eCommerce Gift Cards Provider extension in the app dashboard:
Name | Type | Description |
---|---|---|
deploymentUri | string | Required. Base URI where the endpoints are called. Wix eCommerce appends the endpoint path to the base URI. For example, to call the Balance Retrieval endpoint at https://my-gift-cards.com/v1/getBalance , the base URI you provide here is https://my-gift-cards.com/ . |
componentName | string | Unique name for this component, that appears only in the app dashboard. |
Configuration setup: When a site owner installs and authorizes your app to provide gift card operations, Wix will send a JSON Web Token (JWT) with an instance ID to your deployment URI + endpoint path. The app should collect the JWT, decode it, and store the resulting instance ID.
For example, the token in this request:
$ curl -X POST https://ext-server.com/wix-spi/account-ids
-H 'Content-Type: plain/text'
-d 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpbnN0YW5jZUlkIjoiMDQ0NjY3ZjQtYzEzZi00NmMyLTg1MDYtZGU5ZTQyMjkzODk2In0.fxedHrnHUFi6V- S5OH8gL-pY4STxFWZHjj-xo9QUwQY'
Decodes into:
{ "instanceId": "044667f4-c13f-46c2-8506-de9e42293896" }
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.
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:
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.
The Wix site sends a Get Balance request to your app with the code
, app_instance_id
, and optionally location_id
.
Example request:
{
"code": "GIFT-CARD-CODE-123",
"app_instance_id": "044667f4-c13f-46c2-8506-de9e42293896",
"location_id": "store-location-001"
}
Your app processes the request and returns the current balance and currency of the customer's gift card.
Example response:
{
"balance": 50.0,
"currency_code": "USD"
}
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.
Continuing the example from above, the customer continues with the checkout flow:
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.
The Wix site sends a Redeem Gift Card request to your app with the code
, amount
, order_id
, currency_code
, and optionally location_id
.
Example request:
{
"code": "GIFT-CARD-CODE-123",
"app_instance_id": "044667f4-c13f-46c2-8506-de9e42293896",
"amount": 50.0,
"order_id": "00000000-0000-0000-0000-000000000001",
"currency_code": "USD",
"location_id": "store-location-001"
}
Your app processes the request and returns the remaining balance, currency, and transaction ID of the redeem operation.
Example response:
{
"remaining_balance": 0.0,
"currency_code": "USD",
"transaction_id": "00000000-0000-0000-0000-000000000001"
}
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.
Continuing the example from above, the customer chooses to complete the checkout flow:
After the gift card was redeemed, the customer's credit card payment is processed, and fails.
The Wix site sends a Void request to your app with the transaction_id
, and optionally location_id
, in order to restore the redeemed amount to the gift card balance.
Example request:
{
"transaction_id": "00000000-0000-0000-0000-000000000001",
"app_instance_id": "044667f4-c13f-46c2-8506-de9e42293896",
"location_id": "store-location-001"
}
Your app processes the request and returns the remaining balance and currency of the gift card after the void operation.
Example response:
{
"remaining_balance": 50.0,
"currency_code": "USD"
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
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.
Gift card code.
App ID of the Gift Card provider. Deprecated.
The physical location ID. Can be based on the Locations API or an external provider.
Current balance.
Currency code.
External ID in the gift card provider's system. Used for integration and tracking across different platforms.
The data payload will include the following object as an encoded JWT. For the purposes of this example, we show the request and response objects decoded.
curl -X POST \
'http://provider.example.com/v1/balance' \
-H 'user-agent: Wix' \
-H 'accept-encoding: gzip, deflate' \
-H 'content-type: text/plain; charset=utf-8' \
-d '{
"code": "GIFT-CARD-CODE-123",
"appInstanceId": "044667f4-c13f-46c2-8506-de9e42293896",
}'
{
"balance": 100.0,
"currencyCode": "USD"
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
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.
Gift card code.
App ID of the Gift Card provider. Deprecated.
Amount to redeem from the gift card.
Order ID the gift card transaction is applied to. Order details can be collected from eCommerce Search Orders.
Currency code.
Physical location ID. Can be based on the Locations API or an external provider.
Remaining balance on the Gift Card after the redemption.
Currency code.
Transaction ID.
The data payload will include the following object as an encoded JWT. For the purposes of this example, we show the request and response objects decoded.
curl -X POST \
'http://provider.example.com/v1/redeem' \
-H 'user-agent: Wix' \
-H 'accept-encoding: gzip, deflate' \
-H 'content-type: text/plain; charset=utf-8' \
-d '{
"code": "GIFT-CARD-CODE-123",
"appInstanceId":"044667f4-c13f-46c2-8506-de9e42293896",
"amount": 20.00,
"currencyCode": "USD",
"orderId": "00000000-0000-0000-0000-000000000001"
}'
{
"remainingBalance": 80.00,
"currencyCode": "USD",
"transactionId: "00000000-0000-0000-0000-000000000001"
}
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
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.
App ID of the Gift Card provider. Deprecated.
Transaction ID to void.
Physical location ID. Can be based on the Locations API or an external provider.
Remaining balance on the Gift Card after voiding the transaction.
Currency code.
The data payload will include the following object as an encoded JWT. For the purposes of this example, we show the request and response objects decoded.
curl -X POST \
'http://provider.example.com/v1/void' \
-H 'user-agent: Wix' \
-H 'accept-encoding: gzip, deflate' \
-H 'content-type: text/plain; charset=utf-8' \
-d '{
"transactionId": "00000000-0000-0000-0000-000000000001"
}'
{
"remainingBalance": 100.0,
"currencyCode": "USD"
}