post https://secure.fusebill.com/v1/payments/AutoResolve
This request takes an 'Unknown' payment activity as the body and attempts an automatic resolution of the payment. If this does not work use Resolve Payment Activity which is the manual alternative, requiring the result and transaction details from the gateway (either "Failed" or "Successful").
The easiest way to use this endpoint is to get the payment activity via Read Payment Activity and use that JSON as the body for this request.
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
method | String | The payment method being used | Yes |
id | Integer | The Fusebill generated ID that uniquely identifies this payment activity | Yes |
Examples
curl –X POST https://secure.fusebill.com/v1/payments/AutoResolve\
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{DTO from GET v1/paymentActivities/{id}}"
//Json data for payload
string jsonData = "{DTO from GET v1/paymentActivities/{id}}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/payments/AutoResolve");
//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 = {DTO from GET v1/paymentActivities/{id}}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/payments/AutoResolve', data=json.dumps(payload), headers=headers)
print(r.content)
{
"method": "CreditCard (Visa ending in 8052)",
"id": 1061888
}
{
"customerId": 611718,
"status": "Unknown",
"effectiveTimestamp": "2019-11-28T19:48:33",
"createdTimestamp": "2019-11-28T19:48:33",
"source": "Automatic",
"method": "CreditCard (Visa ending in 8052)",
"transactionType": "Collect",
"amount": 1.0000,
"gatewayFee": null,
"currency": "USD",
"transaction": null,
"paymentGateway": {
"authorizationCode": null,
"authorizationResponse": null,
"gatewayId": null,
"gatewayName": null,
"secondaryTransactionNumber": null
},
"methodIsAch": false,
"parentCustomerId": null,
"reconciliationId": "7a12c6e6-5161-4af7-c28a-423dde582d11",
"id": 1061888,
"uri": "https://secure.fusebill.com/v1/paymentactivities/1061888"
}
Response
{
"customerId": 595588,
"status": "Successful",
"effectiveTimestamp": "2019-05-13T18:05:27.0007245Z",
"createdTimestamp": "2019-05-13T18:01:54",
"source": "Automatic",
"method": "CreditCard (Visa ending in 6128)",
"transactionType": "Collect",
"amount": 90,
"gatewayFee": null,
"currency": "USD",
"transaction": {
"paymentActivityId": 56789,
"reference": null,
"effectiveTimestamp": "2019-05-13T18:05:27.0007245Z",
"description": null,
"customerId": 595588,
"originalPaymentActivityId": null,
"amount": 90,
"currency": "USD",
"invoiceAllocations": [],
"refunds": [],
"unallocatedAmount": 90,
"refundableAmount": 90,
"gatewayFee": null,
"settlement": null,
"id": 63511726,
"uri": "https://secure.fusebill.com/v1/paymentActivities/12345"
},
"paymentGateway": {
"authorizationCode": null,
"authorizationResponse": "Auto resolved, payment was successful.",
"gatewayId": 1234,
"gatewayName": "Test CC",
"secondaryTransactionNumber": null
},
"methodIsAch": false,
"parentCustomerId": null,
"reconciliationId": "5ab87bb9-8077-8894-ff42-48bc6e5498d1",
"id": 12354,
"uri": "https://secure.fusebill.com/v1/paymentActivities/12345"
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "Unable to Resolve payment, payment status is known: Successful."
}
]
}