The AddCustomer function either:-
returns the first matching customer
or creates a new customer with the data passed up
If successful it will return a customer object:-
populated with the values you passed in if the user was created
populated with some matching values if the user was found (usually via the email address)
Content > IDtheCustomerIDyou need this to use the customer in other API calls, such asSubmitOrderto create an order
Tips and Recommendations when using this function
Do not pass in null values, if a value is optional, it is better not to send that node in the request if you don't want to set a value.
An existing customer will be returned if the
Emailpassed in matches them, this is notSalesChannelIDspecificUse caution if the customer is on other channels, only the first matching customer is returned and this would always be the first customer regardless of the channel you put in your request
If
Countryis not populated, United Kingdom is assumed.The passed in
Countryneeds to match the name we have in our DB (need page of this list to link to)VATNumbercan be populated as a customer is created, but this does not mark the customer as VAT Exempt - which is a property that is not exposed by the API against the customer.
Endpoints
All requests for this function need to go to the following endpoints:
LIVE: https://wcfccpservicesbase.cloudcommercepro.com/CCPApiCustomerService.svc?wsdl
Parameters
intBrandIDrequired, int32 - your brand IDSalesChannelIDrequired, int32 - the target channel IDCompanyNamerequired, string - Full customer name for Retail customer, company name if Trade customerTradingNamerequired, string - Full customer name for Retail customer, company name if Trade customerFirstNamerequired, string - First name of customerLastNamerequired, string - Surname of customerEmailAddressrequired, string - Email of customer, this is the main field that differentiates customers - if this email matches a customer already in the system then it will return the first matching customer. Email doesn't need to be valid for new customers however if you put in a fake email address this will disable email triggers set up for that customerintCustomerTyperequired, int32 - restricted input, recognised values are:-0- uses default, customer will be set as Public (aka Retail on screen)5- Retailer (aka Trade on customer screen)8- Public (aka Retail on customer screen)
intPaymentTermsrequired, int32 - restricted input, recognised values are (not sure about how some of these should work):-0- none?1- Full Payment Before Dispatch2- 28 Days Credit3- 60 Days Credit4- Full Payment With 10 Percent Early Payment Discount5- 50% Upfront Balance in 30 Days6- 30% Deposit Balance on Delivery7- Direct Debit8- 30 Days Credit
CreditLimitoptional, string - customers credit limit, useful for when payment terms have some credit elementVATNumberoptional, string - customer VAT number, value here does not make customer VAT Exempt.Address1required, string - first line of Billing/Admin addressAddress2required, string - second line of Billing/Admin address, can be blank (not null) if no valuePostcoderequired, string - postcode of Billing/Admin addressTownCityrequired, string - town/city of Billing/Admin addressCountyRegionoptional, string - county/region of Billing/Admin addressCountryoptional, string - full country name of Billing/Admin address, no abbreviations, default isUnited Kingdomif not provided.TelNorequired, string - landline number for Billing/Admin address, can be blank (not null) as per exampleFaxNooptional, string - fax number for Billing/Admin addressMobileNooptional, string - mobile number for Billing/Admin addressLoginIDnot recommended - send0if your code library expects a valueAgentIDnot recommended - send0if your code library expects a value
Example Minimal Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header />
<soapenv:Body>
<tem:AddCustomer>
<tem:request>
<tem:BrandID>12</tem:BrandID>
<tem:SecurityHash>98,114,159,142,193,251,85,184,254,121,38,92,206,180,142,179,121,224,68,1,122,17,132,158,161,85,26,91,35,133,149,245,249,30,232,38,46,136,226,91,92,75,42,87,66,254,33,14,189,56,127,61,73,130,74,177,221,164,220,185,187,148,1,78,153,81,198,54,170,115,167,130,150,131,242,183,8,208,2,110,61,185,217,246,38,108,235,177,4,231,20,218,60,104,219,37,209,139,29,195,160,80,62,44,7,234,167,220,219,228,30,82,223,173,14,73,105,67,44,211,1,16,255,181,125,179,141,103</tem:SecurityHash>
<tem:Content>
<tem:CompanyName>Company Name</tem:CompanyName>
<tem:TradingName>Trading Name</tem:TradingName>
<tem:FirstName>First</tem:FirstName>
<tem:LastName>Last</tem:LastName>
<tem:EmailAddress>email@test.com</tem:EmailAddress>
<tem:Address1>Address1</tem:Address1>
<tem:Address2>Address2</tem:Address2>
<tem:Postcode>Postcode</tem:Postcode>
<tem:TownCity>Town/City</tem:TownCity>
<tem:TelNo />
<tem:intBrandID>12</tem:intBrandID>
<tem:SalesChannelID>36</tem:SalesChannelID>
<tem:intCustomerType>8</tem:intCustomerType>
<tem:intPaymentTerms>1</tem:intPaymentTerms>
</tem:Content>
</tem:request>
</tem:AddCustomer>
</soapenv:Body>
</soapenv:Envelope>
Example of Successful Response:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AddCustomerResponse xmlns="http://tempuri.org/">
<AddCustomerResult>
<Success>true</Success>
<ErrorLevel>0</ErrorLevel>
<Content>
<UserName />
<Password />
<VATNumber />
<ID>96297076</ID>
<LoginID>96386560</LoginID>
<CustomerType>Public</CustomerType>
<PaymentTerms>FullPaymentBeforeDespatch</PaymentTerms>
<EUVatExempt>false</EUVatExempt>
<BrandID>12</BrandID>
<SalesChannelID>36</SalesChannelID>
<SageAccountID>CompanyN</SageAccountID>
<FirstName>First</FirstName>
<LastName>Last</LastName>
<EmailAddress>email@test.com</EmailAddress>
<CompanyName>Company Name</CompanyName>
<TradingName>Trading Name</TradingName>
<TelNo />
<FaxNo />
<MobNo />
<Address1>Address1</Address1>
<Address2>Address2</Address2>
<TownCity>Town/City</TownCity>
<CountyRegion />
<Postcode>POSTCODE</Postcode>
<Country>United Kingdom</Country>
</Content>
<Errors />
</AddCustomerResult>
</AddCustomerResponse>
</s:Body>
</s:Envelope>
