<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: X-Requested-With, content-type, X-Token, x-token');
require_once('vendor/autoload.php');
\Stripe\Stripe::setApiKey($_POST['clientSecretKey']);

$token = $_POST['token'];

$customer = \Stripe\Customer::create(array(
    "source" => $token,
    "email" => $_POST['email']
));
// Save the customer id in your own database!
echo json_encode($customer);
?>