Skip to contentSkip to navigationSkip to topbar
On this page

TwiML™ Voice: <Parameter>


The TwiML <Pay> verb's <Parameter> noun allows you to:

  • send custom parameters to your payment processor when using a Generic Pay Connector
  • send ACH information not included as part of the <Pay> verb

<Parameter> attributes

parameter-attributes page anchor

The <Parameter> noun takes two attributes, name (for the name of the parameter) and value (for the value of the parameter). Both attribute values must be strings.


Send custom parameters using a Generic Pay Connector

send-custom-parameters-using-a-generic-pay-connector page anchor

If you are using a Generic Pay Connector, you can send custom parameters to your payment processor using the <Parameter> noun. This functionality could be used to send additional contextual information about the transaction. For example, you could inform the payment processor to waive fees, charge fees, process a refund, etc.
The <Parameter> noun is nested within the <Pay> verb's open and closing tags, and takes name and value attributes for the name and value of your custom parameter.
The example below shows a charge transaction using the <Parameter> noun to pass custom parameters to the payment processor.
You can also pass custom parameters for tokenize transactions in the same manner.
There is no limit to the number of custom parameters you can nest within a <Pay> verb.

Send custom parameters with <Parameter>Link to code sample: Send custom parameters with <Parameter>
1
const VoiceResponse = require('twilio').twiml.VoiceResponse;
2
3
const response = new VoiceResponse();
4
const pay = response.pay({
5
chargeAmount: '10.00',
6
paymentConnector: 'My_Generic_Pay_Connector',
7
action: 'https://your-callback-function-url.com/pay'
8
});
9
pay.parameter({
10
name: 'custom_parameter_1',
11
value: 'custom_value_1'
12
});
13
14
console.log(response.toString());

Output

1
<?xml version="1.0" encoding="UTF-8"?>
2
<Response>
3
<Pay chargeAmount="10.00" paymentConnector="My_Generic_Pay_Connector" action="https://your-callback-function-url.com/pay">
4
<Parameter name="custom_parameter_1" value="custom_value_1" />
5
</Pay>
6
</Response>

Send ACH information when accepting ACH payments

send-ach-information-when-accepting-ach-payments page anchor

The <Parameter> noun is a subelement within the <Pay> verb. This noun, <Parameter>, is required when accepting ACH payments in order to capture certain ACH information not included as part of the <Pay> verb to send to the payment provider. The value(s) that have to be captured by <Parameter> depend on the payment provider.

1
<Pay chargeAmount="10.0" description="pizza" paymentMethod="ach-debit" paymentConnector="myConnector" action="myactionurl">
2
<Parameter name="AVSName" value="CallerABC"/>
3
</Pay>

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.