ACH

The ACH Payment Method

When initializing the ACH payment method, the developer is expected to provide a redirectURI and transactionID.

Methods

aCH.js
JS
JavaScript

const ach = await payments.ach({

  redirectURI: 'https://localhost:1780/',

  transactionId: '123',

)};



const achButton = document.getElementById('ach-button')

const buyerNameField = document.getElementById('buyer-name-field');



ach.addEventListener('ontokenization', (event) => {

  const { tokenResult, error } = event.detail;



  if (error) {

    const errorMessage = `Tokenization failed with status: ${error}`;

    throw new Error(errorMessage);

  }



  if (tokenResult.status === 'OK') {

    console.log('got payment token: ', tokenResult.token);

  }

});



achButton.onclick = () => {

  try {

    ach.tokenize({ accountHolderName: buyerNameField.value });

  }

  catch (e) {

    // handle error

  }

}