post https://secure.fusebill.com/v1/paymentMethodImport/Stripe
This API endpoint allows a user to import Stripe credit card data from the Stripe vault for a given customer
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
customerId | Integer | Fusebill ID of the target customer | Yes |
stripeCustomerId | String | Stripe customer ID, prefixed by, and including "cus_". | Yes |
stripeCardId | String | The Stripe card id, prefixed by, and including "card_". This must be an existing card associated with the stripe customer. It may return the error message "No such source: ..." if the card is not found. | Yes |
Examples
curl -X POST "https://secure.fusebill.com/v1/paymentMethodImport/Stripe" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{customerId:1,stripeCustomerId:{id},stripeCardId:{id}}"
//Json Payload
string jsonData = "{'customerId':{id},'stripeCustomerId':{id},'stripeCardId':{id}}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/paymentMethodImport/Stripe");
//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 {APIKey}', 'Content-Type' : 'application/json'}
#Pass in a dictionary to the Payload parameter
payload ={'customerId':{id},'stripeCustomerId':{id},'stripeCardId':{id}}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/paymentMethodImport/Stripe', data=json.dumps(payload), headers=headers)
print(r.content)
{
"customerId":2526546,
"stripeCustomerId": "cus_AExsNjBZDLMNDK",
"stripeCardId": "card_19uTyBAXix6Ggd0efp4HNNp7"
}
Response
{
"maskedCardNumber": "************4242",
"cardType": "Visa",
"expirationMonth": 11,
"expirationYear": 17,
"customerId": 186838,
"firstName": "John",
"lastName": "Doe",
"address1": "",
"address2": "",
"countryId": null,
"country": "",
"stateId": null,
"state": "",
"city": "",
"postalZip": "",
"isDefault": false,
"externalCustomerId": "cus_AExsNjBZDLMNDK",
"externalCardId": "card_19uTyBAXix6Ggd0efp4HNNp7",
"storedInFusebillVault": false,
"id": 92657,
"uri": null
}
{
"ErrorId": 0,
"HttpStatusCode": 404,
"Errors": [
{
"Key": "Api Error",
"Value": "Customer with id 1325 not found."
}
]
}