Argument | Type | Details |
---|---|---|
Authentication | ApiAuthenticationType | |
Authentication.DealerId | Int | Your Dealer ID |
Authentication.SubAccountId | Int | (optional) Your SubAccount ID |
Authentication.ApiKey | String | Your API Key |
Customer | CustomerType | |
Customer.Company | String | |
Customer.Email | String | |
Customer.Phone | String | Phone Number - Only numerical values; no dashes or spaces |
Customer.Fname | String | |
Customer.Lname | String | |
Customer.Address1 | String | |
Customer.Address2 | String | |
Customer.City | String | |
Customer.State | String | |
Customer.Zip | String | |
Customer.Country | String | Two-letter ISO 3166 country code. For a complete list, click here |
ContractNo | String | Contract P.O # |
WarrantySku | String | Warranty Sku No |
notification | String | (Optional) Values expected: "Letter" or "Email". |
SubAgentCode | String | (Optional). |
MonthsPrepaid | integer | (Optional). |
Argument | Type | Details |
---|---|---|
Ack | String | success / fail |
Errors | ErrorsType | |
Errors.ErrorID | Int | Error Number |
Errors.ErrorMessage | String | Detailed error message |
WarrantyNo | String | success (cps warranty # generate) / fail (empty string) |
OrderAmt | String | success (order total amount) / fail (0) |
LoginLink | String | success (token client link generate) / fail (empty string) |
OrderId | String | success (cps order id ) / fail (0) |
const SoapServer = "https://www.consumerpriorityservice.com/services/affinity_api.asmx?wsdl" set xmldom = server.CreateObject("Microsoft.XMLDOM") set xmlhttp = server.CreateObject("Microsoft.XMLHTTP") xmlhttp.open "POST", SoapServer, false xmlhttp.setRequestHeader "Man", POST & " " & SoapServer & " HTTP/1.1" xmlhttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8" xmlhttp.setRequestHeader "SOAPAction", "http://www.consumerpriorityservice.com/services/CreateAffinityOrder" StrSoap = StrSoap & "<?xml version=""1.0"" encoding=""utf-8""?>" StrSoap = StrSoap & "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" StrSoap = StrSoap & "<soap:Body>" StrSoap = StrSoap & "<CreateAffinityOrder xmlns=""http://www.consumerpriorityservice.com/services/"">" StrSoap = StrSoap & "<CreateAffinityOrderRequest>" StrSoap = StrSoap & "<Authentication>" StrSoap = StrSoap & "<DealerId>DEALERID</DealerId>" StrSoap = StrSoap & "<SubAccountId>SUBACCOUNTID</SubAccountId>" StrSoap = StrSoap & "<ApiKey>APIKEY</ApiKey>" StrSoap = StrSoap & "</Authentication>" StrSoap = StrSoap & "<Customer>" StrSoap = StrSoap & "<Company>COMPANY</Company>" StrSoap = StrSoap & "<Fname>FIRSTNAME</Fname>" StrSoap = StrSoap & "<Lname>LASTNAME</Lname>" StrSoap = StrSoap & "<Address1>ADDRESS1</Address1>" StrSoap = StrSoap & "<Address2>ADDRESS2</Address2>" StrSoap = StrSoap & "<City>CITY</City>" StrSoap = StrSoap & "<State>STATE</State>" StrSoap = StrSoap & "<Zip>ZIP</Zip>" StrSoap = StrSoap & "<Country>COUNTRY</Country>" StrSoap = StrSoap & "<Email>EMAIL</Email>" StrSoap = StrSoap & "<Phone>PHONE</Phone>" StrSoap = StrSoap & "</Customer>" StrSoap = StrSoap & "<ContractNo>XXXXXX</ContractNo>" StrSoap = StrSoap & "<WarrantySku>XXXXXX</WarrantySku>" StrSoap = StrSoap & "</CreateAffinityOrderRequest>" StrSoap = StrSoap & "</CreateAffinityOrder>" StrSoap = StrSoap & "</soap:Body>" StrSoap = StrSoap & "</soap:Envelope>" xmlhttp.send(StrSoap) if xmlhttp.Status = 200 then Set xmldom = xmlhttp.responseXML 'NO SERVER ERROR 'CHECK FOR API ERROR Response.write(xmlhttp.responseText) Else 'SERVER ERROR Response.Write(xmlhttp.responseText) End if set xmlhttp = nothing set xmldom = nothing
Create a Web Reference named "cpsapi" with URL https://www.consumerpriorityservice.com/services/affinity_api.asmx
Dim CreateOrder As New cpsapi.CreateAffinityOrderRequestType CreateOrder.Authentication = New cpsapi.AuthenticationType CreateOrder.Authentication.DealerId = DEALERID CreateOrder.Authentication.ApiKey = "DEALERKEY" CreateOrder.Customer = New cpsapi.CustomerType CreateOrder.Customer.Company = "Company" CreateOrder.Customer.Fname = "FirstName" CreateOrder.Customer.Lname = "LastName" CreateOrder.Customer.Address1 = "Address1" CreateOrder.Customer.Address2 = "Address2" CreateOrder.Customer.City = "City" CreateOrder.Customer.State = "State" CreateOrder.Customer.Zip = "Zip" CreateOrder.Customer.Country = "Country" CreateOrder.Customer.Email = "Email" CreateOrder.Customer.Phone = "Phone" CreateOrder.ContractNo = "XXXXXX" CreateOrder.WarrantySku = "XXXXXX" Dim m4 As New cpsapi.CpsServices Dim response4 As cpsapi.CreateAffinityOrderResponseType response4 = m4.CreateAffinityOrder(CreateOrder) If response4.Ack = "success" Then Response.Write("SUCCESS CreateAffinityOrder") Else For i As Integer = 0 To response4.Errors.GetUpperBound(0) Response.Write("CreateAffinityOrder ERROR: " & response4.Errors(i).ErrorMessage) Next End If
<?php require_once('nusoap/lib/nusoap.php'); $soapaction = "http://www.consumerpriorityservice.com/services/CreateAffinityOrder"; $wsdl = "https://www.consumerpriorityservice.com/services/affinity_api.asmx"; $namespace = "http://www.consumerpriorityservice.com/services/"; $xml = '<CreateAffinityOrder xmlns="http://www.consumerpriorityservice.com/services/"> <CreateAffinityOrderRequest> <Authentication> <DealerId>DEALERID</DealerId> <SubAccountId>SUBACCOUNTID</SubAccountId> <ApiKey>APIKEY</ApiKey> </Authentication> <Customer> <Company>COMPANY</Company> <Fname>FIRSTNAME</Fname> <Lname>LASTNAME</Lname> <Address1>ADDRESS1</Address1> <Address2>ADDRESS2</Address2> <City>CITY</City> <State>STATE</State> <ZIP>ZIP</ZIP> <Country>COUNTRY</Country> <Email>Email</Email> <Phone>PHONE</Phone> </Customer> <ContractNo>XXXXXX</ContractNo> <WarrantySku>XXXXXX</WarrantySku> </CreateAffinityOrderRequest> </CreateAffinityOrder>'; $client = new nusoap_client($wsdl); $err = $client->getError(); if ($err) { echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; } $client->soap_defencoding = 'UTF-8'; $mysoapmsg = $client->serializeEnvelope($xml); echo str_replace("><","><br/>",htmlspecialchars($client->serializeEnvelope($xml))); $result = $client->send($mysoapmsg, $soapaction); echo '<h2>Request</h2><pre>' . str_replace("><","><br/><",htmlspecialchars($client->request, ENT_QUOTES)) . '</pre>'; echo '<h2>Response</h2><pre>' . str_replace("><","><br/><",htmlspecialchars($client->response, ENT_QUOTES)) . '</pre>'; echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>'; ?>