我正在尝试在我的临时 Laravel 项目中实现 PayPal 和 Venmo。结果应该是这样的:
但是,当我集成它时,它只显示这些按钮:
有没有办法显示那个 Venmo 按钮?
这是代码,&enable-funding=venmo
包括在内
<div class="container">
<div class="row">
<div class="col-md-8">
</div>
<div class="col-md-4">
<div id="smart-button-container" style="margin-top: 5em;">
<div >
<div id="paypal-button-container"></div>
</div>
</div>
</div>
</div>
</div>
<script src="https://www.paypal.com/sdk/js?client-id={{env('APP_CLIENT_ID')}}&enable-funding=venmo¤cy=USD" data-sdk-integration-source="button-factory"></script>
<script>
function initPayPalButton() {
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'paypal',
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [
{
"amount":
{
"currency_code":"USD",
"value":1
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(orderData) {
console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
const element = document.getElementById('paypal-button-container');
element.innerHTML = '';
element.innerHTML = '<h3>Thank you for your payment!</h3>';
});
},
onError: function(err) {
console.log(err);
}
}).render('#paypal-button-container');
}
initPayPalButton();
</script>
参考:https ://www.paypal.com/merchantapps/appcenter/acceptpayments/checkout