public static function Braintree_Customer::create in Commerce Braintree 7
Creates a customer using the given +attributes+. If <tt>:id</tt> is not passed, the gateway will generate it.
<code> $result = Braintree_Customer::create(array( 'first_name' => 'John', 'last_name' => 'Smith', 'company' => 'Smith Co.', 'email' => 'john@smith.com', 'website' => 'www.smithco.com', 'fax' => '419-555-1234', 'phone' => '614-555-1234' )); if($result->success) { echo 'Created customer ' . $result->customer->id; } else { echo 'Could not create customer, see result->errors'; } </code>
@access public
Parameters
array $attribs:
Return value
object Result, either Successful or Error
28 calls to Braintree_Customer::create()
- Braintree_Customer::createNoValidate in braintree_php/
lib/ Braintree/ Customer.php - attempts the create operation assuming all data will validate returns a Braintree_Customer object instead of a Result
- Braintree_CustomerTest::testCreate in braintree_php/
tests/ integration/ CustomerTest.php - Braintree_CustomerTest::testCreateWithInvalidUTF8Bytes in braintree_php/
tests/ integration/ CustomerTest.php - Braintree_CustomerTest::testCreateWithValidUTF8Bytes in braintree_php/
tests/ integration/ CustomerTest.php - Braintree_CustomerTest::testCreate_blankCustomer in braintree_php/
tests/ integration/ CustomerTest.php
File
- braintree_php/
lib/ Braintree/ Customer.php, line 89
Class
- Braintree_Customer
- Creates and manages Customers
Code
public static function create($attribs = array()) {
Braintree_Util::verifyKeys(self::createSignature(), $attribs);
return self::_doCreate('/customers', array(
'customer' => $attribs,
));
}