Je travaille avec braintree paypal caisse, il fonctionne très bien pour moi, mais je ne suis pas en mesure d'ajouter des taxes et frais d'expédition, j'ai essayé d'obtenir des informations, mais qui est aussi ne fonctionne pas pour moi, voici mon code actuel pour la caisse de BraintreeComment pouvons-nous ajouter des taxes et des frais d'expédition dans braintree paypal checkout
var form = document.querySelector('#payment-form');
var client_token = "<?php echo \Braintree\ClientToken::generate(); ?>";
// Render the PayPal button
paypal.Button.render({
// Pass in the Braintree SDK
braintree: braintree,
// Pass in your Braintree authorization key
client: {
sandbox: client_token,
production: '<insert production auth key>'
},
// Set your environment
env: 'sandbox', // sandbox | production
// Wait for the PayPal button to be clicked
payment: function(data, actions) {
// Make a call to create the payment
return actions.payment.create({
payment: {
transactions: [
{
amount: {
total: <?php echo $cart_total_amount; ?>,
currency: 'USD'
}
}
]
}
});
},
// Wait for the payment to be authorized by the customer
onAuthorize: function(data, actions) {
// Call your server with data.nonce to finalize the payment
console.log('Braintree nonce:', data.nonce);
// Get the payment and buyer details
return actions.payment.get().then(function(payment) {
$("div#divLoading").addClass('show');
console.log('Payment details:', payment);
var payment_id = payment.id;
var total_amount = '<?php echo $cart_total_amount; ?>';
$.ajax({
type: 'POST',
url : '<?php $_SERVER["DOCUMET_ROOT"] ?>/media/secure_checkout/create_order_braintree.php',
data : 'payment_id='+payment_id+'&total_amount='+total_amount,
dataType : 'json',
success: function(msg) {
$("div#divLoading").removeClass('show');
if(msg.status == '1') {
//$("#myModal").modal('show');
document.location.href= 'http://<?php echo $_SERVER['HTTP_HOST']; ?>/media/secure_checkout/checkout.php?payment=confirm';
}
},
error: function(msg) {
$("div#divLoading").removeClass('show');
}
});
});
}
}, '#paypal-button-container');
quelqu'un peut-il s'il vous plaît me dire ce que je dois faire pour ajouter la taxe et les frais d'expédition en elle?
Mais en cas de récurrence/abonnement, comment puis-je gérer la taxe? Le taux d'imposition est différent selon les provinces ou les pays. Alors ce n'est pas une bonne pratique de créer un plan différent en fonction de la place de l'acheteur. –