post https://secure.fusebill.com/v1/paymentActivities/Resolve
This request can be used to resolve an unknown payment. An unknown payment can occur when a request has been sent to a payment gateway but no response has come from that gateway. This means the Fusebill system has no confirmation for the payment, and thus does not have the information needed to determine whether it should reattempt payment.
One of the required fields, paymentStatus
, is used to inform Fusebill as to the state of the payment:
- "Failed" results in a retry of the payment.
- "Successful" simply marks the payment as "Successful". For that you would need to provide an authorization code and secondary transaction number to create the transaction in Fusebill.
POST https://secure.fusebill.com/v1/paymentActivities/Resolve
Authorization: Basic {{apikey}}
Content-Type: application/json
{
"paymentStatus" : "Failed",
"paymentId" : 5618443
}
//resolves payment activity 5618443 by indicating the transaction failed.
//Fusebill will automatically retry
POST https://secure.fusebill.com/v1/paymentActivities/Resolve
Authorization: Basic {{apikey}}
Content-Type: application/json
{
"paymentStatus" : "Successful",
"paymentId" : 5618443,
"authorizationCode":"d83af28a-4ff2-25fd-125a-157a555a1234",
"secondaryTransactionNumber": "181de61-18aa-48f0-3ede-143a5ff51234"
}
//resolves payment activity 5618443 by indicating the transaction succeeded.
//Fusebill will not automatically retry
Request Parameters
Property | Type | Description | Required |
---|---|---|---|
paymentStatus | Enum:{Failed, Successful} | The verified status of the payment. | Yes |
paymentId | Integer | The Fusebill generated unique ID for the payment activity | Yes |
authorizationCode | String | If the original transaction succeeded, then this information can be received from the gateway. Required if 'paymentStatus' is "Successful" | Yes if paymentStatus is "Successful" |
secondaryTransactionNumber | String | If the original transaction succeeded, then this information can be received from the gateway. Required if paymentStatus is "Successful" | Yes if paymentStatus is "Successful" |
Examples
curl –X POST https://secure.fusebill.com/v1/PaymentActivities/Resolve \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{paymentStatus:'Failed', paymentId:5618443}"
//Json data for payload
string jsonData = "{'paymentStatus':'Failed','paymentId':561843}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.create("HTTPS://secure.fusebill.com/v1/PaymentActivities/Resolve");
//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 = {'paymentStatus':'Failed','paymentId':5618443}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/paymentActivities/Resolve', data=json.dumps(payload), headers=headers)
print(r.content)
{
"paymentStatus" : "Successful",
"paymentId" : 5618443,
"authorizationCode":"d83af28a-4ff2-25fd-125a-157a555a1234",
"secondaryTransactionNumber": "181de61-18aa-48f0-3ede-143a5ff51234"
}
Response
{
"customerId": 1235889,
"status": "Successful",
"effectiveTimestamp": "2019-08-30T17:00:09.0009257Z",
"createdTimestamp": "2019-08-30T17:00:09.0009257Z",
"source": "Manual",
"method": "CreditCard (Visa ending in 6128)",
"transactionType": "Collect",
"amount": 22,
"gatewayFee": null,
"currency": "NZD",
"transaction": {
"paymentActivityId": 4275615,
"reference": null,
"effectiveTimestamp": "2019-08-30T15:40:28.9",
"description": null,
"customerId": 1235889,
"originalPaymentActivityId": null,
"amount": 22,
"currency": "USD",
"invoiceAllocations": [],
"refunds": [],
"unallocatedAmount": 22,
"refundableAmount": 22,
"gatewayFee": 1,
"settlement": null,
"id": 98217132,
"uri": "https://secure.fusebill.com/v1/payments/98217132"
},
"paymentGateway": {
"authorizationCode": "d83af28a-4ff2-25fd-125a-157a555a1234",
"authorizationResponse": null,
"gatewayId": 1847579,
"gatewayName": "Test CC",
"secondaryTransactionNumber": "181de61-18aa-48f0-3ede-143a5ff51234"
},
"methodIsAch": false,
"parentCustomerId": null,
"reconciliationId": "5ab87bb9-8077-8894-ff42-48bc6e5498d1",
"id": 4275615,
"uri": "https://secure.fusebill.com/v1/PaymentActivities/4275615"
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "Cannot resolve a payment that is not Unknown."
}
]
}