We offer a web-hook that was developed to send data to an external URL as part of the payment process. In the database we store the URL, the password for bearer authentication header, and the template JSON, where we replace the values.
To enable your webhook, please contact us and provide us with your webhook endpoint.
This is an example of the JSON template that we send:
{ "currency":"{currency}", "transaction_id":{trid}, "donation_id":{donid}, "amount":{sum}, "error_code":{error_code}, "error_details":"{error_message}", "unix_timestamp":{time_stamp}, "project_id":{projectid}, "user_fname":"{fname}", "user_lname":"{lname}", "user_email":"{email}", "custom1":"{cf1}", "custom2":"{cf2}", "custom3":"{cf3}", "custom4":"{cf4}" ,"frequency": {frequency} ,"phone":"{phone}"}
The tokens are being replaced with the live data, and then posted using code above to URL stored in the database.
This is how we activate the webhook on our side:
HttpClient client = new HttpClient();
HttpClient client = new HttpClient();
StringContent content = new StringContent(replacedString, Encoding.UTF8, "application/json");
client.DefaultRequestHeaders.Authorization = new
System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", webHook.WebHookHeader);
client.DefaultRequestHeaders.Accept.Add(new
System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));//ACCEPT header
var response = await client.PostAsync(webHookURL, content);
var responseString = await response.Content.ReadAsStringAsync();