Last active
October 28, 2019 21:24
-
-
Save braintreeps/8bf7d6f17d6c3c34c0352d3e3f451cdd to your computer and use it in GitHub Desktop.
Deferred Client Code Snippet 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- add both the client script and the hosted fields script to the page --> | |
<script src="https://js.braintreegateway.com/web/3.55.0/js/client.min.js"></script> | |
<script src="https://js.braintreegateway.com/web/3.55.0/js/hosted-fields.min.js"></script> | |
<script> | |
// create the client instance using a client token or tokenization key | |
braintree.client.create({ | |
authorization: 'client_token_or_tokenization_key' | |
}, function (clientErr, clientInstance) { | |
// pass the client instance into the Hosted Fields create method | |
braintree.hostedFields.create({ | |
client: clientInstance, | |
// the rest of the Hosted Fields configuration goes here | |
}, function (hostedFieldsErr, hostedFieldsInstance) { | |
// finish by adding event listeners to trigger tokenization requests on a button click | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment