Create a new customer
Last updated: 12-Aug-2025
Rate this article:
Overview
Use the createCustomer method to add the details of a customer entity into the Avangate 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. Avangate throws an exception if the values are incorrect. The sessionID expires in 10 minutes. | |
Customer | Object |
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';
// Add Credit object here
$newCustomer->Credit = new stdClass();
$newCustomer->Credit->Limit = 51.0; // float
$newCustomer->Credit->Remaining = 21.0; // float
$newCustomer->Credit->Currency = 'EUR'; // string
$jsonRpcRequest = array(
'method' => 'createCustomer',
'params' => array($sessionID, $newCustomer),
'id' => $i++,
'jsonrpc' => '2.0'
);
var_dump(callRPC((Object)$jsonRpcRequest, $host, true));
Response
Parameters | Type/Description |
---|---|
AvangateCustomerReference | Int |
System-generated customer reference. |
Rate this article: