0

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.

Alex
  • 37,502
  • 51
  • 204
  • 332
  • I don't know anything about .NET, but if you could post what is being sent to the API I could try to figure out what is wrong with the request. With this information you might be able to track down the issue inside of the wrapper. – Matthias Dietrich Aug 27 '13 at 08:20
  • Content posted is shown... Beyond this, I can't really help - it's sent over SSL and fiddler isn't playing nice with decrypting what is sent. – Alex Aug 27 '13 at 09:15

1 Answers1

0

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.

Nadeem
  • 75
  • 2
  • 11
  • Not according to your own documentation... https://www.paymill.com/en-gb/documentation-3/introduction/subscriptions/ – Alex Aug 27 '13 at 13:14