File: /home/awaldron/_accomods/_apibak/stripe_customer.php
<?php
require 'cors.php';
require 'vendor/autoload.php';
// INIT STRIP CONNECTION
$stripe = new \Stripe\StripeClient('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');
// FORMAT CUSTOMER DATA
//$json_str = file_get_contents('php://input');
//$json_obj = json_decode($json_str);
header('Content-Type: application/json');
try {
// retrieve JSON from POST body
$output = $stripe->customers->create([
'name' => 'Alan Waldron',
'email' => 'awaldron@buildinmotion.com',
'address' => [
'line1' => '342 Iris Dr.',
'line2' => '',
'city' => 'Pittsburgh',
'state' => 'PA',
'postal_code' => '15235'
],
'phone' => '412-400-2934',
'tax_exempt' => 'none'
]);
echo json_encode($output);
} catch (Error $e) {
http_response_code(500);
echo json_encode(['error' => $e->getMessage()]);
}