Skip to main content

Gift Cards Documentation

Gift Card APIs allow developers to manage gift cards for a user.

Authentication

To use TS APIs, you will have to contact TS Gift Card support to request API credentials. After successful acceptance of your request, you will receive API credentials which will contain your email, password and TS Gift Card server URL.

How to use these credentials to consume APIs

To consume TS Gift Card APIs, you will have to append {ts_server_url} to each API endpoint along with the email and password you received from the TS Gift Card support team in the request headers.

How to use these credentials using postman.

Open postman, navigate to "Authorization" tab and select the type "Basic Auth" from the dropdown. Two field will appear with the lable Username and Password. Enter the client or frontdesk credentials(Email, Password).

Gift Card [/api/v1/gift_cards]

Get All Gift Cards Of a User [GET]

Use this API to get all the gift cards of a user. You can use the following filters to filter gift card data.

1) Gift Card Filters.

1) Product Name.
2) Sku.
3) Status.
4) Created at.
5) Expiry Date.


GET {:ts_server_url}/api/v1/gift_cards




######Request Payload:

You have to generate the JSON object containing the following query data, After creating JSON object, you have to convert that object into
JSON string.

Given below is the required payload:


    q = "{
        \"status_in\":[\"active\",\"initiated\",\"blocked\",\"canceled\"],
        \"number_or_product_name_cont\":null,
        \"skus_scope\":null,
        \"status_eq\":null,
        \"created_at_scope\":null,
        \"expiry_date_scope\":null
    }"

######Request Query Params:

######1) status_in.

This query param represents the status of a gift card, the card can be in 'active', 'initiated', 'blocked', or  'canceled' status. The above query payload will list all gift cards. If you want to filter results further, you will have to give values of other query params. To get only active gift cards, you will have to pass 'active' status in status_in param array.

######2) number_or_product_name_cont.

You can use this param to filter gift cards by giving either the gift card number or the product name to which the card is associated with.

######3) skus_scope.

This param allows you to filter data by giving SKUs of the products. Note, this param will be used if the gift card type is an Experience. 

######4) status_eq.

This query param represents the status of a gift card, the card can be in 'active', 'initiated', 'blocked', or 'canceled' status. But the difference between status_in and status_eq params is that status_in can take an array of statuses of type string, but status_eq takes exactly one status.
\"status_eq\": "active".

######5) created_at_scope.

You can use this param to get gift cards by the creation date of cards.

######6) expiry_date_scope.

You can use this query param to get all gift cards with a given expiry date.

######API Response:

{

"gift_cards": [
        {
          "id": 53,
          "number": "2925681115",
          "created_at": "2022-12-22T12:05:16.067Z",
          "status": "active",
          "expiry_date": "2023-01-18T12:05:16.055Z",
          "product_name": "Cara Thornton",
          "card_type": "experiences",
          "currency": "USD",
          "value": "123123.0",
          "campaign_id": 5,
          "order_number": "",
          "bonus": false,
          "campaign_code": "eaz-123",
          "stores": "TS-S1"
        },
        {
          "id": 52,
          "number": "3547120806",
          "created_at": "2022-12-22T11:24:46.621Z",
          "status": "active",
          "expiry_date": "2023-01-18T11:24:46.613Z",
          "product_name": "Igor Banks",
          "card_type": "experiences",
          "currency": "USD",
          "value": "1000.0",
          "campaign_id": 5,
          "order_number": "",
          "bonus": false,
          "campaign_code": "eaz-123",
          "stores": "TS-S1"
        },
    ]
}
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
          q = "{
                \"status_in\":[\"active\",\"initiated\",\"blocked\",\"canceled\"],
                \"number_or_product_name_cont\":null,
                \"skus_scope\":null,
                \"status_eq\":null,
                \"created_at_scope\":null,
                \"expiry_date_scope\":null
            }"
      
        } 
      
  • Response 201 (application/json)
+ Body

        {

          "gift_cards":[
                {
                  "id": 53,
                  "number": "2925681115",
                  "created_at": "2022-12-22T12:05:16.067Z",
                  "status": "active",
                  "expiry_date": "2023-01-18T12:05:16.055Z",
                  "product_name": "Cara Thornton",
                  "card_type": "experiences",
                  "currency": "USD",
                  "value": "123123.0",
                  "campaign_id": 5,
                  "order_number": "",
                  "bonus": false,
                  "campaign_code": "eaz-123",
                  "stores": "TS-S1"
                },
                {
                  "id": 52,
                  "number": "3547120806",
                  "created_at": "2022-12-22T11:24:46.621Z",
                  "status": "active",
                  "expiry_date": "2023-01-18T11:24:46.613Z",
                  "product_name": "Igor Banks",
                  "card_type": "experiences",
                  "currency": "USD",
                  "value": "1000.0",
                  "campaign_id": 5,
                  "order_number": "",
                  "bonus": false,
                  "campaign_code": "eaz-123",
                  "stores": "TS-S1"
                },
            ]
        }

Create a New Gift Card [POST]

POST {:ts_server_url}/api/v1/gift_cards

Use this API to create a gift card.

######Request Payload:

{
      "card_type": "monetary", 
      "value": "1000", 
      "currency": "USD", 
      "delivery_mode": "digital",
      "campaign_code": "eaz-123",
      "from_address": "wyfosykyp@mailinator.com",
      "invoice_id": "sk-123",
      "notes": "werwe",
      "product_name": "tesitng",
      "receipient_phone_number": "",
      "recipient_email": "wyfosykyp@mailinator.com",
      "recipient_first_name": "Darrel",
      "recipient_last_name": "Wiggins",
      "send_gift_card_via": "email",
      "skus": []
}

#####1) card_type. This param represents the type of card you want to update. Its type is a string and it could be either monetary or experience.

#####2) value. You can set the amount value of the card.

#####3) currency. This param represents the card currency.

#####4) delivery_mode. This param represents the delivery mode of a card, Its type is string and could contain either digital or physical.

#####5) campaign_code. Using this param you can set the campaign code for a gift card.

#####6) from_address. This param represents the sender's email address who is sending this card.

#####7) invoice_id. This param is used to set the invoice id generated for a gift card.

#####8) notes. You can set notes/comments for a gift card.

#####9) product_name. Using this param you can set the product name for which a card is redeemable.

#####10) receipient_phone_number. This param represents the recipient's phone number who is going to receive the gift card. The format for the phone number is country code + phone number ie +442012341234.

#####11) recipient_email. This param represents the recipient's email who is going to receive the gift card.

#####12) recipient_first_name. This param represents the recipient's first name.

#####13) recipient_last_name. This param represents the recipient's last name.

#####14) send_gift_card_via. This param is used to set how the card will be sent to the recipient, its type is a string and it could be either 'email', 'sms' or 'both'.

#####15) skus. This param is used to set the SKUs of gift cards. It is an array of SKUs you can send one, or more than one SKUs in array format.

######API Response:

    {

      "id": 56,
      "number": "6939974394",
      "pin": "76050",
      "currency": "USD",
      "card_type": "monetary",
      "expiry_date": "2023-01-29T13:55:55.837Z",
      "value": "1000.0",
      "skus": [],
      "status": "active",
      "user_id": 1,
      "campaign_id": 5,
      "created_at": "2023-01-02T13:55:55.838Z",
      "updated_at": "2023-01-02T13:55:55.838Z",
      "client_id": 1,
      "product_name": "tesitng",
      "delivery_mode": "digital",
      "delivery_status": "pending",
      "is_redeemed": false,
      "is_expired": false,
      "recipient_first_name": "Darrel",
      "recipient_last_name": "Wiggins",
      "recipient_email": "wyfosykyp@mailinator.com",
      "order_number": "",
      "send_email": false,
      "order_pay_load": "",
      "notes": "werwe",
      "invoice_id": 0,
      "from_address": "wyfosykyp@mailinator.com",
      "store_name": null,
      "customer_email": null,
      "barcode_key": "yxdpLEN3TZTMGBTz",
      "qrcode_key": "PQTOhvSESE4v1Anc",
      "spree_ts_giftcard_id": null,
      "bonus": false,
      "slug": "4e0c60b9-d8a8-41b7-b001-b6c19e54d9a6",
      "receipient_phone_number": "",
      "send_gift_card_via": "email",
      "serial_number": null,
      "campaign_body": "testing ",
      "image_url": "",
      "campaign_response": {
        "id": 5,
        "name": "eaz",
        "start_date": "2022-11-03T00:00:00.000Z",
        "end_date": "2023-12-31T00:00:00.000Z",
        "client_id": 1,
        "code": "eaz-123",
        "max_expiry_days": 27,
        "created_at": "2022-11-03T08:26:19.082Z",
        "updated_at": "2023-01-02T13:14:14.235Z",
        "date_specific_expiry": false,
        "email_subject": "eaz campaign",
        "email_html": "testing ",
        "specific_date": "2022-12-31T00:00:00.000Z",
        "body": "testing ",
        "sms_html": "testing ",
        "allow_password": true
      }
    }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

            {
                  "card_type": "monetary", "value": "1000", "currency": "USD", "delivery_mode": "digital",
                  "campaign_code": "eaz-123",
                  "card_type": "monetary",
                  "currency": "USD",
                  "delivery_mode": "digital",
                  "from_address": "wyfosykyp@mailinator.com",
                  "invoice_id": "sk-123",
                  "notes": "werwe",
                  "product_name": "tesitng",
                  "receipient_phone_number": "",
                  "recipient_email": "wyfosykyp@mailinator.com",
                  "recipient_first_name": "Darrel",
                  "recipient_last_name": "Wiggins",
                  "send_gift_card_via": "email",
                  "skus": [],
                  "value": "1000"
            }
      
  • Response 201 (application/json)
+ Body

       {
          "id": 56,
          "number": "6939974394",
          "pin": "76050",
          "currency": "USD",
          "card_type": "monetary",
          "expiry_date": "2023-01-29T13:55:55.837Z",
          "value": "1000.0",
          "skus": [],
          "status": "active",
          "user_id": 1,
          "campaign_id": 5,
          "created_at": "2023-01-02T13:55:55.838Z",
          "updated_at": "2023-01-02T13:55:55.838Z",
          "client_id": 1,
          "product_name": "tesitng",
          "delivery_mode": "digital",
          "delivery_status": "pending",
          "is_redeemed": false,
          "is_expired": false,
          "recipient_first_name": "Darrel",
          "recipient_last_name": "Wiggins",
          "recipient_email": "wyfosykyp@mailinator.com",
          "order_number": "",
          "send_email": false,
          "order_pay_load": "",
          "notes": "werwe",
          "invoice_id": 0,
          "from_address": "wyfosykyp@mailinator.com",
          "store_name": null,
          "customer_email": null,
          "barcode_key": "yxdpLEN3TZTMGBTz",
          "qrcode_key": "PQTOhvSESE4v1Anc",
          "spree_ts_giftcard_id": null,
          "bonus": false,
          "slug": "4e0c60b9-d8a8-41b7-b001-b6c19e54d9a6",
          "receipient_phone_number": "",
          "send_gift_card_via": "email",
          "serial_number": null,
          "campaign_body": "testing ",
          "image_url": "",
          "campaign_response": {
            "id": 5,
            "name": "eaz",
            "start_date": "2022-11-03T00:00:00.000Z",
            "end_date": "2023-12-31T00:00:00.000Z",
            "client_id": 1,
            "code": "eaz-123",
            "max_expiry_days": 27,
            "created_at": "2022-11-03T08:26:19.082Z",
            "updated_at": "2023-01-02T13:14:14.235Z",
            "date_specific_expiry": false,
            "email_subject": "eaz campaign",
            "email_html": "testing ",
            "specific_date": "2022-12-31T00:00:00.000Z",
            "body": "testing ",
            "sms_html": "testing ",
            "allow_password": true
          }
        }

