Giftcard flows

Introduction

Here we describe how to use Inswitch APIs to generate and use Giftcards.

Authentication

Authentication API is used to get an access_token required for {giftcards} API.

384

Create a Giftcard

Two options for creating a giftcard are offered:

  • Inactive (status: "initial")
  • Active (ready for usage, status: "active")

Create an inactive Giftcard

curl --location --request POST 'https://{baseUrl}/giftcard/1.0/cards' \
--header 'X-User-Bearer: Bearer {{access_token}} ' \
--header 'Content-Type: application/json' \
--header 'apikey: {{apikey}}' \
--data-raw '{
    "productId": "Summer_2022",
    "name": "Campaign_January",
    "amount": "100.00",
    "currency": "UYU",
    "country": "UY",
    "externalId": "order.202103"
}'
{
    "cardIdentifier": "4",
    "codes": {
        "plain": "lDcrVKmQPrdB9zFB",
        "qrcode": "https://barcode.tec-it.com/en/QRCode?data=lDcrVKmQPrdB9zFB",
        "barcode": "https://barcode.tec-it.com/en/Code128?data=lDcrVKmQPrdB9zFB"
    },
    "creationDate": "2022-01-10T21:56:47Z",
    "status": "initial",
    "currentBalance": "100.00",
    "productId": "Summer_2022",
    "name": "Campaign_January",
    "amount": "100.00",
    "currency": "UYU",
    "country": "UY",
    "externalId": "order.202103"
}

Create an active and funded Giftcard

curl --location --request POST 'https://{baseUrl}}/giftcard/1.0/cards' \
--header 'accept: application/json' \
--header 'X-User-Bearer: Bearer {{access_token}} ' \
--header 'Content-Type: application/json' \
--header 'apikey: {{apikey}}' \
--data-raw '{
    "productId": "Summer_2022",
    "name": "Campaign_January",
    "amount": "500.00",
    "currency": "UYU",
    "country": "UY",
    "externalId": "order.202102",
      "activation": {
            "startDate": "2022-01-11T22:00:14Z",
            "endDate": "2022-01-13T22:00:14Z",
            "entity": "21",
            "issuerPaymentMethodReference": "3630373234392D313030312D31303136",
            "singleUse": true
        }
}'
{
    "cardIdentifier": "3",
    "codes": {
        "plain": "SqxKVwl1Bn0mNzBM",
        "qrcode": "https://barcode.tec-it.com/en/QRCode?data=SqxKVwl1Bn0mNzBM",
        "barcode": "https://barcode.tec-it.com/en/Code128?data=SqxKVwl1Bn0mNzBM"
    },
    "creationDate": "2022-01-10T21:54:19Z",
    "status": "active",
    "currentBalance": "500.00",
    "productId": "Summer_2022",
    "name": "Campaign_January",
    "amount": "500.00",
    "currency": "UYU",
    "country": "UY",
    "externalId": "order.202102",
    "activation": {
        "startDate": "2022-01-01T00:00:00Z",
        "endDate": "2022-01-31T00:00:00Z",
        "entity": "21",
        "issuerPaymentMethodReference": "3334393732382D313030302D31303230",
        "singleUse": false
    }
}

Activate a Giftcard

If the giftcard is not activated during its creation, it can be activated using the activation endpoint:

Activate Giftcard

curl --location --request PUT 'https://{{baseUrl}}/giftcard/1.0/cards/{cardReference}/activation' \
--header 'accept: application/json' \
--header 'X-User-Bearer: Bearer {{access_token}} ' \
--header 'Content-Type: application/json' \
--header 'apikey: {{apikey}}' \
--data-raw '{
  "startDate": "2022-01-10T22:00:14.842Z",
  "endDate": "2022-01-10T22:00:14.842Z",
  "entity": "21",
  "issuerPaymentMethodReference": "3334393732382D313030302D31303230",
  "singleUse": true
}'

Query a Giftcard

The Query operation is used to retrieve giftcard details.

Query Gifcard

curl --location --request GET 'https://{baseUrl}/giftcard/1.0/cards/{cardReference}' \
--header 'accept: application/json' \
--header 'X-User-Bearer: Bearer {{access_token}} ' \
--header 'apikey:{{apikey}}' \

{
    "cardIdentifier": "1",
    "codes": {
        "plain": "F10QtaBakoFpFj3d",
        "qrcode": "https://barcode.tec-it.com/en/QRCode?data=F10QtaBakoFpFj3d",
        "barcode": "https://barcode.tec-it.com/en/Code128?data=F10QtaBakoFpFj3d"
    },
    "creationDate": "2022-01-10T20:57:32Z",
    "status": "inactive",
    "currentBalance": "100",
    "productId": "Summer_2022",
    "name": "Campaign_January",
    "amount": "100",
    "currency": "UYU",
    "country": "UY",
    "externalId": "order.202101",
    "activation": {
        "startDate": "2022-01-01T03:00:00Z",
        "endDate": "2022-01-31T03:00:00Z",
        "entity": "21",
        "issuerPaymentMethodReference": "3334393732382D313030302D31303230",
        "singleUse": false
    }
}

Disable a Giftcard

The deactivation is not reversible.

Deactivate Giftcard

curl --location --request PUT 'https://{baseUrl}/giftcard/1.0/cards/{cardReference}/deactivation' \
--header 'X-User-Bearer: Bearer {{access_token}}' \
--header 'Content-Type: application/json' \
--header 'apikey: {{apikey}}' \
--data-raw ''
curl --location --request PUT 'https://gateway-am.apps.okd.inswhubts.com/giftcard/1.0/cards/id%403/deactivation' \
--header 'accept: application/json' \
--header 'X-User-Bearer: Bearer ' \
--header 'Content-Type: application/json' \
--header 'apikey: eyJ4NXQiOiJNV1ExTWpBMlpESm1PV1U1WXpjNFpUazFZelk1T1dVeU56SmtaV1l5TWpZNE5qa3pZVFkyWXpjNE9EY3lZMlprWmpGaVpHUmhNMkkyTUdFeU5qRmpaZyIsImtpZCI6Im9rZGF3cyIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0=.eyJzdWIiOiJoZWN0b3JwaDg1QGNhcmJvbi5zdXBlciIsImFwcGxpY2F0aW9uIjp7Im93bmVyIjoiaGVjdG9ycGg4NSIsInRpZXJRdW90YVR5cGUiOm51bGwsInRpZXIiOiIxMFBlck1pbiIsIm5hbWUiOiJ0ZXN0IiwiaWQiOjcxLCJ1dWlkIjoiZDYwZDVjNTEtMjFkYi00Yjc5LTk4ZDUtYTE2MWY2ZTVjNWM2In0sImlzcyI6Imh0dHBzOlwvXC9hcGltLW1hbmFnZW1lbnQuYXBwcy5pbnMuaW5zd2h1Yi5jb206NDQzXC9vYXV0aDJcL3Rva2VuIiwidGllckluZm8iOnsiQnJvbnplIjp7InRpZXJRdW90YVR5cGUiOiJyZXF1ZXN0Q291bnQiLCJncmFwaFFMTWF4Q29tcGxleGl0eSI6MCwiZ3JhcGhRTE1heERlcHRoIjowLCJzdG9wT25RdW90YVJlYWNoIjp0cnVlLCJzcGlrZUFycmVzdExpbWl0IjowLCJzcGlrZUFycmVzdFVuaXQiOm51bGx9LCJVbmxpbWl0ZWQiOnsidGllclF1b3RhVHlwZSI6InJlcXVlc3RDb3VudCIsImdyYX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