Transactions

A transaction can be placed on the website, but paid, refunded or cancelled later. Since these actions do not take place on the website, you might want to add them later on. It is possible to add each transaction from your server.

You will have to POST to the tracking endpoint:

https://pipeline.harvest.graindata.com/track

You can also make use of your own domain. For more information read our CNAME sub domain documentation.

Note that not all possible variables are mentioned in the code below. For a full list of meta data, check our meta data documentation.

A full example of the syntax can be found below:

{
    "event":"transaction",
    "time": "2019-04-11T21:49:30+00:00", //In ISO 8601
    "eventData": {
        "eventID": "7c229310-fca4-ddf7-ccc7-b976b10ba169", //UUID
        "harvestAccount": "example",        //The name of your account
        "harvestEnv" : "prod" // The name of the environment you want to send data to
    },
    "userData": {
        "userID": "7c229310-fca4-ddf7-ccc7-b976b10ba169", // Optional, the userID of the user on the website. Allows to stitch missing transactions
        "hashedEmail": "adj123jklsdfj123", //Optional - Allows to stitch transactions
        "stitchID<number>": "12399123" // Optional - Your custom stitch ID - Allows to stitch transactions
    },
    "sessionData": {
        "sessionID": "7c229310-fca4-ddf7-ccc7-b976b10ba169" // Optional, the sessionID of the user on the website. Allows to stitch missing transactions
    },
    "funnelData": {
        "transactionID" : "12qweqwes", //Required - ID of the transaction. Allows to link action to the transaction
        "transactionActions" :[], //Required - Tells us which action is performed
        "transactionRevenue": 1000, //Optional - Relevant for Placement action, the total revenue including tax
        "paymentValue": 1000, //Required for Payment action
        "paymentMethod": "iDEAL", //Optional - Only relevant for Payment action
        "refundValue": 100, //Required for Refund action
        "cancellationValue": 100, //Required for Cancellation action
                    "transactionTax": "20", //Optional - Tax of the transaction
                    "transactionShipping": "20", //Optional - Shipping costs including tax
                    "transactionAffiliation": "20", //Optional - A variable to group transactions, for example the name or brand of the store
                    "transactionVoucher": "SUMMER_COUPON", //Optional - The coupon used to obtain the discount
                    "transactionDiscount": "10" //Optional - The total discount given on the transaction
    },
    "debugData": {
        "userAgentData": {
            "ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"
        }
    },
    "productData": [{
        "name": "Product A", //Name or ID is required
        "id": "123123", //Name or ID is required,
        "refundValue": 100, //Optional - Tells you how much was refunded for the specific product
        "cancellationValue": 100 //Option - Tells you how much was cancelled for the specific product
    }], //Optional, no products are required,
    "event": "transaction",
    "origin": "example", //Optional - You can add the second level domain of the related website here
    "originType": "server"
}

Examples

Below you will find some examples of each transaction action and how to send the data to the Harvest server.

Transaction placement

You can use this action to import missing placed transactions.

{
    "eventData": {
        "eventID": "7c229310-fca4-ddf7-ccc7-b976b10ba169",
        "harvestAccount": "example",
        "harvestEnv": "prod"
    },
    "userData": {
        "userID": "7c229310-fca4-ddf7-ccc7-b976b10ba169",
        "hashedEmail": "adj123jklsdfj123",
        "stitchID1": "12399123"
    },
    "sessionData": {
        "sessionID": "7c229310-fca4-ddf7-ccc7-b976b10ba169"
    },
    "debugData": {
        "userAgentData": {
            "ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"
        }
    },
    "funnelData": {
        "transactionID": "12qweqwes",
        "transactionActions": ["Placement"],
        "transactionRevenue": 1000
    },
    "productData": [{
        "name" : "Product A"
    }],
    "event": "transaction",
    "origin": "example",
    "originType": "server"
}

Transaction payment

You can use this action to register payments. It is not necessary to send 1 payment for a transaction. It is also possible to trigger multiple payments.

