post https://secure.fusebill.com/v1/Paypal
This API endpoint allows a user to create a Paypal Billing Agreement ID (BAID) in Fusebill.
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
token | Decimal | Corresponds to the Paypal Payee ID | Yes if no baid is provided. |
baid | Decimal | Billing Agreement ID | Yes if no token is provided |
paymentCollectOptions | Object. Defined below | Contains a single collectionAmount key. This is an optional amount to collect from the customer. | Optional |
customerId | Decimal | Fusebill ID of the customer | Yes |
source | Enum:{Manual, Automatic, SelfServicePortal, Import} | Source of the payment. | Yes |
Payment Collection Options
Property | Type | Description |
---|---|---|
collectionAmount | Decimal | The amount to be collected |
Examples
curl -X POST "https://secure.fusebill.com/v1/Paypal" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{
"token": 1AW3K6VG93W5G,
"baid": B-2AN8409821H599319S,
"paymentCollectOptions": {
"collectionAmount": 19.99
},
"customerId": 311115,
"source": "Manual"
}"
//Json data
string jsonData = "{'token':'1AW3K6VG93W5G','baid':'B-2AN8409821H599319S','paymentCollectOptions':{'collectionAmount':19.99},'customerId':311115,'source':'Manual'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/paypal");
//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 dict to the Payload parameter
payload = {'token':"1AW3K6VG93W5G",'baid':"B-2AN8409821H599319S",'paymentCollectOptions':{'collectionAmount':19.99},'customerId':311115,'source':"Manual"}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/paypal', data=json.dumps(payload), headers=headers)
print(r.content)
{
"token": "1AW3K6VG93W5G",
"baid": "B-2AN8409821H599319S",
"paymentCollectOptions": {
"collectionAmount": 19.99
},
"customerId": 311115,
"source": "Manual"
}
Response
{
"firstName": "Samantha",
"lastName": "Barn",
"customerId": 123456,
"isDefault": false,
"storedInFusebillVault": false,
"modifiedDate": "2019-11-07T15:51:11.1915461Z",
"id": 456789123
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "agreement",
"Value": "Please provide a Token or a Baid."
}
]
}