即使后端获取付款方式ID,我也会获得无效的付款网关。 我正在尝试从印度这样做,因此按照印度的规定,我必须在付款时提供地址和姓名。我猜我无法在这里整合该部分。请帮助我,这整整一整天仍未解决。
$user = auth()->user();
$paymentMethod = $request->payment_method;
$planId = $request->plan;
$city="my city";
$country="India";
$address="user address"
$zipCode="111111";
$state="Maharashtra";
$user->createOrGetStripeCustomer([
'email' => $user->email,
'name' => 'test',
'description' => 'test description',
"address" => ["city" => $city, "country" => $country, "line1" => $address, "line2" => "", "postal_code" => $zipCode, "state" => $state]
]);
$user->newSubscription('main', $planId)->create($paymentMethod);
return response([
'success_url'=> redirect()->intended('/')->getTargetUrl(),
'message'=>'success'
]);
这是前端代码
window.addEventListener('load', function() {
const stripe = Stripe('{{env('STRIPE_KEY')}}');
const elements = stripe.elements();
const cardElement = elements.create('card');
cardElement.mount('#card-element');
const cardHolderName = document.getElementById('card-holder-name');
const cardButton = document.getElementById('card-button');
const clientSecret = cardButton.dataset.secret;
const plan = document.getElementById('subscription-plan').value;
cardButton.addEventListener('click', async (e) => {
const { setupIntent, error } = await stripe.handleCardSetup(
clientSecret, cardElement, {
payment_method_data: {
billing_details: { name: cardHolderName.value }
}
}
);
if (error) {
// Display "error.message" to the user...
} else {
// The card has been verified successfully...
console.log('handling success', setupIntent.payment_method);
axios.post('/subscribe',{
payment_method: setupIntent.payment_method,
plan : plan
}).then((data)=>{
location.replace(data.data.success_url)
});
}
});
})
我的收银员版本是10.3
我也尝试过使用实时键。它显示相同的错误。谁能帮我吗?
答案 0 :(得分:0)
根据印度法规,只有注册的印度企业(即 独资企业、有限责任合伙企业和公司, 但不是个人)可以接受国际付款。更多信息 此处:https://stripe.com/docs/india-exports
所以测试不适用于 4242 4242 4242 4242 卡,没有注册业务的印度条纹账户......这件事让我浪费了 3 个小时..