Search code examples
twilioadyen

How to use ACH-Debit over Pay verb using Adyen Connector


I'm trying to use the Pay verb using the Adyen connector, I'm using the following settings for testing:

exports.handler = function(context, event, callback) {
  let twiml = new Twilio.twiml.VoiceResponse();
  console.log('Event', event);
  if (event?.completed === 'true') {
    twiml.say('Payment completed');
  } else {
    twiml.say('Hello and welcome to Pay, I will ask you some information about your check');
    twiml.pause({
      length: 3,
    });
    twiml.pay({
      chargeAmount: '1.00',
      action: '/pay-check?completed=true',
      timeout: 10,
      minPostalCodeLength: 5,
      paymentConnector: "xxxxxx", 
      tokenType: 'one-time',
      currency: 'usd',
      language: 'en-US', // es-MX
      description: 'Testing check payment',
      paymentMethod: 'ach-debit',
      maxAttempts: 3,
    });
  }
  return callback(null, twiml);
};

When I call, it asks me for the Bank Routing Number and I use: 121000358, and then it asks me for Bank Account Number and I use: 123456789, those values come from the Adyen documentation: https://docs.adyen.com/development-resources/testing/test-card-numbers#ach

But, if I test it, it returns:

Error code 14_031 with Adyen Connector API message: HTTP Exception

Like the Bank Account Number is not being sent to the Adyen API or something, so maybe someone knows what is happening or if I did something wrong 🤔

We already contacted the support team at Twilio but trying to win some time here :P

Thanks!


Solution

  • For those who might need it:

    Twilio needs a parameter set as a noun in the Pay verb: https://www.twilio.com/docs/voice/twiml/pay/twiml-voice-parameter#send-ach-information-when-accepting-ach-payments

    The parameter AVSName is the Bank Account Holder (in this case, using Adyen), so for example using my previous source, the source would be something like

    const pay = twiml.pay({
          chargeAmount: '1.00',
          action: '/pay-check?completed=true',
          timeout: 10,
          minPostalCodeLength: 5,
          paymentConnector: "xxxxxx", 
          tokenType: 'one-time',
          currency: 'usd',
          language: 'en-US', // es-MX
          description: 'Testing check payment',
          paymentMethod: 'ach-debit',
          maxAttempts: 3,
    });
    pay.parameter({
          name: 'AVSName',
          value: 'John Doe',
    });
    

    And that should cover the issue here (remember that you need to have ACH-Debit enabled in your Adyen account)