Create a cross-sell campaign
Overview
Use the createCrossSellCampaign method to create a cross-sell campaign for your 2Checkout account.
Request parameters
Parameters | Type | Required | Description |
---|---|---|---|
MasterProducts |
Array of strings |
Required |
Array of product codes to apply to this campaign. |
DisplayType |
String |
Required |
The display type of the campaign; Can be cart, review, finish. |
DisplayInEmail |
Boolean |
Required |
Determines if the campaign will be displayed in payment receipt emails. |
Products |
Array of objects |
Required |
Array of objects containing the product codes pointing to the promoted products when tied to each master product, the discount value, and the discount type (can only be percent). |
ProductCode |
String |
Required |
Product code of the product to be recommended to the shopper. |
Discount |
Float |
Required |
Value of the discount. |
DiscountType |
String |
Required |
Can only be 'PERCENT'. |
Name |
String |
Required |
Name of the campaign. |
StartDate |
String |
Optional |
The date when the cross-sell campaign starts, formatted as YYYY-MM-DD. |
EndDate |
String |
Optional |
The date when the cross-sell campaign ends, formatted as YYYY-MM-DD. |
Response parameters
Parameters | Type | Required | Description |
---|---|---|---|
CampaignCode |
String |
Required |
The campaign code that can be used when placing orders. |
MasterProducts |
Array of strings |
Required |
Array of product codes to apply to this campaign. |
DisplayType |
String |
Required |
The display type of the campaign; Can be cart, review, finish. |
DisplayInEmail |
Boolean |
Required |
Determines if the campaign will be displayed in payment receipt emails. Can be 'true' or 'false'. |
Products |
Array of objects |
Required |
Array of objects containing the product codes pointing to the promoted products when tied to each master product, the discount value, and the discount type (can only be percent). |
ProductCode |
String |
Required |
Product code of the product to be recommended to the shopper. |
Discount |
Float |
Required |
Value of the discount. |
DiscountType |
String |
Required |
Can only be 'PERCENT'. |
Name |
String |
Required |
Name of the campaign. |
CampaignStatus |
String |
Optional |
The status of the cross-sell campaign. |
StartDate |
String |
Optional |
The date when the cross-sell campaign starts, formatted as YYYY-MM-DD. |
EndDate |
String |
Optional |
The date when the cross-sell campaign ends, formatted as YYYY-MM-DD. |
Request sample
<?php
require ('PATH_TO_AUTH');
$csCampaign = new stdClass();
$csCampaign->MasterProducts = ['C8851A5BC9'];
$csCampaign->DisplayType = 'cart';
$csCampaign->DisplayInEmail = false;
$csCampaign->Name = 'testing';
$csCampaign->StartDate = '2019-09-20';
$csCampaign->EndDate = '2020-10-21';
$csCampaign->Products = [];
$csCampaign->Products[0] = new stdClass();
$csCampaign->Products[0]->ProductCode = '512712FA53';
$csCampaign->Products[0]->Discount = 15;
$csCampaign->Products[0]->DiscountType = 'PERCENT';
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'createCrossSellCampaign';
$jsonRpcRequest->params = array($sessionID, $csCampaign);
$jsonRpcRequest->id = $i++;
$csCampaignResponse = callRPC($jsonRpcRequest, $host, true);