{
    "eventData": {
        "eventID": "7c229310-fca4-ddf7-ccc7-b976b10ba169",
        "harvestAccount": "example",
        "harvestEnv": "prod"
    },
    "userData": {
        "userID": "7c229310-fca4-ddf7-ccc7-b976b10ba169",
        "hashedEmail": "adj123jklsdfj123",
        "stitchID1": "12399123"
    },
    "debugData": {
        "userAgentData": {
            "ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"
        }
    },
    "sessionData": {
        "sessionID": "7c229310-fca4-ddf7-ccc7-b976b10ba169"
    },
    "funnelData": {
        "transactionID": "12qweqwes",
        "transactionActions": ["Payment"],
        "paymentValue": 1000,
        "paymentMethod": "iDEAL"
    },
    "productData": [{
        "name" : "Product A"
    }],
    "event": "transaction",
    "origin": "example",
    "originType": "server"
}

It is also possible to combine the placement and payment if the transaction is paid directly.

{
    "eventData": {
        "eventID": "7c229310-fca4-ddf7-ccc7-b976b10ba169",
        "harvestAccount": "example",
        "harvestEnv": "prod"
    },
    "debugData": {
        "userAgentData": {
            "ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"
        }
    },
    "userData": {
        "userID": "7c229310-fca4-ddf7-ccc7-b976b10ba169",
        "hashedEmail": "adj123jklsdfj123",
        "stitchID1": "12399123"
    },
    "sessionData": {
        "sessionID": "7c229310-fca4-ddf7-ccc7-b976b10ba169"
    },
    "funnelData": {
        "transactionID": "12qweqwes",
        "transactionActions": ["Placement", "Payment"],
        "paymentValue": 1000,
        "paymentMethod": "iDEAL"
    },
    "productData": [{
        "name" : "Product A"
    }],
    "event": "transaction",
    "origin": "example",
    "originType": "server"
}

Transaction refund

You can use this action to register refunds. You can fill in the refundValue on transaction level and also specify it per product. Product level is optional.

{
    "eventData": {
        "eventID": "7c229310-fca4-ddf7-ccc7-b976b10ba169",
        "harvestAccount": "example",
        "harvestEnv": "prod"
    },
    "debugData": {
        "userAgentData": {
            "ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"
        }
    },
    "userData": {
        "userID": "7c229310-fca4-ddf7-ccc7-b976b10ba169",
        "hashedEmail": "adj123jklsdfj123",
        "stitchID1": "12399123"
    },
    "sessionData": {
        "sessionID": "7c229310-fca4-ddf7-ccc7-b976b10ba169"
    },
    "funnelData": {
        "transactionID": "12qweqwes",
        "transactionActions": ["Refund"],
        "refundValue": 100
    },
    "productData": [{
        "name" : "Product A",
        "refundValue": 100
    }],
    "event": "transaction",
    "origin": "example",
    "originType": "server"
}

Transaction cancellation

You can use this action to register cancellations. You can fill in the cancellationValeu on transaction level and also specify it per product. Product level is optional.

{
    "eventData": {
        "eventID": "7c229310-fca4-ddf7-ccc7-b976b10ba169",
        "harvestAccount": "example",
        "harvestEnv": "prod"
    },
    "debugData": {
        "userAgentData": {
            "ua" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36"
        }
    },
    "userData": {
        "userID": "7c229310-fca4-ddf7-ccc7-b976b10ba169",
        "hashedEmail": "adj123jklsdfj123",
        "stitchID1": "12399123"
    },
    "sessionData": {
        "sessionID": "7c229310-fca4-ddf7-ccc7-b976b10ba169"
    },
    "funnelData": {
        "transactionID": "12qweqwes",
        "transactionActions": ["Cancellation"],
        "cancellationValue": 100
    },
    "productData": [{
        "name" : "Product A",
        "cancellationValue": 100
    }],
    "event": "transaction",
    "origin": "example",
    "originType": "server"
}