cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

Using accept.js in a single page app (react.js)

Hello!   We are looking to use Authorize.NET accept.js to maintain our SAQ-A compliance (we already do this with braintree and stripe).

 

I'm finding it very difficult to work with accept.js based on the documentation and I'm hoping what I wan't is do-able in a non-docmented way!

 

My big problem is this:

 

"IMPORTANT: When using the payment information form, be sure that your page loads the library after the button is defined."

 

The script seems to want to process the DOM as soon as it loads and find the attributes it needs.  This makes it extremely difficult to work with from a single page app perspective because if the user views the payment page, then decides to go back to add something else to the cart, and then goes to pay again... the script is already been loaded but now the form isn't being rendered.

 

What I want to be able to do is have accept.js give me a function to call and pass it the things that are necessary (is test mode, publish key, etc).   This is how it is done in braintree:

 

braintree.dropin.create({
      authorization: 'CLIENT_TOKEN_FROM_SERVER',
      container: '#dropin-container'
    }

and this is how it is done with stripe:

 

// Create an instance of the card Element
var card = elements.create('card', {style: style});

// Add an instance of the card Element into the `card-element` <div>
card.mount('#card-element');

This API style works *beautifully* on the web, because I can load the javascript file once but construct the payment form when I need it.

 

Is there some way to do this with accept.js?  The only way I've been able to come up with is building the form myself and then calling Accept.dispatch, but this would move us from SAQ-A to SAQ-A EP

 

Thanks!

sontek
Member
Who Me Too'd this topic