SDK .Net subscription cancel

Cantinos
Contributor
Contributor

First, let me complain about Paypal integration.
The .NET NuGet packages are partial or obsolete in particular for the subscription/recurring payment. And it's quite the same for the other languages.
For a firm that got more than 400Millons € of net profit last year, it's quite disappointing...

 

So back to the problem. I use  the last .net package 
And completed it with my custom requests to manage subscriptions .

I manage to create and read plans. Same for subscriptions. But now, I want to cancel the subscription and I've got his error **The server does not support the request payload's media type.**

here my code:
public class SubscriptionCancelRequest : HttpRequest
{
public SubscriptionCancelRequest(string subscriptionId)
: base("/v1/billing/subscriptions/{subscriptionId}/cancel", HttpMethod.Post)
{
try
{
this.Path = this.Path.Replace("{subscriptionId}", Uri.EscapeDataString(Convert.ToString(subscriptionId)));
}
catch (IOException) { }

ContentType = "application/json";
}
}

In my service :
var requestCancel = new SubscriptionCancelRequest(paypalSubId);
var responseCancel = await _paypalClient.Execute(requestCancel); //_paypalClient is PayPalHttpClient for pkg


Can you tell me what I'm doing wrong?

 

Thx.

 

**EDIT**
I try :
public SubscriptionCancelRequest(string subscriptionId)
: base("/v1/billing/subscriptions/{subscriptionId}/cancel", HttpMethod.Post, typeof(void))

or change the contenttype without better result.
ContentType = "application/x-www-form-urlencoded";

Login to Me Too
1 REPLY 1

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.