Documentation
Feedback
Guides

Integrating a new gift card provider

Linking the boilerplate code

1.Download from github. 2.Create a workspace (giftcard in the example). 3.Link the code.

All mock routes will be available in /my-provider.

Setting up for development

List All GiftCard Providers from Gift Card Hub should have only native Gift Card.


_12
[
_12
{
_12
"id": "VtexGiftCard",
_12
"serviceUrl": "http://api.vtex.com/cosmetics2",
_12
"oauthProvider": "vtex",
_12
"preAuthEnabled": true,
_12
"cancelEnabled": true,
_12
"_self": {
_12
"href": "cosmetics2/giftcardproviders/VtexGiftCard"
_12
}
_12
}
_12
]

Create/Update GiftCard Provider by ID from Gift Card Hub should let you add your own.


_10
{
_10
"serviceUrl": "https://giftcard--cosmetics2.myvtex.com/my-provider",
_10
"oauthProvider": "vtex",
_10
"preAuthEnabled": true,
_10
"cancelEnabled": true
_10
}

Once it is there, your store's Checkout will use the serviceUrl to make requests. You should do this in a test account so it does not break anyone.

Testing the mock provider

Buy some product, you should see the mock gift card there.

Where each route is called

{"base64":"  ","img":{"width":1682,"height":1400,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":106006,"url":"https://cdn.jsdelivr.net/gh/vtexdocs/dev-portal-content@main/images/gift-card-integration-guide-provider-protocol-0.png"}}
This is what is needed to make Gift Card available in checkout:

List cards

When a customer reaches the payment step, checkout will make a request to List All GiftCards in order to display a list of options for the customer.

Use card

When a customer selects a gift card, checkout will make a request to Get GiftCard by ID.

Order Placed

Once the order is placed, checkout will make a request to Create GiftCard Transaction to create a transaction.

This is what is needed to make Gift Card fully integrated with orders:

Cancel

Create GiftCard Transaction Cancellation

Invoice

This is expected, but not required by any existing process:

Create GiftCard

List All GiftCard Transactions

Contributors
3
Photo of the contributor
Photo of the contributor
Photo of the contributor
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
3
Photo of the contributor
Photo of the contributor
Photo of the contributor
On this page