Create customer
Overview
Use the createCustomer method to add the details of a customer entity into the 2Checkout system. By default, customer status is Inactive until you assign a specific subscription to the customer. Following that action, customer status reflects the status of the attached subscription(s).
Parameters
Parameters | Type/Description |
---|---|
sessionID |
Required (string) |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
Object |
Response
Parameters | Type/Description |
---|---|
AvangateCustomerReference |
Int |
|
System-generated customer reference. |
Request
<?php require ('PATH_TO_AUTH'); $newCustomer = new stdClass(); $newCustomer->AvangateCustomerReference = null; $newCustomer->ExternalCustomerReference = 'ThisIsATestReference123456'; $newCustomer->FirstName = 'NewCustomer'; $newCustomer->LastName = 'NewCustomerLastName'; $newCustomer->Company = null; $newCustomer->FiscalCode = null; $newCustomer->Address1 = 'Address'; $newCustomer->Address2 = null; $newCustomer->City = 'LA'; $newCustomer->Zip = '90210'; $newCustomer->CountryCode = 'us'; $newCustomer->Phone = null; $newCustomer->Fax = null; $newCustomer->Email = 'newcustomer@email.com'; $newCustomer->ExistingCards = null; $newCustomer->Enabled = null; $newCustomer->Trial = null; $newCustomer->Language = 'en'; $jsonRpcRequest = array ( 'method' => 'createCustomer', 'params' => array($sessionID, $newCustomer), 'id' => $i++, 'jsonrpc' => '2.0'); var_dump (callRPC((Object)$jsonRpcRequest, $host, true));