Configuring Webhooks

Signifyd can send a webhook to notify your online store every time a guarantee decision is made on a submitted order. This provides you with real-time updates enabling you to ship orders quickly and efficiently.

Webhooks can also be used to notify other systems, like Order Management Systems (OMS), that are not directly responsible for making the API request, but still need to know the result of the guarantee decision.

👍

Tip

We recommend the use of webhooks since they provide instant feedback when a decision is made on an order; however, you can use the Signifyd Get Decision API to poll for the guarantee decision of the order.

Guarantee Statuses and Definitions

Guarantee StatusDescriptionWebhook Event
PendingThe order is waiting to be reviewed for fraud. This is the initial status of the order when submitted.None
In ReviewThe order is being reviewed for fraud.None
ApprovedThe order has been reviewed for fraud and is safe to ship. If the order results in a fraudulent chargeback it is eligible for reimbursement.Guarantee Completion
DeclinedThe order has been reviewed for fraud and is not safe to ship. If the order results in a fraudulent chargeback it is not eligible for reimbursement.Guarantee Completion
CanceledThe request to guarantee the order was canceled when the status was approved, pending, or in review. If the order results in a fraudulent chargeback it is not eligible for reimbursement.None
UnrequestedThe order has not been submitted for guarantee. If the order results in a fraudulent chargeback it is not eligible for reimbursement.None

Create Endpoint

You'll need to create a publicly accessible endpoint for Signifyd's webhook notifications to POST to.

Creating a webhook endpoint on your server is no different from creating any page on your website. You can use a framework like Sinatra or ngrok and add a new route with the desired URL.

Set Up Webhook Events

Once you have a publicly accessible webhook endpoint, you can add the webhook URL using the Create Webhook API so that Signifyd can notify your system every time a guarantee decision is made on a submitted order.

📘

Note

A webhook will not be sent if the guarantee decision is Pending, Canceled, or In Review.

Parse Webhook

Webhook data is sent as JSON in the POST request body. The JSON can be parsed into an Event object.

PARSING JSON TO AN EVENT OBJECT

$request = file_get_contents("php://input");
$$eventJson = json_decode($request, true);
$// Handle received event
$http_response_code(200);
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream(), "UTF-8"); writer.write(payload);
writer.close();
StringBuilder content;
InputStream is = con.getInputStream();
try (BufferedReader in = new BufferedReader(new InputStreamReader(is))) {
String line;
content = new StringBuilder();
while ((line = in.readLine()) != null) {
content.append(line);
content.append(System.lineSeparator());
}
}
System.out.println(content.toString());
} catch (Exception e) {
// print error from the server
if (con != null) {
Scanner err = new Scanner(con.getErrorStream());
while (err.hasNextLine()) {
System.out.println(err.nextLine());
}
}
} finally {
if (con != null) {
con.disconnect();
}
}
}
r = requests.post(url, auth=HTTPBasicAuth('', API_KEY), headers = headers, json = payload) if (r.status_code == 201):
data = json.loads(r.text)
print(data)
else:
print("Failure: ")
print(r.text)
var content = new StringContent(payload, Encoding.UTF8, "application/json"); var response = client.PostAsync(url, content).Result;
var httpContent = response.Content;
string result = httpContent.ReadAsStringAsync().Result;
if (response.StatusCode == System.Net.HttpStatusCode.Created)
{
Console.WriteLine(result);
}
else
{
Console.WriteLine("Failure:");
Console.WriteLine(result);
}
}
response = Net::HTTP.post URI(endpoint), purchase.to_json, {'Authorization' => authorization, 'Content-Type' => 'application/json'} case response
when Net::HTTPSuccess
puts JSON.parse(response.body)
when Net::HTTPBadRequest
puts "400 : Bad Request"
when Net::HTTPUnauthorized
puts "401 : Unauthorized"
else
puts response.code + " : " + response.message
end

We recommend saving the following fields from the webhook body to your ecommerce platform.

  • orderId
  • checkpointAction

👍

Tip

You can verify if the webhook was sent by Signifyd by checking the signature in the header of the webhook message.

To verify a webhook message has come from SIGNIFYD, an X-SIGNIFYD-SEC-HMAC-SHA256 header is included in each webhook POST message. The contents of this header is the Base64 encoded output of the HMAC SHA256 encoding of the JSON body of the message, using the team's API key as the encryption key.

You should calculate this value and verify it matches the value contained in the header.

WEBHOOK VERIFICATION PROCESS

$request = file_get_contents("php://input");
// Signifyd webhook headers include - but PHP replaces them with _ on $_SERVER and adds 'HTTP_ before it
$phpServerHeaderHash = 'HTTP_' . str_replace('-', '_', 'X-SIGNIFYD-SEC-HMAC-SHA256');
$hash = $_SERVER[$phpServerHeaderHash];
$check = base64_encode(hash_hmac('sha256', $request, $apiKey, true));
$isValidRequest = $hash == $check ? true : false;

Automate Workflows

To automate order fulfillment you’ll want to take action in your online store or Order Management System (OMS) based on Signifyd’s guarantee decision. The specific actions that you may need to take in your system to complete order fulfillment may vary, however, you should consider the following actions when defining your workflows.

Scenario 1: Ship Approved Orders

When Signifyd makes a guarantee decision of approved ship the order and capture the payment immediately.

  • Guarantee Decision: ACCEPT
  • Order Status: Fulfilled
  • Payment Status: Captured
  • Buyer Communication: Your order is shipping

Scenario 2: Manually Review Orders that Are Held.

The order is placed on hold so your team can review the order in the Signifyd console.

  • Guarantee Decision: HOLD
  • Order Status: Hold
  • Payment Status: Authorized/Sale
  • Buyer Communication: None

You can then manually take the following actions:

  • Cancel: If your review team agrees with Signifyd and believes the order is fraudulent, cancel the order.
  • Resubmit: If your review team believes the order is not fraud, you can resubmit it for a second review.
  • Ship without a guarantee: If you choose, you can ship the order without guarantee fraud protection.

Scenario 3: Cancel orders that are rejected.

Cancel the order and void/refund the payment immediately

  • Guarantee Decision: REJECT
  • Order Status: Cancel
  • Payment Status: Void/Refund
  • Buyer Communication: Your order is canceled

Handling Errors

To acknowledge receipt of a webhook, your endpoint should be publicly accessible and return a 2xx HTTP status code. All response codes outside of this range, including 3xx codes, will indicate to Signifyd that you did not receive the webhook including URL redirection or "Not Modified" responses.

If your endpoint is down or not able to successfully receive a webhook Signifyd will resend the webhook up to 15 times over a four day period. The first webhook will be retried after 20 seconds with exponential delays for each subsequent retry.

RetryTime
120s
240s
380s
4160s
5320s
6640s
MARKTime
120s
240s
380s
4160s
5320s
6640s

What’s Next

Congratulations, you have completed your Signifyd integration!

Your Signifyd Implementation Manager will now guide you through the deploying your integration to your production store.