Braintree Card Token Import

This method takes a Braintree customer ID and payment method token and latches it to the Fusebill customer. The payment method remains in the Braintree vault but is usable through Fusebill. Once imported, the payment method can be employed in the usual way with the Fusebill generated payment method ID.

Request Parameters

PropertyTypeDescriptoinRequired
customerIdIntegerThe Fusebill generated customer IDYes
braintreeCustomerIdStringThe ID uniquely identifying the customer in BraintreeYes
braintreeCardIdStringThe ID of the Braintree cardYes
Examples
curl -X POST "https://secure.fusebill.com/v1/paymentMethodImport/Braintree \ 
-H "Content-Type: application/json" \ 
-H "Authorization: Basic {APIKey}" \ 
-d "{customerId:{customerId}, braintreeCustomerId:{ID}, braintreeCardId:{ID}}"
//Json Payload 
 string jsonData ="{customerId:{customerId}, braintreeCustomerId:{ID}, braintreeCardId:{ID}}" 
//Setup API key 
string apiKey = "{APIKey}"; 
//Configure URI 
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/paymentMethodImport/Braintree "); 
//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 Requests 
import requests 
#Import library json 
import json 
#Define your payload parameters  
payload = {"customerid":{CustomerID}," braintreeCustomerId ":{ID}",  braintreeCardId ": "{ID}"} 
#Define your header parameters 
headers = {'Authorization' : 'Basic {API Key}', 'Content-Type' : 'application/json'} 
#Pass in your header and payload and store your response object 
r = requests.post('https://secure.fusebill.com/v1/paymentMethodImport/Braintree',data=json.dumps(payload), headers=headers) 
print(r.content)
{
  "customerId":21314
  "braintreeCustomerId":"597374124"
  "braintreeCardId":"fy8sdk"
}
Response
{ 
  "maskedCardNumber": "************1111", 
  "cardType": "Visa", 
  "expirationMonth": 1, 
  "expirationYear": 23, 
  "customerId": 172677, 
  "firstName": "John", 
  "lastName": "Doe", 
  "address1": "232 Herzberg Road", 
  "address2": "Suite 203", 
  "countryId": 124, 
  "country": "", 
  "stateId": 9, 
  "state": "", 
  "city": "Kanata", 
  "postalZip": "K2K 2A1", 
  "isDefault": true, 
  "externalCustomerId": "597374124", 
  "externalCardId": "fy8sdk", 
  "storedInFusebillVault": false, 
  "id": 82620, 
  "uri": null 
}
{
    "ErrorId": 0,
    "HttpStatusCode": 404,
    "Errors": [
        {
            "Key": "Api Error",
            "Value": "Customer with id 1 not found."
        }
    ]
}
Language
Authorization