简体   繁体   中英

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();
      });
    });
  });

在此处输入图像描述

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

Unless you pass line item information, an amount will not show during the PayPal checkout approval process.

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

commit: true,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM