[英]How to complete my stripe payment with symfony and intent payment API?
I try to put stripe on my website, it takes the payment but it still incomplete be cause "the customer doesn't have payement methods".我尝试在我的网站上添加条纹,它需要付款但仍然不完整,因为“客户没有付款方式”。 I dont understand how to resolve this issue.我不明白如何解决这个问题。
public function stripeAction(Request $request) {
\Stripe\Stripe::setApiKey('sk_test_UYs0lRfiKXpBymFf0Qlp2BOe00c5XJG5q1');
$paymethod = \Stripe\PaymentMethod::create([
'type' => 'card',
'card' => [
'number' => '4242424242424242',
'exp_month' => 2,
'exp_year' => 42,
'cvc' => '424',
],
]);
// dd($paymethod['card']['checks']);
$intent = \Stripe\PaymentIntent::create([
'amount' => 500,
'currency' => 'eur',
"payment_method_types" => ['card'],
'metadata' => ['integration_check' => 'accept_a_payment']
]);
}
The error seems quite straightforward to me: you've create a PaymentIntent
, without a payment_method
property.这个错误对我来说似乎很简单:你创建了一个PaymentIntent
,没有一个payment_method
属性。 As you also didn't set a customer
property (which could imply a preferred payment_method
), Stripe does not know which payment method to use for the intent.由于您还没有设置customer
属性(这可能意味着首选的payment_method
),Stripe 不知道该意图使用哪种付款方式。
$intent = \Stripe\PaymentIntent::create([
'amount' => 500,
'currency' => 'eur',
'payment_method_types' => ['card'],
'metadata' => ['integration_check' => 'accept_a_payment'],
'payment_method' => $paymethod->id
]);
Docs here: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method此处的文档: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.