put https://secure.fusebill.com/v1/paymentMethods/achCard
This function allows you to replace an ACH card payment method on a customer. It returns the updated Payment Method on success, which will have a new Fusebill generated ID
GET/PUT pattern
Since the DTO returned by the GET methods contain masked account numbers (e.g. '***1234'), the usual GET/PUT pattern does not work for updating ACH cards. To update this payment method, read the DTO from a GET, then add in the unmasked
accountNumber
andtransitNumber
. Use that JSON as the payload for this PUT request
Request Parameters
Property | Type | Description |
---|---|---|
id | Integer | The id of the payment method to update. |
customerId | Integer | This is the Fusebill generated customer ID for the customer that this payment method is attached to. |
accountNumber | Integer | This is the ACH account number for this payment method. |
transitNumber | Integer | This is the ACH transit number for this payment method. |
bankAccountType | Enum: {CHQ, SAV} | This the identifier for the card type. |
firstName | String | This is the first name associated with the card. [Max Length: 50 characters] |
lastName | String | This is the last name associated with the card. [Max Length: 50 characters] |
address1 | String | This is the address associated with the card. This is required if Address Verification Services is in use. [Max Length: 50 characters] |
address2 | String | This is the address associated with the card. This is required if Address Verification Services is in use. [Max Length: 50 characters] |
countryId | Decimal | This is the Fusebill generated country code. Call Read Country ID to find the appropriate code |
stateId | Decimal | This is the Fusebill generated state code. Call Read Country ID to find the appropriate code |
city | String | This is the city associated with the address associated with the card. This is required if Address Verification Services is in use. [Max Length: 50 characters] |
postalZip | String | This is the regional location code (eg. ZIP code in the USA) associated with the address associated with the card. This is required if Address Verification Services is in use. [Max Length: 10 characters] |
paymentCollectOptions | Object. Defined Below | If the card is validated successfully, this object is used to collect a specified amount |
Payment Collect Options Object
Property | Type | Description |
---|---|---|
collectionAmount | Decimal | The amount to be collected |
Examples
curl -X PUT "https://secure.fusebill.com/v1/paymentMethods/achCard" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{id:{paymentMethodId},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 =
"{id:{paymentMethodId},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 = "PUT";
//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 {APIKey}', 'Content-Type' : 'application/json'}
#Pass in a dictionary to the Payload parameter
payload = {"id":{id},"customerId":{id},"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.put('https://secure.fusebill.com/v1/paymentMethods/achCard', data=json.dumps(payload), headers=headers)
print(r.content)
{
"accountNumber": "123457832156",
"transitNumber": "12345",
"bankAccountType": "CHQ",
"customerId": 654144,
"firstName": "James",
"lastName": "Waterlance",
"address1": "98 Roberts St",
"address2": "",
"countryId": 124,
"country": "CAN",
"stateId": 1,
"state": "Alberta",
"city": "Chicago",
"postalZip": "V9V 9V9",
"isDefault": true,
"externalCustomerId": null,
"externalCardId": null,
"storedInFusebillVault": true,
"email": null,
"modifiedDate": "2019-12-28T22:12:25.1400826Z",
"originalPaymentMethodId": null,
"id": 215714,
"uri": null
}
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": "Api Error",
"Value": "Cannot edit payment method 214611 because it has been deleted."
}
]
}