Create a New Monetary Gift Card [POST /api/v1/gift_cards/create_monetary_card]

POST {:ts_server_url}/api/v1/gift_cards

Use this API to create a only monetary type gift card.

######Request Payload:

{
      "card_type": "monetary", 
      "value": "1000", 
      "currency": "USD", 
      "delivery_mode": "digital",
      "campaign_code": "eaz-123",
      "from_address": "wyfosykyp@mailinator.com",
      "invoice_id": "sk-123",
      "notes": "werwe",
      "product_name": "tesitng",
      "receipient_phone_number": "",
      "recipient_email": "wyfosykyp@mailinator.com",
      "recipient_first_name": "Darrel",
      "recipient_last_name": "Wiggins",
      "send_gift_card_via": "email",
      "skus": []
}

#####1) card_type. This param represents the type of card you want to update. Its type is a string and it could be either monetary or experience.

#####2) value. You can set the amount value of the card.

#####3) currency. This param represents the card currency.

#####4) delivery_mode. This param represents the delivery mode of a card, Its type is string and could contain either digital or physical.

#####5) campaign_code. Using this param you can set the campaign code for a gift card.

#####6) from_address. This param represents the sender's email address who is sending this card.

#####7) invoice_id. This param is used to set the invoice id generated for a gift card.

#####8) notes. You can set notes/comments for a gift card.

#####9) product_name. Using this param you can set the product name for which a card is redeemable.

#####10) receipient_phone_number. This param represents the recipient's phone number who is going to receive the gift card. The format for the phone number is country code + phone number ie +442012341234.

#####11) recipient_email. This param represents the recipient's email who is going to receive the gift card.

#####12) recipient_first_name. This param represents the recipient's first name.

#####13) recipient_last_name. This param represents the recipient's last name.

#####14) send_gift_card_via. This param is used to set how the card will be sent to the recipient, its type is a string and it could be either 'email', 'sms' or 'both'.

#####15) skus. This param is used to set the SKUs of gift cards. It is an array of SKUs you can send one, or more than one SKUs in array format.

**API Response:**
```
    {
        "id": 28071,
        "number": "935896188801023413",
        "pin": "24429",
        "currency": "USD",
        "card_type": "monetary",
        "expiry_date": "2025-10-14T00:00:00.000Z",
        "value": "1000.0",
        "skus": [],
        "status": "active",
        "user_id": 24,
        "campaign_id": 61,
        "created_at": "2024-08-18T06:38:49.603Z",
        "updated_at": "2024-08-18T06:38:49.603Z",
        "client_id": 3,
        "product_name": "tesitng",
        "delivery_mode": "digital",
        "delivery_status": "delivered",
        "is_redeemed": false,
        "is_expired": false,
        "recipient_first_name": "Darrel",
        "recipient_last_name": "Wiggins",
        "recipient_email": "wyfosykyp@mailinator.com",
        "order_number": "",
        "send_email": false,
        "order_pay_load": "",
        "notes": "werwe",
        "invoice_id": "sk-123",
        "from_address": "wyfosykyp@mailinator.com",
        "store_name": null,
        "customer_email": null,
        "barcode_key": "UT764xIqPatTsAl0",
        "qrcode_key": "ZemSYyRv6OAfQ9H1",
        "spree_ts_giftcard_id": null,
        "slug": "d4b46bb5-3666-4e54-954b-cae5bad470f0",
        "receipient_phone_number": "",
        "send_gift_card_via": "email",
        "bonus": false,
        "serial_number": "01023413",
        "operator_id": null,
        "customer_id": null,
        "recipient_emails": "",
        "store_id": null,
        "generated_at": null,
        "import_by": "ts_giftcards",
        "transition_activation_date": "2024-08-18T06:38:50.960Z",
        "message": "",
        "order_placed_date": null,
        "line_item_id": null,
        "start_date": null,
        "test_mode": false,
        "request_id": "1234",
        "campaign_body": "dev testing message body",
        "image_url": "http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhZV3R5WWpZeGRXNXpkall5T1RKa2JqTmlPSEo0WkhJMmJuWmpkZ1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpZjJsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SW5CbGVHVnNjeTF6WVdocGJDMTVZV1JoZGkweE1EazFNVE13TURrd0xUSXpPRGczTWpNeUxtcHdaeUk3SUdacGJHVnVZVzFsS2oxVlZFWXRPQ2NuY0dWNFpXeHpMWE5oYUdsc0xYbGhaR0YyTFRFd09UVXhNekF3T1RBdE1qTTRPRGN5TXpJdWFuQm5CanNHVkRvUlkyOXVkR1Z1ZEY5MGVYQmxTU0lQYVcxaFoyVXZhbkJsWndZN0JsUTZFWE5sY25acFkyVmZibUZ0WlRvS2JHOWpZV3c9IiwiZXhwIjoiMjAyNC0wOC0xOFQwNjo0Mzo1MS4xNzZaIiwicHVyIjoiYmxvYl9rZXkifX0=--0d3568f6b231e5bb715426994f1fac2314bc17b8/pexels-sahil-yadav-1095130090-23887232.jpg",
        "campaign_response": {
            "id": 61,
            "name": "dev-1",
            "start_date": "2023-01-27T00:00:00.000Z",
            "end_date": "2026-12-27T00:00:00.000Z",
            "client_id": 3,
            "code": "dev-1",
            "max_expiry_days": null,
            "created_at": "2023-01-27T09:20:56.836Z",
            "updated_at": "2024-08-13T11:32:17.940Z",
            "date_specific_expiry": true,
            "email_subject": "dev testing email template merhan",
            "email_html": "dev testing email template merhan",
            "specific_date": "2025-10-14T00:00:00.000Z",
            "body": "dev testing message body",
            "sms_html": "dev testing sms template",
            "allow_password": false,
            "ses_from_email": "zeeshan@techsembly.com",
            "transaction_email_subject": "dev testing transaction email bisma",
            "transaction_email_html": " {{#if trasaction.show_local_amount}}\n      {{trasaction.local_currency}} {{trasaction.local_amount}}\n  {{/if}}",
            "soft_delete": false,
            "cc_transaction_email": "ahsan.chughtai@techsembly.com",
            "remain_active": false,
            "is_campaign_remained_active": false,
            "is_gift_card_remained_active": false,
            "transaction_email_receivers": "",
            "test_mode": false
        },
        "initial_store_id": 11
    }
```
  • Request (application/json)
    • Headers

        Authorization: Basic ZGV2dHNjbGllbnRAZ21haWwuY29tOmRldnRzY2xpZW50QGdtYWlsLmNvbQ==
      
    • Body

        {
            "card_type": "monetary", 
            "value": "1000",
            "currency": "USD", 
            "delivery_mode": "digital",
            "campaign_code": "dev-1",
            "from_address": "wyfosykyp@mailinator.com",
            "invoice_id": "sk-123",
            "notes": "werwe",
            "product_name": "tesitng",
            "receipient_phone_number": "",
            "recipient_email": "wyfosykyp@mailinator.com",
            "recipient_first_name": "Darrel",
            "recipient_last_name": "Wiggins",
            "send_gift_card_via": "email",
            "skus": [],
            "message": "",
            "store_id": "11",
            "creator_attributes": {
                "creator_email": "dev@tsclient.com",
                "creator_role": "1234"
            },
            "request_id": "1234"
        }
      
  • Response 200 (application/json)
    • Body

        {
            "id": 28071,
            "number": "935896188801023413",
            "pin": "24429",
            "currency": "USD",
            "card_type": "monetary",
            "expiry_date": "2025-10-14T00:00:00.000Z",
            "value": "1000.0",
            "skus": [],
            "status": "active",
            "user_id": 24,
            "campaign_id": 61,
            "created_at": "2024-08-18T06:38:49.603Z",
            "updated_at": "2024-08-18T06:38:49.603Z",
            "client_id": 3,
            "product_name": "tesitng",
            "delivery_mode": "digital",
            "delivery_status": "delivered",
            "is_redeemed": false,
            "is_expired": false,
            "recipient_first_name": "Darrel",
            "recipient_last_name": "Wiggins",
            "recipient_email": "wyfosykyp@mailinator.com",
            "order_number": "",
            "send_email": false,
            "order_pay_load": "",
            "notes": "werwe",
            "invoice_id": "sk-123",
            "from_address": "wyfosykyp@mailinator.com",
            "store_name": null,
            "customer_email": null,
            "barcode_key": "UT764xIqPatTsAl0",
            "qrcode_key": "ZemSYyRv6OAfQ9H1",
            "spree_ts_giftcard_id": null,
            "slug": "d4b46bb5-3666-4e54-954b-cae5bad470f0",
            "receipient_phone_number": "",
            "send_gift_card_via": "email",
            "bonus": false,
            "serial_number": "01023413",
            "operator_id": null,
            "customer_id": null,
            "recipient_emails": "",
            "store_id": null,
            "generated_at": null,
            "import_by": "ts_giftcards",
            "transition_activation_date": "2024-08-18T06:38:50.960Z",
            "message": "",
            "order_placed_date": null,
            "line_item_id": null,
            "start_date": null,
            "test_mode": false,
            "request_id": "1234",
            "campaign_body": "dev testing message body",
            "image_url": "http://localhost:3000/rails/active_storage/disk/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdDVG9JYTJWNVNTSWhZV3R5WWpZeGRXNXpkall5T1RKa2JqTmlPSEo0WkhJMmJuWmpkZ1k2QmtWVU9oQmthWE53YjNOcGRHbHZia2tpZjJsdWJHbHVaVHNnWm1sc1pXNWhiV1U5SW5CbGVHVnNjeTF6WVdocGJDMTVZV1JoZGkweE1EazFNVE13TURrd0xUSXpPRGczTWpNeUxtcHdaeUk3SUdacGJHVnVZVzFsS2oxVlZFWXRPQ2NuY0dWNFpXeHpMWE5oYUdsc0xYbGhaR0YyTFRFd09UVXhNekF3T1RBdE1qTTRPRGN5TXpJdWFuQm5CanNHVkRvUlkyOXVkR1Z1ZEY5MGVYQmxTU0lQYVcxaFoyVXZhbkJsWndZN0JsUTZFWE5sY25acFkyVmZibUZ0WlRvS2JHOWpZV3c9IiwiZXhwIjoiMjAyNC0wOC0xOFQwNjo0Mzo1MS4xNzZaIiwicHVyIjoiYmxvYl9rZXkifX0=--0d3568f6b231e5bb715426994f1fac2314bc17b8/pexels-sahil-yadav-1095130090-23887232.jpg",
            "campaign_response": {
                "id": 61,
                "name": "dev-1",
                "start_date": "2023-01-27T00:00:00.000Z",
                "end_date": "2026-12-27T00:00:00.000Z",
                "client_id": 3,
                "code": "dev-1",
                "max_expiry_days": null,
                "created_at": "2023-01-27T09:20:56.836Z",
                "updated_at": "2024-08-13T11:32:17.940Z",
                "date_specific_expiry": true,
                "email_subject": "dev testing email template merhan",
                "email_html": "dev testing email template merhan",
                "specific_date": "2025-10-14T00:00:00.000Z",
                "body": "dev testing message body",
                "sms_html": "dev testing sms template",
                "allow_password": false,
                "ses_from_email": "zeeshan@techsembly.com",
                "transaction_email_subject": "dev testing transaction email bisma",
                "transaction_email_html": " {{#if trasaction.show_local_amount}}\n      {{trasaction.local_currency}} {{trasaction.local_amount}}\n  {{/if}}",
                "soft_delete": false,
                "cc_transaction_email": "ahsan.chughtai@techsembly.com",
                "remain_active": false,
                "is_campaign_remained_active": false,
                "is_gift_card_remained_active": false,
                "transaction_email_receivers": "",
                "test_mode": false
            },
            "initial_store_id": 11
        }
      

