Webhooks
Updated over a week ago

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. For more information on using the webhook, please contact us.
โ€‹
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();


And 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.

Did this answer your question?