条纹使多个客户使用相同的电子邮件地址
2022-08-30 14:20:01
我有带子检查与php。它创建客户并向他们收费。我想创建一个捐赠表单,如果同一客户回来并使用相同的电子邮件地址提供,Stripe不会创建另一个客户,而是向现有客户收取额外的付款。这可能吗?或者结账是否总是使用新客户 ID 创建新客户?
这是我的收费.php
<?php
require_once('config.php');
$token = $_POST['stripeToken'];
if($_POST) {
$error = NULL;
try{
if(!isset($_POST['stripeToken']))
throw new Exception("The Stripe Token was not generated correctly");
$customer = Stripe_Customer::create(array(
'card' => $token,
'email' => $_POST['stripeEmail'],
'description' => 'Thrive General Donor'
));
$charge = Stripe_Charge::create(array(
'customer' => $customer->id,
'amount' => $_POST['donationAmount'] * 100,
'currency' => 'usd'
));
}
catch(Exception $e) {
$eror = $e->getMessage();
}
}
?>