Get or Update Gift Card [/api/v1/gift_cards/53]

Get a Gift Card with Id: [GET]

GET {:ts_server_url}/api/v1/gift_cards/{:Id}

Use this API to retrieve the details of a gift card.

#####API Response:

    {

    "gift_card": 
    {
        "id": 53,
        "number": "2925681115",
        "created_at": "2022-12-22T12:05:16.067Z",
        "status": "active",
        "expiry_date": "2023-01-18T12:05:16.055Z",
        "product_name": "Cara Thornton",
        "card_type": "experiences",
        "currency": "USD",
        "value": "123123.0",
        "skus": [
          "sk-123123"
        ],
        "delivery_mode": "digital",
        "delivery_status": "pending",
        "is_redeemed": false,
        "bonus": false
    },
    "transactions": [],
    "current_balance": "0.00"

}
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
  • Response 201 (application/json)
+ Body

         {

            "gift_card": 
            {
                "id": 53,
                "number": "2925681115",
                "created_at": "2022-12-22T12:05:16.067Z",
                "status": "active",
                "expiry_date": "2023-01-18T12:05:16.055Z",
                "product_name": "Cara Thornton",
                "card_type": "experiences",
                "currency": "USD",
                "value": "123123.0",
                "skus": [
                  "sk-123123"
                ],
                "delivery_mode": "digital",
                "delivery_status": "pending",
                "is_redeemed": false,
                "bonus": false
            },
            "transactions": [],
            "current_balance": "0.00"

        }

Update a Gift Card with Id [PUT]

PUT {:ts_server_url}/api/v1/gift_cards/{:Id}

Use this API to update the details of a gift card.

To update gift card details, you have to send the put request to the gift card server having the payload containing the updated values in the JSON object. After successful updation, you will receive a successful response with the updated card details object.

#####Request Payload:

    {

      "card_type": "monetary", 
      "value": "1000", 
      "currency": "USD", 
      "delivery_mode": "digital",
      "campaign_code": "eaz-123",
      "from_address": "wyfosykyp@mailinator.com",
      "invoice_id": "sk-123",
      "notes": "werwe",
      "product_name": "tesitng",
      "receipient_phone_number": "",
      "recipient_email": "wyfosykyp@mailinator.com",
      "recipient_first_name": "Darrel",
      "recipient_last_name": "Wiggins",
      "send_gift_card_via": "email",
      "skus": []

}

#####1) card_type. This param represents the type of card you want to update. Its type is a string and it could be either monetary or experience.

#####2) value. You can set the amount value of the card you want to update

#####3) currency. Using this param you can set the currency of a gift card.

#####4) delivery_mode. This param represents the delivery mode of a card, Its type is a string and could contain either digital or physical.

#####5) campaign_code. Using this param you can set the campaign code for which the card is valid and redeemable.

#####6) from_address. This param represents the sender's email address who is sending this card.

#####7) invoice_id. This param is used to set the invoice ID generated for a gift card.

#####8) notes. You can set notes/comments for a gift card.

#####9) product_name. Using this param you can set the product name for which a card is redeemable.

#####10) receipient_phone_number. This param represents the recipient's phone number who is going to receive the gift card.

#####11) recipient_email. This param represents the recipient's email who is going to receive the gift card.

#####12) recipient_first_name. This param represents the recipient's first name.

#####13) recipient_last_name. This param represents the recipient's last name.

#####14) send_gift_card_via. This param is used to set how the card will be sent to the recipient, its type is a string and it could be either 'email', 'sms' or 'both'.

#####15) skus. This param is used to set the SKUs of gift cards. It is an array of SKUs you can send one or more than one SKUs in array format.

#####API Response:

    {


      "status": "active",
      "id": 53,
      "number": "2925681115",
      "pin": "75911",
      "currency": "USD",
      "card_type": "experiences",
      "expiry_date": "2023-01-18T12:05:16.055Z",
      "value": "123123.0",
      "skus": [
        "sk-123123"
      ],
      "user_id": 1,
      "campaign_id": 5,
      "created_at": "2022-12-22T12:05:16.067Z",
      "updated_at": "2022-12-22T12:05:16.067Z",
      "client_id": 1,
      "product_name": "Cara Thornton",
      "delivery_mode": "digital",
      "delivery_status": "pending",
      "is_redeemed": false,
      "is_expired": false,
      "recipient_first_name": "Kiayada",
      "recipient_last_name": "Kirkland",
      "recipient_email": "vurirabu@mailinator.com",
      "order_number": "",
      "send_email": false,
      "order_pay_load": "",
      "notes": "Et atque repudiandae",
      "invoice_id": 0,
      "from_address": "wyfosykyp@mailinator.com",
      "store_name": {},
      "customer_email": {},
      "barcode_key": "NkmeQmhGe9JNIaaO",
      "qrcode_key": "32B6qbKc0uT53XrK",
      "spree_ts_giftcard_id": {},
      "bonus": false,
      "slug": "4449fa3a-2295-44ae-8f6b-6f29c88bf1a8",
      "receipient_phone_number": "124234234523",
      "send_gift_card_via": "both",
      "serial_number": {}

    } 
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

      {

       "status":"active"
      

      }

  • Response 201 (application/json)
+ Body
        {
          "status": "active",
          "id": 53,
          "number": "2925681115",
          "pin": "75911",
          "currency": "USD",
          "card_type": "experiences",
          "expiry_date": "2023-01-18T12:05:16.055Z",
          "value": "123123.0",
          "skus": [
            "sk-123123"
          ],
          "user_id": 1,
          "campaign_id": 5,
          "created_at": "2022-12-22T12:05:16.067Z",
          "updated_at": "2022-12-22T12:05:16.067Z",
          "client_id": 1,
          "product_name": "Cara Thornton",
          "delivery_mode": "digital",
          "delivery_status": "pending",
          "is_redeemed": false,
          "is_expired": false,
          "recipient_first_name": "Kiayada",
          "recipient_last_name": "Kirkland",
          "recipient_email": "vurirabu@mailinator.com",
          "order_number": "",
          "send_email": false,
          "order_pay_load": "",
          "notes": "Et atque repudiandae",
          "invoice_id": 0,
          "from_address": "wyfosykyp@mailinator.com",
          "store_name": {},
          "customer_email": {},
          "barcode_key": "NkmeQmhGe9JNIaaO",
          "qrcode_key": "32B6qbKc0uT53XrK",
          "spree_ts_giftcard_id": {},
          "bonus": false,
          "slug": "4449fa3a-2295-44ae-8f6b-6f29c88bf1a8",
          "receipient_phone_number": "124234234523",
          "send_gift_card_via": "both",
          "serial_number": {}
        }       

Redeem API [/api/v1/gift_cards/redeem]

Redeem a gift card with card type monetary using card currency [POST]

POST {:ts_server_url}/api/v1/gift_cards/redeem

Use this API to redeem a monetary card.

    #####Request Payload:


    {
        "number": "6963340003", 
        "pin": "94279", 
        "amount": "200", 
        "currency": "USD", 
        "store_id": "78",
        "meta": {}

    } 

#####1) number. This param is the gift card number which is a string type.

#####2) pin. This param is the security pin of the gift card.

#####3) amount. This param represents the amount value in the desired currency you want to redeem with a monetary card.

#####4) currency. This param represents the card currency.

#####5) store_id. You can use this param to set the store ID of where you are redeeming the card.

#####6) meta. This param allows you to set the local currency and the local amount values in which the user has redeemed a card. You can also set extra custom key values in the meta object.

#####API Response:

    {

      "card_number": "6636747879",
      "amount": "-1.00",
      "balance": "798.88",
      "currency": "USD",
      "meta": {},
      "id": 30324
    }

Note:

+ **id:** The id field represents the transaction_id for each transaction, such as top-up and debit.
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
            "number": "6636747879", 
            "pin": "66882", 
            "amount": "1", 
            "currency": "USD", 
            "store_id": "1"
      
        } 
      
  • Response 201 (application/json)
+ Body

        {
          "card_number": "6636747879",
          "amount": "-1.00",
          "balance": "798.88",
          "currency": "USD",
          "meta": {}
        }

Redeem a gift card with card type monetary using other currency [POST]

POST {:ts_server_url}/api/v1/gift_cards/redeem

To redeem the monetary card in another currenc, you have to handle this by doing a conversion from local currency to card currency before sending the request, and then place the converted value in the value of amount key in JSON request pyaload.To keep the track record that card is redeemed in other currency, you have to send the information as a value of meta key which contains local currency and the local amount in which the user redeemed the card.

    #####Request Payload:


    {

        "number": "1246465278",
         "pin": "72774",
         "amount": "0.22",
         "currency": "USD",
         "store_id": "5",
         "meta": {
          "local_currency": "AFA",
          "local_amount": "20.00"
        }
    } 

#####1) number. This param is the gift card number which is a string type.

#####2) pin. This param is the security pin of the gift card.

#####3) amount. This param represents the amount value in the desired currency in which you want to redeem a monetary card.

#####4) currency. This param represents the card currency.

#####5) store_id. You can use this param to set the store id on which you are redeeming a card.

#####5) meta. This param allows you to set the local currency and local amount values in which the user has redeemed a card. You can also set extra custom key values in meta object.

#####API Response:

    {

      "card_number": "6636747879",
      "amount": "-0.22",
      "balance": "798.66",
      "currency": "USD",
      "meta": {
        "local_currency": "AFA",
        "local_amount": "20.00"
      },
      "id": 30325
    }

Note:

+ **id:** The id field represents the transaction_id for each transaction, such as top-up and debit.
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
            "number": "6636747879", 
            "pin": "66882",
             "amount": "0.22",
             "currency": "USD",
             "store_id": "1",
             "meta": {
              "local_currency": "AFA",
              "local_amount": "20.00"
            }
        } 
      
  • Response 201 (application/json)
+ Body

        {
          "card_number": "6636747879",
          "amount": "-0.22",
          "balance": "798.66",
          "currency": "USD",
          "meta": {
            "local_currency": "AFA",
            "local_amount": "20.00"
          }
        }

Redeem a gift card with card_type experiences [POST]

POST {:ts_server_url}/api/v1/gift_cards/redeem

Use this API to redeem a gift card in which the card_type is experiences.

    #####Request Payload:



    {

      "number": "3547120806",
      "pin": "18877",
      "sku": "pro-123",
      "store_id": "1",
      "meta": {}
    } 

#####1) number. This param is the gift card number which is a string type.

#####2) pin. This param is used to set the security PIN of a gift card.

#####3) sku. You can set the product SKU for which you want to redeem a card.

#####4) store_id.

Using this param you can set the store ID of where you are redeeming this card.

#####5) meta. This param allows you to set the local currency and local amount values in which the user has redeemed a card. You can also set extra custom key values in meta object.

#####API Response:

    {

          "card_number": "3547120806",
          "amount": "Card is redeemed",
          "balance": "",
          "currency": "",
          "id": 30327
    }

Note:

+ **id:** The id field represents the transaction_id for each transaction, such as top-up and debit.
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
          "number": "3547120806",
          "pin": "18877",
          "sku": "pro-123",
          "store_id": "1"
        } 
      
  • Response 201 (application/json)
