Php 带自定义表单symfony的条带签出
我有一个结帐表单,我用它将购物车的详细信息发送到不同的支付网关,比如使用Symfony和paypal 现在,我正试图发送付款细节,以防用户选择条带结帐选项。目前与stripe的集成工作正常,我可以发送付款并从stripe获得响应,但是为了向stripe发送信用卡详细信息,我被重定向到Php 带自定义表单symfony的条带签出,php,symfony,stripe-payments,payum,Php,Symfony,Stripe Payments,Payum,我有一个结帐表单,我用它将购物车的详细信息发送到不同的支付网关,比如使用Symfony和paypal 现在,我正试图发送付款细节,以防用户选择条带结帐选项。目前与stripe的集成工作正常,我可以发送付款并从stripe获得响应,但是为了向stripe发送信用卡详细信息,我被重定向到capture 我看到“用卡支付”按钮,如果我点击它,弹出窗口显示输入信用卡详细信息 我想做的是允许用户在我的结账表单上添加信用卡详细信息,而不是在弹出窗口中看到的表单。有可能做到这一点吗?如何使用自己的表单将数
capture
我看到“用卡支付”按钮,如果我点击它,弹出窗口显示输入信用卡详细信息
我想做的是允许用户在我的结账表单上添加信用卡详细信息,而不是在弹出窗口中看到的表单。有可能做到这一点吗?如何使用自己的表单将数据发送到条带,而不是使用条带弹出窗口
我在和示例中找到了一个过程的接近示例。有条纹的例子吗?非常感谢您的帮助。这是Javascript中条带的一个示例: 包括Stripe.js
<script type="text/javascript" src="https://js.stripe.com/v2/"></script>
发送数据:
Stripe.card.createToken({
number: $('.card-number').val(),
cvc: $('.card-cvc').val(),
exp_month: $('.card-expiry-month').val(),
exp_year: $('.card-expiry-year').val()
}, stripeResponseHandler);
答复:
function stripeResponseHandler(status, response) {
var $form = $('#payment-form');
if (response.error) {
// Show the errors on the form
$form.find('.payment-errors').text(response.error.message);
$form.find('button').prop('disabled', false);
} else {
// response contains id and card, which contains additional card details
var token = response.id;
// Insert the token into the form so it gets submitted to the server
$form.append($('<input type="hidden" name="stripeToken" />').val(token));
// and submit
$form.get(0).submit();
}
}
函数stripeResponseHandler(状态、响应){
var$form=$(“#付款单”);
if(response.error){
//在表单上显示错误
$form.find('.payment errors').text(response.error.message);
$form.find('button').prop('disabled',false);
}否则{
//响应包含id和卡,其中包含其他卡详细信息
var token=response.id;
//将令牌插入表单,以便将其提交到服务器
$form.append($('').val(标记));
//并提交
$form.get(0.submit();
}
}
有关更多详细信息,请查看此链接
条带签出就是这样设计的。你看到按钮,点击它,填写所有需要的信息,就这样 如果你想提前填写信用卡详细信息,你可以这样做,但在这种情况下,你必须使用
- 条纹“直接”。在Omnipay中实现并通过Omnipay桥接器使用
- 您必须像这样通过omnipay信用卡():
$order->setDetails(数组)(
“卡”=>新信用卡($data),
));
- 并使用
代替重定向。因为信用卡并没有保存到数据库中,所以您必须立即处理它们。()$this->forward
- 并使用
function stripeResponseHandler(status, response) {
var $form = $('#payment-form');
if (response.error) {
// Show the errors on the form
$form.find('.payment-errors').text(response.error.message);
$form.find('button').prop('disabled', false);
} else {
// response contains id and card, which contains additional card details
var token = response.id;
// Insert the token into the form so it gets submitted to the server
$form.append($('<input type="hidden" name="stripeToken" />').val(token));
// and submit
$form.get(0).submit();
}
}