summaryrefslogtreecommitdiff
path: root/fs_selfservice/php/freeside_signup_example.php
blob: 8b1dc193c6ef25b55bf777f9916e6b0c7ece2c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?

require('freeside.class.php');
$freeside = new FreesideSelfService();

$response = $freeside->new_customer( array(
  'agentnum'       => 1,

  'first'          => $_POST['first'],
  'last'           => $_POST['last'],
  'address1'       => $_POST['address1'],
  'address2'       => $_POST['address2'],
  'city'           => $_POST['city'],
  'state'          => $_POST['state'],
  'zip'            => $_POST['zip'],
  'country'        => 'US',
  'daytime'        => $_POST['daytime'],
  'fax'            => $_POST['fax'],

  'payby'          => 'BILL',
  'invoicing_list' => $_POST['email'],

  'pkgpart'        => 2,
  'username'       => strtolower($_POST['username']),
  '_password'      => strtolower($_POST['password'])
) );

error_log("[new_customer] received response from freeside: $response");
$error = $response['error'];

if ( ! $error ) {

    // sucessful signup

    $custnum = $response['custnum'];

    error_log("[new_customer] signup up with custnum $custnum");

} else {

    // unsucessful signup

    error_log("[new_customer] signup error:: $error");

    // display error message to user

}

?>