+ Body

        {
          "card_number": "3547120806",
          "amount": "Card is redeemed",
          "balance": "",
          "currency": ""
        }

Refund API [/api/v3/gift_cards/refund]

Refund a transaction [POST]

POST {:ts_server_url}/api/v3/gift_cards/refund

Use this API to refund a transaction.

    #####Request Payload:


    {
        "transaction_id": 30325,
        "notes": "refunding",
        "amount": "2"
        "creator_email": "navisi9055@secbuf.com",
        "creator_role": "client"
    }

######1) transaction_id.

To refund a particular transaction you will have to send transaction_id of that transaction in the request JSON payload.

######2) notes.

Notes for the refund

######3) amount.

Amount you want to refund from that transaction in case of monetary card. For experiences gift card it will be blank.

######4) creator_email.

User email who is performing the action.

######5) creator_role.

User role who is performing the action.

#####API Response:

    {

        "id": 30330,
        "amount": "2",
        "currency": "USD",
        "transaction_type": "refund",
        "ip": "::1",
        "note": "",
        "refund_id": 30325,
        "gift_card_id": 28071,
        "user_id": 24,
        "sku": null,
        "created_at": "2024-08-19T07:43:53.799Z",
        "updated_at": "2024-08-19T07:43:53.799Z",
        "refunded": false,
        "external_invoice_id": null,
        "notes": "refunding",
        "card_balance": null,
        "store_id": 11,
        "meta": null,
        "transaction_reason_id": 12,
        "select_payment_methods": "cash",
        "operator_id": null,
        "gift_card_status": "active",
        "recipient_emails": "",
        "service_fee_id": null,
        "gift_card_balance_status": null
     }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
          "transaction_id": "168"
        }
      
  • Response 201 (application/json)
+ Body

        {
          "id": 181,
          "amount": "0.56",
          "currency": "USD",
          "transaction_type": "refund",
          "ip": "127.0.0.1",
          "note": "",
          "refund_id": 168,
          "gift_card_id": 45,
          "user_id": 1,
          "sku": null,
          "created_at": "2022-12-22T12:46:35.188Z",
          "updated_at": "2022-12-22T12:46:35.188Z",
          "refunded": false,
          "external_invoice_id": null,
          "notes": "",
          "card_balance": null,
          "store_id": null,
          "meta": null
         }

Credit API [/api/v1/gift_cards/credit]

Top up a gift card [POST]

Use this API to top up your card with given amount and currency.

POST {:ts_server_url}/api/v1/gift_cards/credit

    #####Request Payload:


    {
        "amount": 123123, 
        "notes": "1231231231",
        "currency": "USD",
        "external_invoice_id": "234234", 
        "number": "8108449962"
    }

######1) amount.

This param represents the amount you want to credit to a gift card, the amount value is of a type decimal.

######2) notes.

Using this param, you can add notes to your transaction.

######3) currency.

This param represents the card currency.

######4) external_invoice_id.

This param allows you to set the invoice ID of the top up transaction.

######5) number.

This param represents the card number which is a string type.

#####API Response:

{

  "card_number": "8108449962",
  "amount": "123123.00",
  "balance": "13076531.56",
  "currency": "USD",
  "meta": {}

}
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
            "amount": 123123, 
            "notes": "1231231231",
            "currency": "USD",
            "external_invoice_id": 234234, 
            "number": "8108449962"
        }
      
  • Response 201 (application/json)
+ Body

        {
          "card_number": "8108449962",
          "amount": "123123.00",
          "balance": "13076531.56",
          "currency": "USD",
          "meta": {}
        }

Balance API [/api/v1/gift_cards/check_balance]

Check the balance of a gift card with card_type monetary [PUT]

Use this API to check the balance of a gift card with card_type monetary.

PUT {:ts_server_url}/api/v1/gift_cards/check_balance

#####Request Payload:


    {
      "number": "6636747879",
      "pin": "66882"
    }

######1) number.

The gift card number which is a string type.

######2) pin.
This query param is the security PIN of the card, which you have to send with the card number.

#####API Response:


    {
      "card_type": "monetary",
      "card_status": "Valid",
      "card_number": "6636747879",
      "balance": "USD 798.66",
      "status": "active",
      "expiry_date": "2025-10-14T00:00:00.000Z"
    } 
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
          "number": "6636747879",
          "pin": "66882"
        }
      
  • Response 201 (application/json)
+ Body

        {
          "card_type": "monetary",
          "card_status": "Valid",
          "card_number": "6636747879",
          "balance": "USD 798.66",
          "status": "active",
          "expiry_date": "2025-10-14T00:00:00.000Z"
        } 

Check the balance of a gift card with card_type experiences [PUT]

Use this API to check the balance of a gift card with card_type experiences.

PUT {:ts_server_url}/api/v1/gift_cards/check_balance

    #####Request Payload:


    {
      "number": "2925681115",
      "pin": "75911"
    }

######1) number.

Here is the gift card number which is a string type.

######2) pin.
This query param is the security PIN of the card, which you have to send with the card number.

    #####API Response:


    {
      "product_name": "Cara Thornton",
      "card_type": "experiences",
      "skus": "sk-123123",
      "card_status": "Valid",
      "card_number": "2925681115",
      "balance": "Card is redeemable.",
      "status": "active",
      "expiry_date": "2025-10-14T00:00:00.000Z"
    } 
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
          "number": "2925681115",
          "pin": "75911"
        }
      
  • Response 201 (application/json)
+ Body

        {
          "product_name": "Cara Thornton",
          "card_type": "experiences",
          "skus": "sk-123123",
          "card_status": "Valid",
          "card_number": "2925681115",
          "balance": "Card is redeemable.",
          "status": "active",
          "expiry_date": "2025-10-14T00:00:00.000Z"
        } 

Campaign [/api/v1/campaigns]

List All Campaign Of User Without Any Filter [GET]

To send the request for the redemption of a monetary card, you need will need the client ID and password of the client API to verify that the request comes from an authenticated resource. Following are the required params which you have to send in the body

API Response:

        {

          "campaigns": [
            {
              "id": 8,
              "name": "Madonna Patterson",
              "start_date": "2022-11-07T00:00:00.000Z",
              "end_date": "2022-11-07T00:00:00.000Z",
              "client_id": 1,
              "code": "Quis cumque suscipit",
              "max_expiry_days": 27,
              "created_at": "2022-11-07T10:59:59.680Z",
              "updated_at": "2022-11-23T12:57:43.514Z",
              "date_specific_expiry": false,
              "email_subject": "puci@mailinator.com",
              "email_html": "Eius aut at est at ",
              "specific_date": null,
              "body": "sdgdfhfg",
              "sms_html": "sgdfgdf",
              "allow_password": false
            },
            {
              "id": 7,
              "name": "Wade Smith",
              "start_date": "2022-11-07T00:00:00.000Z",
              "end_date": "2022-11-07T00:00:00.000Z",
              "client_id": 1,
              "code": "Consectetur qui illo",
              "max_expiry_days": 12,
              "created_at": "2022-11-07T10:56:57.074Z",
              "updated_at": "2022-11-07T10:56:57.074Z",
              "date_specific_expiry": false,
              "email_subject": "zajewete@mailinator.com",
              "email_html": "Aut sequi et in non ",
              "specific_date": null,
              "body": null,
              "sms_html": "",
              "allow_password": true
            }
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body
  • Response 201 (application/json)
+ Body

        {

          "campaigns": [
            {
              "id": 8,
              "name": "Madonna Patterson",
              "start_date": "2022-11-07T00:00:00.000Z",
              "end_date": "2022-11-07T00:00:00.000Z",
              "client_id": 1,
              "code": "Quis cumque suscipit",
              "max_expiry_days": 27,
              "created_at": "2022-11-07T10:59:59.680Z",
              "updated_at": "2022-11-23T12:57:43.514Z",
              "date_specific_expiry": false,
              "email_subject": "puci@mailinator.com",
              "email_html": "Eius aut at est at ",
              "specific_date": null,
              "body": "sdgdfhfg",
              "sms_html": "sgdfgdf",
              "allow_password": false
            },
            {
              "id": 7,
              "name": "Wade Smith",
              "start_date": "2022-11-07T00:00:00.000Z",
              "end_date": "2022-11-07T00:00:00.000Z",
              "client_id": 1,
              "code": "Consectetur qui illo",
              "max_expiry_days": 12,
              "created_at": "2022-11-07T10:56:57.074Z",
              "updated_at": "2022-11-07T10:56:57.074Z",
              "date_specific_expiry": false,
              "email_subject": "zajewete@mailinator.com",
              "email_html": "Aut sequi et in non ",
              "specific_date": null,
              "body": null,
              "sms_html": "",
              "allow_password": true
            }
        }

List All Campaign Of User With Any Filter [GET]

To send the request for the redemption of monetary card, you need to send client ID and password of client API to verify that request comes from the authenticated resource. Following are attributes which are able to filter campagins

1) Filter

    1) name of campagin 

    2) code of campagin

Following are the required params which you have to send in the body

Body:

    {

        "q" = 
        "{\"name_cont\":\"eaz\",\"code_cont\":null}"

    }

