Update a lead
Request Example
<?php require ('PATH_TO_AUTH'); $Lead = new stdClass(); $Lead->CartId = "CartIdValue"; $Lead->Currency = "EUR"; $Lead->Language = "BG"; $Lead->ExternalReference = "REST_API_3CHECKOUT"; $Lead->Source = "testAPI.com"; $Lead->CustomerReference = "asdf1"; $Lead->MachineId = "123asd"; $Lead->Items = []; $Item = new stdClass(); $Item->Code = "04C26C50F8"; $Item->Quantity = 2; $Item->IsDynamic = false; $Item->Tangible = true; $Item->PurchaseType = "PRODUCT"; $Item->PriceOptions = []; $priceOption = new stdClass(); $priceOption->Name = "group name 1"; $priceOption->Required = false; $option = new stdClass(); $option->Name = 'add25'; $option->Value = 'add25'; $option->Surcharge = 100; $priceOption->Options[] = $option; $Item->PriceOptions[] = $priceOption; $recurringOptions = new stdClass(); $recurringOptions->CycleLength = 6; $recurringOptions->CycleUnit = 'MONTH'; $recurringOptions->CycleAmount = 100; $recurringOptions->ContractLength = 2; $recurringOptions->ContractUnit = 'YEAR'; $Item->RecurringOptions = $recurringOptions; $marketingCampaigns = new stdClass(); $marketingCampaigns->Type = 23; $marketingCampaigns->ParentCode = "m"; $marketingCampaigns->CampaignCode = 23; $Item->MarketingCampaigns = $marketingCampaigns; $Item->Price = new stdClass(); $Item->Price->Amount = 20; $Item->Price->Type = "CUSTOM"; $additionalFields = []; $additionalField = new stdClass(); $additionalField->Code = "TestFieldOne"; $additionalField->Text = "test text"; $additionalField->Value = "test value"; $additionalFields[] = $additionalField; $Item->AdditionalFields = $additionalFields; $Item->SubscriptionStartDate = date("Y-m-d H:i:s"); $Lead->Items[] = $Item; $billingDetails = new stdClass(); $billingDetails->FirstName = "Customer"; $billingDetails->LastName = "2Checkout"; $billingDetails->Phone = null; $billingDetails->Company = null; $billingDetails->FiscalCode = "32423423"; $billingDetails->Email = "customer@2checkout.com"; $billingDetails->Address1 = "Test Address"; $billingDetails->Address2 = null; $billingDetails->City = "LA"; $billingDetails->Zip = "12345"; $billingDetails->CountryCode = "RO"; $billingDetails->State = "CA"; $Lead->BillingDetails = $billingDetails; $Lead->DeliveryDetails = clone($billingDetails); $Lead->DeliveryInformation = new stdClass(); $Lead->DeliveryInformation->ShippingMethod = new stdClass(); $Lead->DeliveryInformation->ShippingMethod->Code = "sdfsd"; $Lead->PaymentDetails = new stdClass(); $Lead->PaymentDetails->Type = "CC"; $Lead->PaymentDetails->Currency = "EUR"; $Lead->PaymentDetails->PaymentMethod = new stdClass(); $Lead->PaymentDetails->PaymentMethod->RecurringEnabled = false; $Lead->PaymentDetails->PaymentMethod->CardPayment = new stdClass(); $Lead->PaymentDetails->PaymentMethod->CardPayment->InstallmentsNumber = 23; $Lead->PaymentDetails->CustomerIP = "1.2.3.4"; $Lead->LocalTime = date("Y-m-d H:i:s"); try { $leadData = $client->updateLead($sessionID, $Lead); } catch (SoapFault $e) { echo "updateLead: " . $e->getMessage(); exit; } var_dump("updateLead", $leadData);
Response Example
class stdClass#18 (4) { public $LeadCode => string(10) "60E6C4B574" public $CreatedAt => string(19) "2019-11-05T16:39:36" public $UpdatedAt => string(19) "2019-11-05T16:48:31" public $Errors => array(0) { } }
Tags recommended by the template: article:reference