我正在为条纹编写订阅代码正在运行,但付款已进入两次(两个付款行在条带上的付款部分为同一客户插入)。
$plan = \Stripe\Plan::create(array(
"name" => $plan_name,
"id" => $plan_name,
"interval" => "month",
"currency" => "usd",
"amount" => $amount_cents,
));
$customer = \Stripe\Customer::create(array(
'source' => $_POST['stripeToken'],
'email' => 'hp@ph1.com'
));
$subscription= \Stripe\Subscription::create(array(
"customer" => $customer->id,
"plan" => $plan->id,
));
$charge = \Stripe\Charge::create(array(
"amount" => $amount_cents,
"currency" => "usd",
"customer" => $customer->id,
)
);
答案 0 :(得分:1)
如果您订阅了您的客户的计划,那么为什么您还要收取费用。
只需删除以下代码
即可 try {
// Create a default MimeMessage object.
MimeMessage message = new MimeMessage(session);
// Set From: header field of the header.
message.setFrom(new InternetAddress(From));
// Set To: header field of the header.
message.addRecipient(Message.RecipientType.TO, new InternetAddress(To));
// Set Subject: header field
message.setSubject("Wishes!", "UTF-8");
// Now set the actual message
message.setContent(text, "text/html");// getting the text from WishesDAO.java
// Send message
Transport.send(message);
msg=message.toString();
}catch (MessagingException mex) {
mex.printStackTrace();
System.out.println(mex);
}