Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const dropinConfig = {
- authorization: braintreeData.token,
- selector: "#dropin-container",
- threeDSecure: true
- };
- dropin.create(dropinConfig, (err, dropinInstance) => {
- if (err) {
- // Handle error
- }
- submit.addEventListener("click", event => {
- event.preventDefault();
- const amount = this.getAmount();
- const threeDSecure = {
- amount,
- email: user.email
- };
- // This prints out just before the modal appears
- console.log(
- "going to request payment method",
- threeDSecureRequestObject
- );
- dropinInstance.requestPaymentMethod(
- {
- threeDSecure: threeDSecureRequestObject
- },
- (err, payload) => {
- if (err) {
- this.setPaymentError("Failed to connect to payment gateway");
- // Reinitialize the form
- dropinInstance.teardown(() => {
- this.initializeBraintreeForm(this.props.braintreeData);
- });
- return;
- }
- // This prints out just after the modal appears
- console.log("done requesting, calling api...");
- // ... code that calls the API with the payment method nonce
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement