We have created a new Data Sync connector for Avanagte/2Checkout REST V4 API.
This new Connector can read Subscriptions and Promotions from the API. With this new connector you can easily sync your subscription data in 2Checkout with your CRM System or SQL Database.
Avangate/2Checkout API docs are here https://knowledgecenter.2checkout.com/Integration/REST_4.0_Reference
Write operations are manual via Project Automation Events and calling the REST API directly.
For example if you wanted to synchronise promotion discount rates with your own internal system you might use the following code in Project Automation BeforeUpdateItem event to retrieve the current promotion json document, update the rate and then send the document back.
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"))
{
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["Discount"]["Value"] = toUpdate["DiscountValue"].ToString();
// Send it back
helper.PutRequestAsJson(promotion, url);
}
}