API Response:

        {

          "campaigns": [
            {
              "id": 8,
              "name": "Madonna Patterson",
              "start_date": "2022-11-07T00:00:00.000Z",
              "end_date": "2022-11-07T00:00:00.000Z",
              "client_id": 1,
              "code": "Quis cumque suscipit",
              "max_expiry_days": 27,
              "created_at": "2022-11-07T10:59:59.680Z",
              "updated_at": "2022-11-23T12:57:43.514Z",
              "date_specific_expiry": false,
              "email_subject": "puci@mailinator.com",
              "email_html": "Eius aut at est at ",
              "specific_date": null,
              "body": "sdgdfhfg",
              "sms_html": "sgdfgdf",
              "allow_password": false
            },
            {
              "id": 7,
              "name": "Wade Smith",
              "start_date": "2022-11-07T00:00:00.000Z",
              "end_date": "2022-11-07T00:00:00.000Z",
              "client_id": 1,
              "code": "Consectetur qui illo",
              "max_expiry_days": 12,
              "created_at": "2022-11-07T10:56:57.074Z",
              "updated_at": "2022-11-07T10:56:57.074Z",
              "date_specific_expiry": false,
              "email_subject": "zajewete@mailinator.com",
              "email_html": "Aut sequi et in non ",
              "specific_date": null,
              "body": null,
              "sms_html": "",
              "allow_password": true
            }
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body {

      "q" = "{\"name_cont\":\"eaz\",\"code_cont\":null}" }

  • Response 201 (application/json)
+ Body

        {

          "campaigns": [
            {
              "id": 8,
              "name": "Madonna Patterson",
              "start_date": "2022-11-07T00:00:00.000Z",
              "end_date": "2022-11-07T00:00:00.000Z",
              "client_id": 1,
              "code": "Quis cumque suscipit",
              "max_expiry_days": 27,
              "created_at": "2022-11-07T10:59:59.680Z",
              "updated_at": "2022-11-23T12:57:43.514Z",
              "date_specific_expiry": false,
              "email_subject": "puci@mailinator.com",
              "email_html": "Eius aut at est at ",
              "specific_date": null,
              "body": "sdgdfhfg",
              "sms_html": "sgdfgdf",
              "allow_password": false
            },
            {
              "id": 7,
              "name": "Wade Smith",
              "start_date": "2022-11-07T00:00:00.000Z",
              "end_date": "2022-11-07T00:00:00.000Z",
              "client_id": 1,
              "code": "Consectetur qui illo",
              "max_expiry_days": 12,
              "created_at": "2022-11-07T10:56:57.074Z",
              "updated_at": "2022-11-07T10:56:57.074Z",
              "date_specific_expiry": false,
              "email_subject": "zajewete@mailinator.com",
              "email_html": "Aut sequi et in non ",
              "specific_date": null,
              "body": null,
              "sms_html": "",
              "allow_password": true
            }
        }

Create Campaign [POST]

In order to create a new campaign of the gift card, you have to send the following payout containing the respective information on what you want to create the card.

    Body:

            {

                "name": "Drew Sellerss", 
                "start_date": "2023-01-03", 
                "end_date": "2023-01-03",
                "body": "Maiores fugiat ex do",
                "code": "hello-1",
                "date_specific_expiry": true,
                "email_html": "Ut sequi dolorum qui",
                "email_subject": "kurunutul@mailinator.com",
                "max_expiry_days": "",
                "name": "Drew Sellers",
                "sms_html": "Quis voluptas nihil ",
                "specific_date": "2023-04-06",
                "start_date": "2023-01-03",
                "store_ids": ["5", "7"]
            }

API Response:

        {

          "id": 15,
          "name": "Drew Sellers",
          "start_date": "2023-01-03T00:00:00.000Z",
          "end_date": "2023-01-03T00:00:00.000Z",
          "client_id": 1,
          "code": "hello-1",
          "max_expiry_days": {},
          "created_at": "2023-01-03T08:12:35.277Z",
          "updated_at": "2023-01-03T08:12:35.277Z",
          "date_specific_expiry": true,
          "email_subject": "kurunutul@mailinator.com",
          "email_html": "Ut sequi dolorum qui",
          "specific_date": "2023-04-06T00:00:00.000Z",
          "body": "Maiores fugiat ex do",
          "sms_html": "Quis voluptas nihil ",
          "allow_password": true
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
        "campaign" : {
      
                "name": "Drew Sellers", 
                "code": "hello-1", 
                "start_date": "2023-01-03", 
                "end_date": "2023-01-03",
                "body": "Maiores fugiat ex do",
                "date_specific_expiry": true,
                "email_html": "Ut sequi dolorum qui",
                "email_subject": "kurunutul@mailinator.com",
                "max_expiry_days": "",
                "name": "Drew Sellers",
                "sms_html": "Quis voluptas nihil ",
                "specific_date": "2023-04-06",
                "start_date": "2023-01-03",
                "store_ids": ["5", "7"]
            }
        }
      
  • Response 201 (application/json)
+ Body

       {
          "id": 15,
          "name": "Drew Sellers",
          "start_date": "2023-01-03T00:00:00.000Z",
          "end_date": "2023-01-03T00:00:00.000Z",
          "client_id": 1,
          "code": "hello-1",
          "max_expiry_days": {},
          "created_at": "2023-01-03T08:12:35.277Z",
          "updated_at": "2023-01-03T08:12:35.277Z",
          "date_specific_expiry": true,
          "email_subject": "kurunutul@mailinator.com",
          "email_html": "Ut sequi dolorum qui",
          "specific_date": "2023-04-06T00:00:00.000Z",
          "body": "Maiores fugiat ex do",
          "sms_html": "Quis voluptas nihil ",
          "allow_password": true
        }

Show/Update/delete Campaign [/api/v1/campaigns/12]

Show Campaign id:12 [GET]

To show the respective information, you have to send the get request to gift card server and it will send you reponse containing the following information

API Response:

        {

              "id": 12,
              "name": "Drew Sellers",
              "start_date": "2023-01-03T00:00:00.000Z",
              "end_date": "2023-01-03T00:00:00.000Z",
              "client_id": 1,
              "code": "hello-1233",
              "max_expiry_days": {},
              "created_at": "2023-01-03T08:09:03.713Z",
              "updated_at": "2023-01-03T08:09:03.713Z",
              "date_specific_expiry": true,
              "email_subject": "kurunutul@mailinator.com",
              "email_html": "Ut sequi dolorum qui",
              "specific_date": "2023-04-06T00:00:00.000Z",
              "body": "Maiores fugiat ex do",
              "sms_html": "Quis voluptas nihil ",
              "allow_password": true,
              "store_ids": [
                "5",
                "7"
              ],
              "attachment_url": ""
            }
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
  • Response 201 (application/json)
+ Body


        {
              "id": 12,
              "name": "Drew Sellers",
              "start_date": "2023-01-03T00:00:00.000Z",
              "end_date": "2023-01-03T00:00:00.000Z",
              "client_id": 1,
              "code": "hello-1233",
              "max_expiry_days": {},
              "created_at": "2023-01-03T08:09:03.713Z",
              "updated_at": "2023-01-03T08:09:03.713Z",
              "date_specific_expiry": true,
              "email_subject": "kurunutul@mailinator.com",
              "email_html": "Ut sequi dolorum qui",
              "specific_date": "2023-04-06T00:00:00.000Z",
              "body": "Maiores fugiat ex do",
              "sms_html": "Quis voluptas nihil ",
              "allow_password": true,
              "store_ids": [
                "5",
                "7"
              ],
              "attachment_url": ""
            }
        }

Updated Gift Card id:12 [PUT]

To update the data, you have to send the put request on the gift card server, having the payload containing the update data information in the JSON object. Once sucessful in updating information, you will recieve reponse of the updated data object.

Body:

{

   "name": "Drew Sellers"
}

API Response:

        {


          "status": "active",
          "id": 53,
          "number": "2925681115",
          "pin": "75911",
          "currency": "USD",
          "card_type": "experiences",
          "expiry_date": "2023-01-18T12:05:16.055Z",
          "value": "123123.0",
          "skus": [
            "sk-123123"
          ],
          "user_id": 1,
          "campaign_id": 5,
          "created_at": "2022-12-22T12:05:16.067Z",
          "updated_at": "2022-12-22T12:05:16.067Z",
          "client_id": 1,
          "product_name": "Cara Thornton",
          "delivery_mode": "digital",
          "delivery_status": "pending",
          "is_redeemed": false,
          "is_expired": false,
          "recipient_first_name": "Kiayada",
          "recipient_last_name": "Kirkland",
          "recipient_email": "vurirabu@mailinator.com",
          "order_number": "",
          "send_email": false,
          "order_pay_load": "",
          "notes": "Et atque repudiandae",
          "invoice_id": 0,
          "from_address": "wyfosykyp@mailinator.com",
          "store_name": {},
          "customer_email": {},
          "barcode_key": "NkmeQmhGe9JNIaaO",
          "qrcode_key": "32B6qbKc0uT53XrK",
          "spree_ts_giftcard_id": {},
          "bonus": false,
          "slug": "4449fa3a-2295-44ae-8f6b-6f29c88bf1a8",
          "receipient_phone_number": "124234234523",
          "send_gift_card_via": "both",
          "serial_number": {}
        }       
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

      { "name": "Ahsan Ali" }

  • Response 201 (application/json)
+ Body
        {

          "name": "Ahsan Ali",
          "id": 12,
          "start_date": "2023-01-03T00:00:00.000Z",
          "end_date": "2023-01-03T00:00:00.000Z",
          "client_id": 1,
          "code": "hello-1233",
          "max_expiry_days": {},
          "created_at": "2023-01-03T08:09:03.713Z",
          "updated_at": "2023-01-03T08:33:19.767Z",
          "date_specific_expiry": true,
          "email_subject": "kurunutul@mailinator.com",
          "email_html": "Ut sequi dolorum qui",
          "specific_date": "2023-04-06T00:00:00.000Z",
          "body": "Maiores fugiat ex do",
          "sms_html": "Quis voluptas nihil ",
          "allow_password": true,
          "attachment_url": ""
        }

Delete Gift Card id:12 [DELETE]

To delete the respective record, you have to send the DELETE request to gift card server and it will delete the respective record from the database

Body:

API Response: // need to verfiy error came here cross orgin

    {

        message: "Campagin is deleted"

    }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body
  • Response 201 (application/json)
+ Body

      // need to verfiy error came here cross orgin 

    {

        message: "Campagin is deleted"

    } 

Store [/api/v1/stores]

List All Store Of User [GET]

To send the request for the redemption of montary card, you need authorization token of client API to verify that the request came from the authenticated resource. This authorization token will be received in the header of the request. Following are the required params which you have to send in the body

API Response:

        [

          {
            "id": 1,
            "name": "TS-S1",
            "code": "TS-S1",
            "url": "",
            "client_id": 1,
            "created_at": "2022-09-07T07:06:07.271Z",
            "updated_at": "2022-09-07T07:06:07.271Z"
          },
          {
            "id": 2,
            "name": "TS-S1",
            "code": "TS-S1",
            "url": "",
            "client_id": 1,
            "created_at": "2022-09-07T07:06:07.274Z",
            "updated_at": "2022-09-07T07:06:07.274Z"
          }
        ]
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body
  • Response 201 (application/json)
+ Body

        [

          {
            "id": 1,
            "name": "TS-S1",
            "code": "TS-S1",
            "url": "",
            "client_id": 1,
            "created_at": "2022-09-07T07:06:07.271Z",
            "updated_at": "2022-09-07T07:06:07.271Z"
          },
          {
            "id": 2,
            "name": "TS-S1",
            "code": "TS-S1",
            "url": "",
            "client_id": 1,
            "created_at": "2022-09-07T07:06:07.274Z",
            "updated_at": "2022-09-07T07:06:07.274Z"
          }
        ]

Create Store [POST]

In order to create new store for the gift card, you have to send the following payout containing the respective information of what you want to create the card.

    Body:

        {
           "store": 
                {
                    "name": "testing", 
                    "code": "store_code"
                }
        }

API Response:

        {

          "id": 9,
          "name": "testing",
          "code": "store_code",
          "url": "",
          "client_id": 1,
          "created_at": "2023-01-03T09:16:38.662Z",
          "updated_at": "2023-01-03T09:16:38.662Z"
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
           "store": 
                {
                    "name": "testing", 
                    "code": "store_code"
                }
        }
      
  • Response 201 (application/json)
+ Body

       {
          "id": 9,
          "name": "testing",
          "code": "store_code",
          "url": "",
          "client_id": 1,
          "created_at": "2023-01-03T09:16:38.662Z",
          "updated_at": "2023-01-03T09:16:38.662Z"
        }

Show/Update/delete Store [/api/v1/stores/8]

Show Store id:8 [GET]

To show the respective information, you have to send the get request to gift card server and it will send you the reponse containing the following information

API Response:

        {

          "id": 8,
          "name": "testing",
          "code": "st-123",
          "url": "",
          "client_id": 1,
          "created_at": "2023-01-03T09:13:36.246Z",
          "updated_at": "2023-01-03T09:13:36.246Z"
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
  • Response 201 (application/json)
+ Body


        {

          "id": 8,
          "name": "testing",
          "code": "st-123",
          "url": "",
          "client_id": 1,
          "created_at": "2023-01-03T09:13:36.246Z",
          "updated_at": "2023-01-03T09:13:36.246Z"
        }

Updated Store id:8 [PUT]

To update the data you have to send the put request on the gift card server having the payload containing the update data information in the JSON object. Once successful in updating the information, you will recieve the reponse of the updated data object.

Body:

{

   "code": "ahsan-ali"
}

API Response:

       {

          "client_id": 1,
          "code": "ahsan-ali",
          "id": 8,
          "name": "Ahsan Ali",
          "url": "",
          "created_at": "2023-01-03T09:13:36.246Z",
          "updated_at": "2023-01-03T10:40:05.915Z"
        }      
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

      { "code": "ahsan-ali" }

  • Response 201 (application/json)
+ Body
        {
          "client_id": 1,
          "code": "ahsan-ali",
          "id": 8,
          "name": "Ahsan Ali",
          "url": "",
          "created_at": "2023-01-03T09:13:36.246Z",
          "updated_at": "2023-01-03T10:40:05.915Z"
        }

Delete Store id:8 [DELETE]

To delete the respective record, you will have to send the DELETE request to gift card server and it will delete the respective record from the database

Body:

API Response: // need to verfiy error came here cross orgin

    {

        message: "Store is deleted"

    }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body
  • Response 201 (application/json)
+ Body

      // need to verfiy error came here cross orgin 

    {

        message: "Store is deleted"

    } 

FORMAT: 1A HOST: https://ts_server_url.com/

Activate Physical Gift Card APIs

To activate a single physical gift card or in bulk, You will use following APIs respectivly. Before activating any physical gift card it must be existed. For creating Physical Gift Cards on the behalf of a Client or Vendor, You will have to contact our Support Team. After creating Physical Gift Cards, You can use this API to activate a particular Physical Gift Card against any order for a customer.

Activate a Single Physical Gift Card [/api/v3/gift_cards/activation]

To activate a single Physical Gift Card You can use this API. This is a POST request. which accepts only single gift card params to activate. To view the request url, params and expected response you can view "Activate a Single Physical Gift Card" API

Activate Physical Gift Card [POST]

POST {:ts_server_url}/api/v3/gift_cards/activation

Use this API to activate a single gift card.

    #####Request Payload:

    {
      "gift_card": {
        "campaign_id": "123456",
        "card_type": "monetary",
        "creator_attributes": {
          "creator_email": "client@example.com",
          "creator_role": "client"
        },
        "currency": "USD",
        "delivery_status": "pickUp",
        "gift_card_number": "41945902300378903",
        "invoice_id": 543,
        "notes": "activate card",
        "order_number": "123456",
        "product_name": "Gift Card",
        "recipient_first_name": "john",
        "recipient_last_name": "doe",
        "shipping_address_attributes": {
          "address1": "address line 1",
          "address2": "address line 2",
          "city": "City Name",
          "country": "Country Name",
          "firstName": "john",
          "lastName": "doe",
          "state": "State Short Code",
          "state_name": "State Full Name",
          "zipcode": "Valid Zip Code"
        },
        "skus": "",
        "status": "active",
        "store_id": "123",
        "value": 200
      },
      "store_id": "123"
    }

#####1) campaign_id. This is the campaign number for which the gift card is being activated.

#####2) card_type. You can use this param to specify card_type which could be either 'monetary' or 'experiences'.

#####3) creator_attributes. This param is an object which contains two params creator_email and creator_role. creator_email should be the email from the API credentials email. creator_role should be the 'client' which is a string param.

#####4) currency. To specify in which currency you want to activate. For example for USD you will pass 'USD' and for British Pound, you will pass 'GBP'.

#####5) delivery_status. Using this param you can specify delivery type it could be either 'pickUp' or 'delivered'

#####6) gift_card_number. This is the card number which you are going to activate.

#####7) invoice_id. Using this param you can specify your invoice number for which you are activating this gift card.

#####1) notes. You can use this param to add notes for your reference.

#####1) order_number. Using this param you can specify for which particular order you are activating this gift card number.

#####1) product_name. You can specify your product title or name using this param.

#####1) recipient_first_name. This param is used to specify recipient first name for which you are activating this number.

#####1) recipient_last_name. This param is used to specify recipient last name for which you are activating this number.

#####1) shipping_address_attributes. This param will be used if you have specified delivery_status to 'delivered'. To deliver a particular card you will need an address of the recipient.

#####1) skus. Using this param you can specify your stock keeping units for reference product.

#####1) status. This is a param in which you will pass 'active' value to activate a particular card. it could have other values but for activation you will have to pass 'active' value.

#####1) store_id. Using this param you can specify for which store you are activating current card.

#####1) value. This is very important param for activation of a gift card, because this is the param which determine the value of a gift card. For exmaple if you want to active a physical gift card for 200 USD. You will send 200 a number value in this param and in currency param you will specify 'USD' value.

    #####Response Payload:
    {
        "card_number": "41945902300378903",
        "amount": "200.00",
        "balance": "200.00",
        "currency": "USD",
        "meta": null,
        "id": 11196
    }

#####1) card_number. This is the response card number which you have activated.

#####2) amount. This is the attribute for which value you have activated this card.

#####3) balance. This response attribute represents the balance at the time of activation.

#####4) currency. This attribute shows the currency of the card.

#####5) meta. This attribute is the data about the card.

#####6) id. This is the id of the activated gift card.

  • Request (application/json)

      {
          "gift_card": {
              "campaign_id": "123456",
              "card_type": "monetary",
              "creator_attributes": {
                  "creator_email": "client@example.com",
                  "creator_role": "client"
              },
              "currency": "USD",
              "delivery_status": "pickUp",
              "gift_card_number": "41945902300378903",
              "invoice_id": 543,
              "notes": "activate card",
              "order_number": "123456",
              "product_name": "Gift Card",
              "recipient_first_name": "john",
              "recipient_last_name": "doe",
              "shipping_address_attributes": {
                  "address1": "address line 1",
                  "address2": "address line 2",
                  "city": "City Name",
                  "country": "Country Name",
                  "firstName": "john",
                  "lastName": "doe",
                  "state": "State Short Code",
                  "state_name": "State Full Name",
                  "zipcode": "Valid Zip Code"
              },
              "skus": "",
              "status": "active",
              "store_id": "123",
              "value": 200
          },
          "store_id": "123"
      }
    
  • Response 200 (application/json)
    • Headers
+ Body

        {
            "card_number": "41945902300378903",
            "amount": "200.00",
            "balance": "200.00",
            "currency": "USD",
            "meta": null,
            "id": 11196
        }
  • Response 422 (application/json)
    • Headers
+ Body

        {
            "errors": "You can't activate the card with number 427689063003000093 because it is already in Active state."
        }

Activate Bulk Physical Gift Cards [/api/v3/gift_cards/bulk_activate]

To activate Physical Gift Cards in bulk, You can use this API. This is a POST request. which accepts an array of gift cards params to activate. To view the request url, params and expected response you can view "Activate Bulk Physical Gift Cards" API Use this API to activate a single gift card.

    #####Request Payload:

    {

      "bulk_activation_params": [
        {
          "gift_card": {
            "campaign_id": "243",
            "card_type": "monetary",
            "creator_attributes": {
              "creator_email": "client@example.com",
              "creator_role": "client"
            },
            "currency": "USD",
            "delivery_status": "pickUp",
            "gift_card_number": "427689063003000093",
            "invoice_id": 543,
            "notes": "new credit added",
            "order_number": "R634022964",
            "product_name": "Gift Cardee",
            "recipient_first_name": "ahmad",
            "recipient_last_name": "ahmad",
            "shipping_address_attributes": {
              "address1": "",
              "address2": "",
              "city": "",
              "country": "",
              "firstName": "",
              "lastName": "",
              "state": "",
              "state_name": "",
              "zipcode": ""
            },
            "skus": "",
            "status": "active",
            "store_id": "13",
            "value": 100
          },
          "store_id": "13"
        },
        {
          "gift_card": {
            "campaign_id": "243",
            "card_type": "monetary",
            "creator_attributes": {
              "creator_email": "client@example.com",
              "creator_role": "client"
            },
            "currency": "USD",
            "delivery_status": "pickUp",
            "gift_card_number": "422101695503000093",
            "invoice_id": 543,
            "notes": "new credit added",
            "order_number": "R634022964",
            "product_name": "Gift Cardee",
            "recipient_first_name": "ahmad",
            "recipient_last_name": "ahmad",
            "shipping_address_attributes": {
              "address1": "",
              "address2": "",
              "city": "",
              "country": "",
              "firstName": "",
              "lastName": "",
              "state": "",
              "state_name": "",
              "zipcode": ""
            },
            "skus": "",
            "status": "active",
            "store_id": "13",
            "value": 100
          },
          "store_id": "13"
        }
      ]
    }

#####1) campaign_id. This is the campaign number for which the gift card is being activated.

#####2) card_type. You can use this param to specify card_type which could be either 'monetary' or 'experiences'.

#####3) creator_attributes. This param is an object which contains two params creator_email and creator_role. creator_email should be the email from the API credentials email. creator_role should be the 'client' which is a string param.

#####4) currency. To specify in which currency you want to activate. For example for USD you will pass 'USD' and for British Pound, you will pass 'GBP'.

#####5) delivery_status. Using this param you can specify delivery type it could be either 'pickUp' or 'delivered'

#####6) gift_card_number. This is the card number which you are going to activate.

#####7) invoice_id. Using this param you can specify your invoice number for which you are activating this gift card.

#####1) notes. You can use this param to add notes for your reference.

#####1) order_number. Using this param you can specify for which particular order you are activating this gift card number.

#####1) product_name. You can specify your product title or name using this param.

#####1) recipient_first_name. This param is used to specify recipient first name for which you are activating this number.

#####1) recipient_last_name. This param is used to specify recipient last name for which you are activating this number.

#####1) shipping_address_attributes. This param will be used if you have specified delivery_status to 'delivered'. To deliver a particular card you will need an address of the recipient.

#####1) skus. Using this param you can specify your stock keeping units for reference product.

#####1) status. This is a param in which you will pass 'active' value to activate a particular card. it could have other values but for activation you will have to pass 'active' value.

#####1) store_id. Using this param you can specify for which store you are activating current card.

#####1) value. This is very important param for activation of a gift card, because this is the param which determine the value of a gift card. For exmaple if you want to active a physical gift card for 200 USD. You will send 200 a number value in this param and in currency param you will specify 'USD' value.

    #####Response Payload:
    [
      "{\"card_number\":\"288329192203000093\",\"amount\":\"350.00\",\"balance\":\"1050.00\",\"currency\":\"USD\",\"meta\":null,\"id\":11209}",
      "{\"card_number\":\"657911754903000093\",\"amount\":\"1000.00\",\"balance\":\"3000.00\",\"currency\":\"USD\",\"meta\":null,\"id\":11210}",
      "{\"card_number\":\"242939918703000095\",\"amount\":\"2000.00\",\"balance\":\"9777.00\",\"currency\":\"USD\",\"meta\":null,\"id\":11211}"
    ]

#####1) card_number. This is the response card number which you have activated.

#####2) amount. This is the attribute for which value you have activated this card.

#####3) balance. This response attribute represents the balance at the time of activation.

#####4) currency. This attribute shows the currency of the card.

#####5) meta. This attribute is the data about the card.

#####6) id. This is the id of the activated gift card.

Activate Bulk Physical Gift Cards [POST]

  • Request (application/json)

      {
          "bulk_activation_params": [
              {
                  "gift_card": {
                      "campaign_id": "243",
                      "card_type": "monetary",
                      "creator_attributes": {
                          "creator_email": "client@example.com",
                          "creator_role": "client"
                      },
                      "currency": "USD",
                      "delivery_status": "pickUp",
                      "gift_card_number": "427689063003000093",
                      "invoice_id": 543,
                      "notes": "new credit added",
                      "order_number": "R634022964",
                      "product_name": "Gift Cardee",
                      "recipient_first_name": "ahmad",
                      "recipient_last_name": "ahmad",
                      "shipping_address_attributes": {
                          "address1": "",
                          "address2": "",
                          "city": "",
                          "country": "",
                          "firstName": "",
                          "lastName": "",
                          "state": "",
                          "state_name": "",
                          "zipcode": ""
                      },
                      "skus": "",
                      "status": "active",
                      "store_id": "13",
                      "value": 100
                  },
                  "store_id": "13"
              },
              {
                  "gift_card": {
                      "campaign_id": "243",
                      "card_type": "monetary",
                      "creator_attributes": {
                          "creator_email": "client@example.com",
                          "creator_role": "client"
                      },
                      "currency": "USD",
                      "delivery_status": "pickUp",
                      "gift_card_number": "422101695503000093",
                      "invoice_id": 543,
                      "notes": "new credit added",
                      "order_number": "R634022964",
                      "product_name": "Gift Cardee",
                      "recipient_first_name": "ahmad",
                      "recipient_last_name": "ahmad",
                      "shipping_address_attributes": {
                          "address1": "",
                          "address2": "",
                          "city": "",
                          "country": "",
                          "firstName": "",
                          "lastName": "",
                          "state": "",
                          "state_name": "",
                          "zipcode": ""
                      },
                      "skus": "",
                      "status": "active",
                      "store_id": "13",
                      "value": 100
                  },
                  "store_id": "13"
              }
          ]
      }
    
  • Response 200 (application/json)
    • Headers
+ Body

        [
"{\"card_number\":\"288329192203000093\",\"amount\":\"350.00\",\"balance\":\"1050.00\",\"currency\":\"USD\",\"meta\":null,\"id\":11209}",
"{\"card_number\":\"657911754903000093\",\"amount\":\"1000.00\",\"balance\":\"3000.00\",\"currency\":\"USD\",\"meta\":null,\"id\":11210}",
"{\"card_number\":\"242939918703000095\",\"amount\":\"2000.00\",\"balance\":\"9777.00\",\"currency\":\"USD\",\"meta\":null,\"id\":11211}"

]

  • Response 422 (application/json)
    • Headers
+ Body

        {
            "errors": "{\"errors\":\"You can't activate the card with number 422101695503000093 because it is already in Active state.\"}"
        }

Transaction Reason [/api/v3/transaction_reasons]

List All Transaction Reason Of User [GET /api/v3/transaction_reasons?page={page}&per_page={per_page}&q={filter}]

To send the request for List down all the transaction reason of User you need authorization token of client api to verify that request from the authenticate resource this authorization token will be received in the header of the request. Following are the required params which you have to send in the body

1) Transaction Reason Filters.

1) Transaction Reason Name.
2) Transaction Reason Type.

