Create a webhook

To setup a webhook, you'll need the following to get started:

  • Access token of an API user with the permission to manage webhooks. Any user with user role User and above can manage webhooks.
  • A receiver which is a HTTPs URL / API endpoint. There are just a few basic things that we expect from your endpoint:
    • It uses HTTPS on the standard 443 port
    • It responds within 5 seconds with a 2xx status code
  • An encryption key of 32 characters.
  • Merchant ID: This is the ID of the merchant you want to setup a webhook for.

Following code examples show how to create a webhook:

var httpClient = new HttpClient();

var webhookData = new
{
	type = "PaymentRequest",
	retry = true,
	destinationUrl = "<YOUR_SERVER_URL>",
	merchantID = "<YOUR_MERCHANT_ID>",
	secret = "<32_CHARACTERS_ENCRYPTION_KEY>",
	isActive = true
};

var json = JsonConvert.SerializeObject(webhookData);
var content = new StringContent(json);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

var request = new HttpRequestMessage
{
	 Method = HttpMethod.Post,
	 RequestUri = new Uri("https://api-sandbox.nofrixion.com/api/v1/webhooks"),
	 Content = content
};

 var response = await httpClient.SendAsync(request);
 var responseContent = await response.Content.ReadAsStringAsync();

Console.WriteLine(responseContent);
const axios = require('axios');

// Define your webhook data
const webhookData = {
    type: "PaymentRequest",
    retry: true,
    destinationUrl: "<YOUR_SERVER_URL>", // Replace with your server URL
    merchantID: "<YOUR_MERCHANT_ID>",    // Replace with your merchant ID
    secret: "<32_CHARACTERS_ENCRYPTION_KEY>", // Replace with your encryption key
    isActive: true
};

// Create a POST request to the API endpoint
axios.post('https://api-sandbox.nofrixion.com/api/v1/webhooks', webhookData, {
    headers: {
        'Content-Type': 'application/json', // Set the content type header
        'Accept': 'application/json'        // Set the accept header
    }
})
.then(response => {
    // Handle the response from the server
    console.log('Response:', response.data);
})
.catch(error => {
    // Handle any error from the request
    console.error('Error:', error.response ? error.response.data : error.message);
});


import requests

# Define your webhook data
webhook_data = {
    "type": "PaymentRequest",
    "retry": True,
    "destinationUrl": "<YOUR_SERVER_URL>", # Replace with your server URL
    "merchantID": "<YOUR_MERCHANT_ID>",    # Replace with your merchant ID
    "secret": "<32_CHARACTERS_ENCRYPTION_KEY>", # Replace with your encryption key
    "isActive": True
}

# Specify the URL for creating the webhook
url = 'https://api-sandbox.nofrixion.com/api/v1/webhooks'

# Send a POST request to the API endpoint
response = requests.post(url, json=webhook_data)

# Check if the request was successful
if response.status_code == 200:
    # Print the response content if successful
    print('Success:', response.json())
else:
    # Print the error if the request failed
    print('Failed:', response.status_code, response.text)


You may use the OpenAPI specification to create a webhook here.