Connectors

2Checkout / Avangate

The Avangate/2Checkout connector is available from Data Sync Studio V3.0.1234.

This connector is read only, however by using project automation events you can write back to 2Checkout.

Connect to 2Checkout

Settings

VendorCode

To get your vendor code you will need to log in to your 2Checkout Dashboard and go to Integrations > Webhooks & API > API.

Copy the Merchant Code and enter this into Data Sync under VendorCode in the connection window.

Connect to 2Checkout

For more information on the 2Checkout API, visit their documentation pages here.

VendorSecret

To get your vendor secret you will need to log in to your 2Checkout Dashboard and go to Integrations > Webhooks & API > API.

Copy the Secret Key and enter this into Data Sync under VendorSecret in the connection window.

Connect to 2Checkout

For more information on the 2Checkout API, visit their documentation pages here.

List

Once you have added your VendorCode and VendorSecret, choose the list you wish to connect to in 2Checkout.

You can connect to the following:

List Description
Subscriptions Return the information on the subscriptions held in your account
Promotions Return the information on the promotions/discounts you have set up in your account

Project Automation Events

Below you will find an example of how project automation events can be used to write back to 2Checkout.

In this example we are updating the description and discount value for a promotion.

public override void BeforeUpdateItem(object sender, DataCompareItemInvariant item, object identity)
    {
        var mapping = new DataSchemaMapping(SchemaMap, DataSchemaSide.DataSourceB);
        var toUpdate = item.ToUpdateItemDictionary(mapping);
       
        if(toUpdate.ContainsKey("DiscountValue"))
        {
            Trace.TraceInformation("Update Discount: {0}->{1}", toUpdate["Name"], toUpdate["DiscountValue"]);   
           
            var helper = DataSourceB.GetWebRequestHelper();   
            var info = DataSourceB.GetDatasourceInfo();
            var url = info.GetAvangateItemEndpointUrl((string)identity);
            // Get the Existing Promotion Details
            var promotion = helper.GetRequestAsJson(url);
            // Update the Discount
            promotion["Description"] = string.Format("{0}% partner discount", toUpdate["DiscountValue"]);
            promotion["Discount"]["Value"] = toUpdate["DiscountValue"].ToString();
            // Send it back
            helper.PutRequestAsJson(promotion, url);           
        }
    }