post https://secure.fusebill.com/v1/paymentMethods/achCard
This function allows you to create a new ACH card payment method for a customer. It returns the newly created Payment Method on success.
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
customerId | Integer | This is the customer Id for the customer that this payment method is attached to. | Yes |
accountNumber | Integer | This is the ACH account number for this payment method. | Yes |
transitNumber | Integer | This is the ACH transit number for this payment method. | Yes |
bankAccountType | Enum: {CHQ, SAV} | This the identifier for the card type. | Yes |
firstName | String | This is the first name associated with the card. [Max Length: 50 characters] | Yes |
lastName | String | This is the last name associated with the card. [Max Length: 50 characters] | Yes |
address1 | String | This is the address associated with the card. [Max Length: 50 characters] | Yes if Address Verification Services is in use |
address2 | String | This is the address associated with the card. [Max Length: 50 characters] | Yes if Address Verification Services is in use |
countryId | Integer | This is the Fusebill generated country code. Call (Read Country ID)[https://developer.fusebill.com/reference#read-country-id] to find the appropriate code | Yes if Address Verification Services is in use |
stateId | Integer | This is the Fusebill generated state code. Call (Read Country ID)[https://developer.fusebill.com/reference#read-country-id] to find the appropriate code | Yes if Address Verification Services is in use |
city | String | This is the city associated with the address associated with the card. [Max Length: 50 characters] | Yes if Address Verification Services is in use |
postalZip | String | This is the regional location code (eg. ZIP code in the USA) associated with the address associated with the card. [Max Length: 10 characters] | Yes if Address Verification Services is in use |
source | Enum: {Manual, Automatic, SelfServicePortal} | This is the payment source. | Yes |
paymentCollectOptions | Object. Defined Below | If the card is validated successfully, this object is used to collect a specified amount | Optional |
Payment Collect Options Object
Property | Type | Description |
---|---|---|
collectionAmount | Decimal | The amount to be collected |
Examples
curl -X POST "https://secure.fusebill.com/v1/paymentMethods/achCard" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{customerId:{customerId},accountNumber:'01234567890',transitNumber:'1234',bankAccountType:'CHQ',firstName:'John',lastName:'Doe',address1:'232 Herzberg Road',address2:'Suite 203',countryId:124,stateId:9,city:'Kanata',postalZip:'K2K 2A1',source:'Manual'}"
//Json Payload
string jsonData =
"{customerId:{customerId},accountNumber:'01234567890',transitNumber:'1234',bankAccountType:'CHQ',firstName:'John',lastName:'Doe',address1:'232 Herzberg Road',address2:'Suite 203',countryId:124,stateId:9,city:'Kanata',postalZip:'K2K 2A1',source:'Manual'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/paymentMethods/achCard");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic " + apiKey);
//Set request method
request.Method = "POST";
//Add the json data to request
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
streamWriter.Write(jsonData);
streamWriter.Flush();
streamWriter.Close();
}
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
result = streamReader.ReadToEnd();
}
#Import library JSON
import json
#Import library Requests
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic xyz', 'Content-Type' : 'application/json'}
#Pass in a dictionary to the Payload parameter
payload = {"customerId":186838,"accountNumber":'01234567890',"transitNumber":'1234',"bankAccountType":'CHQ',"firstName":'John',"lastName":'Doe',"address1":'232 Herzberg Road',"address2":'Suite 203',"countryId":124,"stateId":9,"city":'Kanata',"postalZip":'K2K 2A1',"source":'Manual'}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/paymentMethods/achCard', data=json.dumps(payload), headers=headers)
print(r.content)
{
"accountNumber": "123457832156",
"transitNumber": "12345",
"bankAccountType": "CHQ",
"firstName":"James",
"lastName":"McHenry",
"address1": "98 Roberts St",
"address2": "",
"city": "Chicago",
"stateId": 1,
"countryId": 124,
"postalZip": "V9V 9V9",
"makeDefault": true,
"customerId": 669521,
"source": "Manual"
}
Response
{
"maskedAccountNumber":"****7890",
"maskedTransitNumber":"****1234",
"bankAccountType":"CHQ",
"customerId":172677,
"firstName":"John",
"lastName":"Doe",
"address1":"232 Herzberg Road",
"address2":"Suite 203",
"countryId":124,
"country":"CAN",
"stateId":9,
"state":"Ontario",
"city":"Kanata",
"postalZip":"K2K 2A1",
"isDefault":false,
"externalCustomerId":null,
"externalCardId":null,
"storedInFusebillVault":true,
"id":82628,
"uri":null
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "achCard",
"Value": "Required property 'firstName' not found in JSON. Path '', line 17, position 1."
},
{
"Key": "achCard.FirstName",
"Value": "The FirstName field is required."
},
{
"Key": "achCard.LastName",
"Value": "The LastName field is required."
}
]
}