Skip to main content

Get a Webhook Subscription

Description

Gets a registered subscription by subscription id.

Endpoint

Method: GET
/api/v2/callbacks/subscriptions/{subscriptionId}

Sample Code

Add Subscription Example
using Microsoft.Extensions.DependencyInjection;

internal static class GetSubscription
{
internal static async Task GetSubscriptionAsync(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("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.GetAsync(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

ParameterDescriptionType

subscriptionId required

Subscription Id of the Merchant for useCallback.GUID

Response

NameDescriptionType
CallbackUriThe merchant callback endpoint.GUID
VerifiedIndicates if URL is verified or not.Boolean