SecureFields Bank Account
Before you can create an ACH charge, you must first collect and verify your customer’s bank account and routing number. In order to properly identify the bank account, you also need to collect the name of the person or business who owns the account. When a user enters a bank account, the information is converted to a token. The token can be used to send a payment request later, instead of using the actual bank account.

Adding HTML markup for SecureFields

1
<form id="ach-form">
2
<div class="form-group">
3
<label>Routing Number</label>
4
<div id="routing-number"></div>
5
</div>
6
<div class="form-group">
7
<label>Account Number</label>
8
<div id="account-number"></div>
9
</div>
10
<div class="form-group">
11
<label>First name</label>
12
<div id="first-name"></div>
13
</div>
14
<div class="form-group">
15
<label>Last name</label>
16
<div id="last-name"></div>
17
</div>
18
<div class="form-group">
19
<label>&nbsp;</label>
20
<div class="d-flex">
21
<button type="submit" id="btn-create-card" class="btn btn-success mr-3">Create Bank Account</button>
22
</div>
23
</div>
24
</form>
Copied!

Initializing JS SDK

1
PayEngine.SecureFields.create().then((form) => {
2
const cardName = form.field("#routing-number", {
3
type: "number",
4
name: "routing_number",
5
placeholder: "Routing Number",
6
validations: ["required"],
7
css,
8
});
9
form.field("#account-number", {
10
type: "number",
11
name: "account_number",
12
successColor: "#4F8A10",
13
errorColor: "#D8000C",
14
placeholder: "Account Number",
15
validations: ["required"],
16
css,
17
});
18
form.field("#first-name", {
19
type: "text",
20
name: "first_name",
21
successColor: "#4F8A10",
22
errorColor: "#D8000C",
23
placeholder: "First Name",
24
validations: ["required"],
25
css,
26
});
27
form.field("#last-name", {
28
type: "text",
29
name: "last_name",
30
successColor: "#4F8A10",
31
errorColor: "#D8000C",
32
placeholder: "Last Name",
33
validations: ["required"],
34
css,
35
});
36
document.getElementById('ach-form').addEventListener("submit", async (e) => {
37
e.preventDefault();
38
try {
39
const cardObj = await form.createBankAccount();
40
console.log({ cardObj });
41
} catch (e) {
42
console.log(JSON.stringify(e));
43
}
44
});
45
});
Copied!
​