Skip to content

Latest commit

 

History

History
38 lines (33 loc) · 1.06 KB

CUSTOMER.md

File metadata and controls

38 lines (33 loc) · 1.06 KB

Associating a customer to a charge

You have two options to add a customer:

  • Add a customer in the moment to create a charge:
$address = new Address();
$address->street('Street 3')
        ->number('10')
        ->neighborhood('Bauxita')
        ->zipcode('35400000')
        ->city('Ouro Preto')
        ->state('MG');

$customer = new Customer();
$customer->name('Gorbadoc Oldbuck')
         ->email('oldbuck@gerencianet.com.br')
         ->document('04267484171')
         ->birth('1977-01-15')
         ->phoneNumber('5044916523')
         ->address($address); // This address is a shipping address and it is optional.

$response = $apiGN->createCharge()
                  ...
                  ->customer($customer)
                  ->run()
                  ->response();
  • Add a customer after create a charge:
$chargeId = ''; // The value returned by createCharge function
$response = $apiGN->createCustomer()
                  ->chargeId($chargeId)
                  ->customer($customer)
                  ->run()
                  ->response();