Integrating Braintree using Hosted Fields

The Hosted Fields integration allows you to create your own payment form using custom styles and layout. An iframe is added dynamically to the page using the Braintree JavaScript SDK. The iframe includes the Hosted Fields payment formWhen the customer submits the form, Hosted Fields collects the card details securely and attempts to tokenize them. If tokenization succeeds, you can send the generated token nonce to your view to make a transaction using the Python braintree module.

We will create a view for processing payments. The whole checkout process will work as follows:

  1. In the view, a client token is generated using the braintree Python module. This token is used in the next step to instantiate ...

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.