Search code examples
javascriptpythonflaskpaypalbraintree

Amount not showing in PayPal payment in Braintree


Hi the amount does not display in paypal when making payment. The JavaScript code is shown below:

  var form = document.querySelector('#payment-form');
  var client_token = '{{ client_token }}';

  braintree.dropin.create({
    authorization: client_token,
    container: '#bt-dropin',
    card: {
    cardholderName: {
      required: true
    }
    },
    applePay: {
    displayName: 'Merchant Name',
    paymentRequest: {
    label: 'Localized Name',
    total: '10.00'
    }
    },
    paypal: {
    flow: 'checkout',
    amount: '10.00',
    currency: 'USD'
    },
    paypalCredit: {
    flow: 'checkout',
    amount: '10.00',
    currency: 'USD'
    },
    venmo: true

  }, function (createErr, instance) {
        if (createErr) {
        // Handle any errors that might've occurred when creating Drop-in
        console.error(err);
        return;
        }

    form.addEventListener('submit', function (event) {
      event.preventDefault();

      instance.requestPaymentMethod(function (err, payload) {
        if (err) {
          console.log('Error', err);
          return;
        }
        // Add the nonce to the form and submit
        document.querySelector('#nonce').value = payload.nonce;
        form.submit();
      });
    });
  });

enter image description here

From the code, the amount is $10, but does not display in the PayPal payment page. Please what am i doing wrong?


Solution

  • very simple. I included the following to paypal option in the code :

    commit: true,