This article describes the various endpoints related to the Viral-Flash-Sale app type. Using the various endpoints you can export data related to a particular Viral-Flash-Sale campaign or all the Viral-Flash-Sale campaign that you might have run.


Transactions Endpoint


The Transactions API endpoint allows you to export the transactions that has happened in a particular viral flash sale campaign. Transactions are the orders that users have placed in a particular Viral Flash Sale campaign.


Type of Request: POST

Endpoint: /app/viral-flash-sale/transactions

Full URL: https://api.shopsocially.com/v2/app/viral-flash-sale/transactions


Request Parameters


The following table outlines the POST request parameters that you can use with this endpoint.


Parameter Value Description
campaign_id The campaign ID of the Viral Flash Sale campaign (Required) The ID of the campaign for which you to pull the transactions data.
start_date Date in the format yyyy-mm-ddTHH:MM:SSZ in the UTC timezone (Optional) Signifies the date from which you want the data. This date is inclusive, that is, you will get the data for this date as well. 
end_date Date in the format yyyy-mm-ddTHH:MM:SSZ in the UTC timezone (Optional) Signifies the date till which you want the data. This date is inclusive.


Response


On a successful request, this API endpoint returns the following JSON response containing a list of the transactions. The meaning of the various fields in the response is included in the following response.


{

    "data": [

        {

       "name": "<The name of the user who made this transaction>",

       "email": "<The email address of the user who made this transaction>"


       "card_last4_digits": "<The last four digits of the credit card used in this transaction>",

       "card_type": "<The credit card type - Visa, MasterCard etc>",


            "billing_address": "<The billing address of the user who made this transaction>",


            "quantity": <Number of vouchers bought>,

            "voucher_codes": [<A list of voucher codes bought in this transaction>],


            "amount": <The amount for this transaction in cents>,

            "credit_card_fees": <The credit card fees (in cents) for this transaction>,

            "datetime": "<The date and time of the transaction in the format yyyy-mm-ddTHH:MM:SSZ in the UTC timezone>",

            "last_refunded_by": "<The name of the admin who last refunded this transaction>",

            "last_refunded_date": "<The date when this transaction was last refunded>",

            

            "offer_ref": "<The referrer for this transaction>",

            "transaction_id": "<The ID of the transaction>"  

        }

    ],

    "success": true

}


As you find in the above response, all the transactions are in a list in the data field.


Example

 

Below is a sample example of the API request should look and what the response looks like. We show the example using the command-line tool curl but you can use any programming language you want to consume the API.


An example request will look like this - 


curl --header "partner-id: <your-partner-id>" --header "api-key: <your-api-key>" --data "campaign_id= <your-campaign-id>" https://api.shopsocially.com/v2/app/viral-flash-sale/transactions


You can replace your partner ID, API key and campaign ID in the above request and run it from the command line to see the response. An example response will look as follows -


{

    "data": [

        {

            "name": "Siddharth Saha",

            "email": "sid@shopsocially.com",


            "card_last4_digits": "4242",

            "card_type": "Visa",


            "billing_address": "Aundh, Pune, MH, United States, 122001",


            "quantity": 1,

            "voucher_codes": [

                "S1"

            ],


            "amount": 3700,

            "credit_card_fees": 111,

            "datetime": "2014-01-22T07:43:48Z",

            "last_refunded_by": null,

            "last_refunded_date": "",

            

            "offer_ref": "sidtetsingstore_email",

            "transaction_id": "52df76b48c444b2edc000007"

        },

        {

            "name": "Siddharth Saha",

            "email": "sid@shopsocially.com",


                        "card_last4_digits": "4242",

            "card_type": "Visa",


            "billing_address": "H-1204 Omega Paradise, Wakad, Pune, MH, United States, 122001",


            "quantity": 1,

            "voucher_codes": [

                "S20"

            ],


            "amount": 3700,

            "credit_card_fees": 111,

            "datetime": "2014-01-22T07:45:08Z",

            "last_refunded_by": null,

            "last_refunded_date": "",


            "offer_ref": "sidtetsingstore_email",

            "transaction_id": "52df77048c444b2edc000008"

        },

        {

            "name": "Siddharth Saha",

            "email": "sid@shopsocially.com",


            "card_last4_digits": "4242",

            "card_type": "Visa",

 

            "billing_address": "Princeton Estate, DLF - V, Gurgaon, Haryana, United States, 122001",


            "quantity": 3,

            "voucher_codes": [

                "S19",

                "S18",

                "S17"

            ],


            "amount": 11100,

            "credit_card_fees": 274,

            "datetime": "2014-01-22T07:45:58Z",

            "last_refunded_by": null,

            "last_refunded_date": "",

            

            "offer_ref": "sidtetsingstore_email",

            "transaction_id": "52df77368c444b2edc00000a"

        }

    ],

    "success": true

}



< Back to Main