######Request Payload:

You have to generate the JSON object containing the following query data, After creating JSON object, you have to convert that object into
JSON string.

Given below is the required payload:


    q = "{
            \"transaction_reason_cont\":\"test\",
            \"transaction_type_eq\":\"2\"
        }"

######Request Query Params:

######1) transaction_reason_cont.

This query param represents the name of a transaction reason. It will going to add like query on the transaction reason name

######2) transaction_type_eq.

You can use this param to filter transaction reason on bases of transaction reason type by given 1 for debit 2 for refund and 3 for credit.

API Response:

        {

        "transaction_reasons": [
        {
              "id": 124,
              "transaction_reason": "Cancel",
              "transaction_type": "debit",
              "client_id": 1,
              "created_at": "2023-03-24T07:34:57.738Z",
              "updated_at": "2023-03-24T07:34:57.738Z",
              "soft_delete": false,
              "store_id": null
            },
            {
              "id": 111,
              "transaction_reason": "tesitng234245234",
              "transaction_type": "credit",
              "client_id": 1,
              "created_at": "2023-03-13T20:04:51.212Z",
              "updated_at": "2023-03-13T20:04:51.212Z",
              "soft_delete": false,
              "store_id": null
            },
            {
              "id": 107,
              "transaction_reason": "testing321123",
              "transaction_type": "debit",
              "client_id": 1,
              "created_at": "2023-03-03T12:07:39.506Z",
              "updated_at": "2023-03-03T12:07:39.506Z",
              "soft_delete": false,
              "store_id": null
            },
            {
              "id": 104,
              "transaction_reason": "testing98088567432145678",
              "transaction_type": "debit",
              "client_id": 1,
              "created_at": "2023-02-23T22:24:32.056Z",
              "updated_at": "2023-02-23T22:24:32.056Z",
              "soft_delete": false,
              "store_id": null
            },
            {
              "id": 103,
              "transaction_reason": "testingLabel",
              "transaction_type": "debit",
              "client_id": 1,
              "created_at": "2023-02-23T19:45:09.341Z",
              "updated_at": "2023-02-23T19:45:09.341Z",
              "soft_delete": false,
              "store_id": 98
            }
          ],
          "total_count": 68
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
  • Parameters
    • page: 1 (optional, int),
    • per_page: 25 (optional, int),
    • filter: {} (optional,hash)
  • Response 201 (application/json)
+ Body

        {

        "transaction_reasons": [
        {
              "id": 124,
              "transaction_reason": "Cancel",
              "transaction_type": "debit",
              "client_id": 1,
              "created_at": "2023-03-24T07:34:57.738Z",
              "updated_at": "2023-03-24T07:34:57.738Z",
              "soft_delete": false,
              "store_id": null
            },
            {
              "id": 111,
              "transaction_reason": "tesitng234245234",
              "transaction_type": "credit",
              "client_id": 1,
              "created_at": "2023-03-13T20:04:51.212Z",
              "updated_at": "2023-03-13T20:04:51.212Z",
              "soft_delete": false,
              "store_id": null
            },
            {
              "id": 107,
              "transaction_reason": "testing321123",
              "transaction_type": "debit",
              "client_id": 1,
              "created_at": "2023-03-03T12:07:39.506Z",
              "updated_at": "2023-03-03T12:07:39.506Z",
              "soft_delete": false,
              "store_id": null
            },
            {
              "id": 104,
              "transaction_reason": "testing98088567432145678",
              "transaction_type": "debit",
              "client_id": 1,
              "created_at": "2023-02-23T22:24:32.056Z",
              "updated_at": "2023-02-23T22:24:32.056Z",
              "soft_delete": false,
              "store_id": null
            },
            {
              "id": 103,
              "transaction_reason": "testingLabel",
              "transaction_type": "debit",
              "client_id": 1,
              "created_at": "2023-02-23T19:45:09.341Z",
              "updated_at": "2023-02-23T19:45:09.341Z",
              "soft_delete": false,
              "store_id": 98
            }
          ],
          "total_count": 68
        }

Create Transaction Reason [POST]

In order to create new transaction reason, you have to send the following payout containing the respective information of what you want to create the card.

    Body:

        {
            "transaction_reason": {

                "transaction_reason": "Cash Back",
                "transaction_type": "credit"
            }
        }

    Here transaction type must be credit/debit/refund and transaction reason represent the transaction reason name

API Response:

        {

            "id": 232,
            "transaction_reason": "Cash Back",
            "transaction_type": "credit",
            "client_id": 1,
            "created_at": "2023-04-27T08:30:27.504Z",
            "updated_at": "2023-04-27T08:30:27.504Z",
            "soft_delete": false,
            "store_id": {}
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
            "transaction_reason": {
      
                "transaction_reason": "Cash Back",
                "transaction_type": "credit"
            }
        }
      
  • Response 201 (application/json)
+ Body

       {

            "id": 232,
            "transaction_reason": "Cash Back",
            "transaction_type": "credit",
            "client_id": 1,
            "created_at": "2023-04-27T08:30:27.504Z",
            "updated_at": "2023-04-27T08:30:27.504Z",
            "soft_delete": false,
            "store_id": {}
        }

Show/Update/delete Transaction Reason [/api/v3/transaction_reasons/231]

Show Transaction Reason id:231 [GET]

To show the respective information, you have to send the get request to ts gift card server and it will send you the reponse containing the following information

API Response:

        {

            "id": 231,
            "transaction_reason": "AddOn",
            "transaction_type": "credit",
            "client_id": 1,
            "created_at": "2023-04-27T08:28:13.091Z",
            "updated_at": "2023-04-27T08:28:13.091Z",
            "soft_delete": false,
            "store_id": {}
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
  • Response 201 (application/json)
+ Body


        {

            "id": 231,
            "transaction_reason": "AddOn",
            "transaction_type": "credit",
            "client_id": 1,
            "created_at": "2023-04-27T08:28:13.091Z",
            "updated_at": "2023-04-27T08:28:13.091Z",
            "soft_delete": false,
            "store_id": {}
        }

Updated Transaction Reason id:231 [PUT]

To update the data you have to send the put request on the ts gift card server having the payload containing the update data information in the JSON object. Once successful in updating the information, you will recieve the reponse of the updated data object.

Body:

        {

            "transaction_reason": {

                "transaction_reason": "Adding Cash",
                "transaction_type": "credit"
            }
        }

        Here transaction type must be credit/debit/refund and transaction reason represent the transaction reason name

API Response:

       {

          "client_id": 1,
          "code": "ahsan-ali",
          "id": 8,
          "name": "Ahsan Ali",
          "url": "",
          "created_at": "2023-01-03T09:13:36.246Z",
          "updated_at": "2023-01-03T10:40:05.915Z"
        }      
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

      {

      "transaction_reason": {

        "transaction_reason": "Add",
        "transaction_type": "credit"
      

      } }

  • Response 201 (application/json)
+ Body
        {
          "client_id": 1,
          "code": "ahsan-ali",
          "id": 8,
          "name": "Ahsan Ali",
          "url": "",
          "created_at": "2023-01-03T09:13:36.246Z",
          "updated_at": "2023-01-03T10:40:05.915Z"
        }

Delete Transaction Reason id:231 [DELETE]

To delete the respective record, you will have to send the DELETE request to gift card server and it will delete the respective record from the database

  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body
  • Response 201 (application/json)

Transaction Reason's Transaction API [/api/v3/gift_cards/transaction]

Transaction Reason, a gift card with card type monetary using card currency [POST]

POST {:ts_server_url}/api/v3/gift_cards/transaction

Use this API to redeem a monetary card.

    #####Request Payload:


    {
        "type": "monetary",
        "number": "2338877012",
        "pin": "40776",
        "amount": "10.00",
        "store_id": 97,
        "sku": "",
        "transaction_reason": "Cash Back",
        "external_invoice_id": "",
        "payment_method": "",
        "notes": "",
        "currency": "AED"

    } 

#####1) number. This param is the gift card number which is a string type.

#####2) pin. This param is the security pin of the gift card.

#####3) amount. This param represents the amount value in the desired currency you want to redeem with a monetary card.

#####4) currency. This param represents the card currency.

#####5) store_id. You can use this param to set the store ID of where you are redeeming the card.

#####6) meta. This param allows you to set the local currency and the local amount values in which the user has redeemed a card. You can also set extra custom key values in the meta object.

#####7) type. This param is the gift card type which is a string type.

#####8) notes. This param is represent the transaction notes which is a string type.

#####8) transaction_reason. This param is represent the transaction reason of transaction which is a string type.

#####API Response:

    {

        "card_number": "2338877012",
        "amount": "10.00",
        "balance": "1234167.66",
        "currency": "AED",
        "meta": null,
        "from_transaction_fee": null,
        "to_transaction_fee": null,
        "id": 3044
    }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
            "type": "monetary",
            "number": "2338877012",
            "pin": "40776",
            "amount": "10.00",
            "store_id": 97,
            "sku": "",
            "transaction_reason": "Cash Back",
            "external_invoice_id": "",
            "payment_method": "",
            "notes": "",
            "currency": "AED"
      
        } 
      
  • Response 201 (application/json)
+ Body

        {
            "card_number": "2338877012",
            "amount": "10.00",
            "balance": "1234167.66",
            "currency": "AED",
            "meta": null,
            "from_transaction_fee": null,
            "to_transaction_fee": null,
            "id": 3044
        }

Transaction Reason, a gift card with card type monetary using different currency [POST]

POST {:ts_server_url}/api/v3/gift_cards/transaction

To redeem the monetary card in another currency, you have to handle this by doing a conversion from local currency to card currency before sending the request, and then place the converted value in the value of amount key in JSON request pyaload.To keep the track record that card is perfom transaction in other currency, you have to send the information as a value of meta key which contains local currency and the local amount in which the user redeemed the card.

    #####Request Payload:


        {

            "type": "monetary",
            "transaction_reason": "Cash Back",
            "pin": "40776",
            "number": "2338877012",
            "notes": "",
            "currency": "AED",
            "amount": "36.71",
            "store_id": 97,
            "payment_method": "cash",
            "external_invoice_id": "",
            "meta": {
                "exchange_rate": "0.27236",
                "to": "10.00",
                "to_currency": "USD",
                "from_currency": "AED",
                "from": "36.71"
            }

        } 

#####1) number. This param is the gift card number which is a string type.

#####2) pin. This param is the security pin of the gift card.

#####3) amount. This param represents the amount value in the desired currency in which you want to redeem a monetary card.

#####4) currency. This param represents the card currency.

#####5) store_id. You can use this param to set the store id on which you are redeeming a card.

#####5) meta. This param allows you to set the from_currency(gift card currency), from(gift card currency amount), to_currency(local currency), to(local amount), exchange_rate(conversion rate gift card currency to local currency) values in which the user has perform the transaction. You can also set extra custom key values in meta object.

#####6) payment_method. This param represents the payment method from which user going to pay the amount in case of credit, in case of debit it will be an empty string

#####7) notes. This param is represent the transaction notes which is a string type.

#####8) transaction_reason. This param is represent the transaction reason of transaction which is a string type.

#####API Response:

        {

            "card_number": "2338877012",
            "amount": "36.71",
            "balance": "1234204.37",
            "currency": "AED",
            "meta": {
                "exchange_rate": "0.27236",
                "to": "10.00",
                "to_currency": "USD",
                "from_currency": "AED",
                "from": "36.71"
                },
            "from_transaction_fee": {},
            "to_transaction_fee": {},
            "id": 3045
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
      
            "type": "monetary",
            "transaction_reason": "Cash Back",
            "pin": "40776",
            "number": "2338877012",
            "notes": "",
            "currency": "AED",
            "amount": "36.71",
            "store_id": 97,
            "payment_method": "cash",
            "external_invoice_id": "",
            "meta": {
                "exchange_rate": "0.27236",
                "to": "10.00",
                "to_currency": "USD",
                "from_currency": "AED",
                "from": "36.71"
            }
      
        }
      
  • Response 201 (application/json)
+ Body

        {

            "card_number": "2338877012",
            "amount": "36.71",
            "balance": "1234204.37",
            "currency": "AED",
            "meta": {
                "exchange_rate": "0.27236",
                "to": "10.00",
                "to_currency": "USD",
                "from_currency": "AED",
                "from": "36.71"
                },
            "from_transaction_fee": {},
            "to_transaction_fee": {},
            "id": 3045
        }

Transaction Reason, a gift card with card_type experiences [POST]

POST {:ts_server_url}/api/v3/gift_cards/transaction

Use this API from transaction which user created transaction reason on gift card in which the card_type is experiences.

    #####Request Payload:



    {

        "type": "experiences",
        "number": "330145666401000095",
        "pin": "24186",
        "amount": "",
        "store_id": 97,
        "sku": "sku",
        "transaction_reason": "apple",
        "external_invoice_id": "",
        "payment_method": "",
        "notes": "",
        "currency": "USD",
    } 

#####1) number. This param is the gift card number which is a string type.

#####2) pin. This param is used to set the security PIN of a gift card.

#####3) sku. You can set the product SKU for which you want to redeem a card.

#####4) store_id. Using this param you can set the store ID of where you are redeeming this card.

#####8) transaction_reason. This param is represent the transaction reason of transaction which is a string type.

#####Important Note. Experience Gift Card can never allow you to perform transaction reason with transaction type credit because experience gift card can't be credited

#####API Response:

    {
            "card_number": "330145666401000095",
            "amount": "Card is redeemed",
            "balance": "",
            "currency": "",
            "id": 3047
    }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

        {
      
            "type": "experiences",
            "number": "330145666401000095",
            "pin": "24186",
            "amount": "",
            "store_id": 97,
            "sku": "sku",
            "transaction_reason": "apple",
            "external_invoice_id": "",
            "payment_method": "",
            "notes": "",
            "currency": "USD"
      
        } 
      
  • Response 201 (application/json)
+ Body

        {
            "card_number": "330145666401000095",
            "amount": "Card is redeemed",
            "balance": "",
            "currency": "",
            "id": 3047
        }

Front Desk User [/api/v1/users]

List All Front Desk Users Of User [GET]

To send the request for the redemption of the monetary gift card, you will need the authorization token of the client api to verify that the request comes from the authenticated resource. This authorization token will be received in the header of the request. Following are the required params which you have to send in the body

API Response:

        [

              {
                "id": 3,
                "email": "fd-ts-s1@test.com",
                "name": "clay",
                "store_id": 1,
                "client_id": {},
                "created_at": "2022-09-07T07:06:07.804Z",
                "updated_at": "2022-09-07T13:04:46.822Z"
              },
              {
                "id": 7,
                "email": "testing@gmail.com",
                "name": "mactest",
                "store_id": {},
                "client_id": {},
                "created_at": "2022-09-07T13:06:34.976Z",
                "updated_at": "2022-11-11T09:01:46.882Z"
              },
              {
                "id": 8,
                "email": "client1@example.com",
                "name": "clay",
                "store_id": {},
                "client_id": {},
                "created_at": "2022-09-22T11:01:01.668Z",
                "updated_at": "2022-09-22T11:01:01.668Z"
              },
              {
                "id": 9,
                "email": "tesssting@gmail.com",
                "name": "meo",
                "store_id": {},
                "client_id": {},
                "created_at": "2022-09-22T11:01:34.136Z",
                "updated_at": "2022-10-06T13:28:49.925Z"
              },
              {
                "id": 10,
                "email": "mackrugeri@gmail.com",
                "name": "mac",
                "store_id": {},
                "client_id": {},
                "created_at": "2022-11-03T06:55:49.417Z",
                "updated_at": "2022-11-03T07:28:51.840Z"
              }
        ]
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body
  • Response 201 (application/json)
+ Body

        [

              {
                "id": 3,
                "email": "fd-ts-s1@test.com",
                "name": "clay",
                "store_id": 1,
                "client_id": {},
                "created_at": "2022-09-07T07:06:07.804Z",
                "updated_at": "2022-09-07T13:04:46.822Z"
              },
              {
                "id": 7,
                "email": "testing@gmail.com",
                "name": "mactest",
                "store_id": {},
                "client_id": {},
                "created_at": "2022-09-07T13:06:34.976Z",
                "updated_at": "2022-11-11T09:01:46.882Z"
              },
              {
                "id": 8,
                "email": "client1@example.com",
                "name": "clay",
                "store_id": {},
                "client_id": {},
                "created_at": "2022-09-22T11:01:01.668Z",
                "updated_at": "2022-09-22T11:01:01.668Z"
              },
              {
                "id": 9,
                "email": "tesssting@gmail.com",
                "name": "meo",
                "store_id": {},
                "client_id": {},
                "created_at": "2022-09-22T11:01:34.136Z",
                "updated_at": "2022-10-06T13:28:49.925Z"
              },
              {
                "id": 10,
                "email": "mackrugeri@gmail.com",
                "name": "mac",
                "store_id": {},
                "client_id": {},
                "created_at": "2022-11-03T06:55:49.417Z",
                "updated_at": "2022-11-03T07:28:51.840Z"
              }
        ]

Create Front Desk Users [POST]

In order to create a new Front Desk User, you have to send the following payout containing the respective information of what you want to create the card.

    Body:

        {

            "user": 

                {
                    "name": "Ryan Chambers", 
                    "email": "tec@mailinator.com", 
                    "store_ids": ["2", "1"], 
                    "password": "123@123"}
        }

API Response:

        {

          "id": 13,
          "email": "tec@mailinator.com",
          "name": "Ryan Chambers",
          "store_id": {},
          "client_id": {},
          "created_at": "2023-01-03T11:01:43.732Z",
          "updated_at": "2023-01-03T11:01:43.732Z"
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

         {
      
            "user": 
      
                {
                    "name": "Ryan Chambers", 
                    "email": "tec@mailinator.com", 
                    "store_ids": ["2", "1"], 
                    "password": "123@123"}
        }
      
  • Response 201 (application/json)
+ Body

       {

          "id": 13,
          "email": "tec@mailinator.com",
          "name": "Ryan Chambers",
          "store_id": {},
          "client_id": {},
          "created_at": "2023-01-03T11:01:43.732Z",
          "updated_at": "2023-01-03T11:01:43.732Z"
        }

Show/Update/delete front desk users [/api/v1/users/13]

Show front desk users id:13 [GET]

To show respective information, you have to send the get request to gift card server and it will send you this reponse containing the following information

API Response:

        {

          "id": 13,
          "email": "tec@mailinator.com",
          "name": "Ryan Chambers",
          "store_id": {},
          "client_id": {},
          "created_at": "2023-01-03T11:01:43.732Z",
          "updated_at": "2023-01-03T11:01:43.732Z",
          "store_ids": [
            1,
            2
          ]
        }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
  • Response 201 (application/json)
+ Body


        {

          "id": 13,
          "email": "tec@mailinator.com",
          "name": "Ryan Chambers",
          "store_id": {},
          "client_id": {},
          "created_at": "2023-01-03T11:01:43.732Z",
          "updated_at": "2023-01-03T11:01:43.732Z",
          "store_ids": [
            1,
            2
          ]
        }

Updated front desk users id:13 [PUT]

To update the data, you have to send the put request on the gift card server having the payload containing the updated data information in the JSON object. Once successful in updating information, you will recieve the reponse of the updated data object.

Body:

{

   "email": "ahsan-ali@techsembly.com"
}

API Response:

       {

          "email": "ahsan-ali@techsembly.com",
          "id": 13,
          "name": "Ryan Chambers",
          "store_id": {},
          "client_id": {},
          "created_at": "2023-01-03T11:01:43.732Z",
          "updated_at": "2023-01-03T11:04:29.670Z"
        }     
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body

      {

      "email": "ahsan-ali@techsembly.com" }

  • Response 201 (application/json)
+ Body
       {

          "email": "ahsan-ali@techsembly.com",
          "id": 13,
          "name": "Ryan Chambers",
          "store_id": {},
          "client_id": {},
          "created_at": "2023-01-03T11:01:43.732Z",
          "updated_at": "2023-01-03T11:04:29.670Z"
        } 

Delete front desk users id:13 [DELETE]

To delete the respective record, you have to send the DELETE request to gift card server and it will delete respective record from the database

Body:

API Response: // need to verfiy error came here cross orgin

    {

        message: "Store is deleted"

    }
  • Request (application/json)
    • Headers

        Authorization: Basic Y2xpZW50LXRzQHRlc3QuY29tOjEyM0AxMjM=
      
    • Body
  • Response 201 (application/json)
+ Body

      // need to verfiy error came here cross orgin 

    {

        message: "Store is deleted"

    }