Remove Subscription
Description
Removes a subscription by id.
Endpoint
Method: DELETE
/api/v2/callbacks/subscriptions/{subscriptionId}
Sample Code
- C#
Remove Subscription Example
using Microsoft.Extensions.DependencyInjection;
internal static class RemoveSubscription
{
internal static async Task RemoveSubscriptionAsync(string subscriptionid)
{
var services = new ServiceCollection();
services.AddHttpClient("MyApiClient", client =>
{
client.BaseAddress = new Uri("http://paymentadminapistage.svea.com/api/");
});
var serviceProvider = services.BuildServiceProvider();
var httpClientFactory = serviceProvider.GetRequiredService<IHttpClientFactory>();
var httpClient = httpClientFactory.CreateClient("MyApiClient");
var apiUrl = string.Format("/api/v2/callbacks/subscriptions/{0}", subscriptionid);
// Add authorization header
Authentication.CreateAuthenticationToken(out string token, out string timestamp);
httpClient.DefaultRequestHeaders.Add("Authorization", token);
httpClient.DefaultRequestHeaders.Add("Timestamp", timestamp);
try
{
HttpResponseMessage response = await httpClient.DeleteAsync(apiUrl);
// Check if the request was successful
if (response.IsSuccessStatusCode)
{
string responseData = await response.Content.ReadAsStringAsync();
Console.WriteLine("Response: " + responseData);
}
else
{
Console.WriteLine("Failed to retrieve data. Status code: " + response.StatusCode);
}
}
catch (HttpRequestException ex)
{
Console.WriteLine("Error: " + ex.Message);
}
}
}
Payload parameters
Parameter | Description | Type |
---|---|---|
subscriptionId required | Subscription Id of the Merchant for Callback. | GUID |
Response Code
Code | HttpStatusCode | Description |
---|---|---|
200 | Ok | Webhook URL valid and verified. |
400 | BadRequest | Webhook URL is invalid. |
403 | Forbidden | Merchant is not authorized to retrieve information. |
401 | Unauthorized | Merchant is not authorized to retrieve information. |