400 Bad Request error when using .net Paymill Wrapper

176 views Asked by At

I'm trying to use the .net Paymill Wrapper

When trying to add a subscription, I'm getting back a 400 Bad Request.

To illustrate the problem, I created a branch and changed the Sandbox console app to call the method to test addSubscription

The problem is happening here where the request is actually posted.

The content posted is: (as an example)

client=client_bbe895116de80b6141fd&
offer=offer_32008ddd39954e71ed48&
payment=pay_81ec02206e9b9c587513

It appears this hasn't been updated for sometime, and the original author is unresponsive via email or twitter, so I've forked the repo and am trying to fix the error.

1

There are 1 answers

1
Nadeem On

I had a look at your code and found out that you are not creating the offer object correctly. In your addSubscription method (SandboxConsole project), i found this code snippet

        Subscription subscription = new Subscription();
        subscription.Client = new Client() { Id = "client_bbe895116de80b6141fd" };
        subscription.Offer = new Offer() { Id = "offer_32008ddd39954e71ed48" };
        subscription.Payment = new Payment() { Id = "pay_81ec02206e9b9c587513" };

Offer object should be initialized with parameters like amount, currency, interval. Since the offer object doesn't exist, assigning a subscription to it fails, giving you bad request error.