[Fixed]-Braintree payments payment_method_nonce value is null

1👍

Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.

For the Drop-in, you don’t need to include any input tags, braintree.js will render an iframe with the form inputs inside the div specified in braintree.setup(...). Then when the user submits this form, the payment method nonce should be available to you server-side.

Your form should simply be

<form name="PaymentMethodForm" id="PaymentMethodForm" action="/payment_method/add/" method="POST">{% csrf_token %} 

  <div id="dropin-container"></div>

  <div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    <button type="button" id="submit" class="btn btn-default">Save</button>
    <input type="submit" class="cool-fc button swagbutton" value="Submit" id="submitbutton" name="submitbutton" style="display:none">
  </div>
</form>

If you would like more control over the styling still have the easiest level of PCI compliance, I would take look at Hosted Fields.

Hope this helps!

👤jerry

Leave a comment