Viincenttt / MollieApi

This project allows you to easily add the Mollie payment provider to your application.
MIT License
147 stars 85 forks source link

CreateMandateAsync() - The 'consumerAccount' field is missing #298

Closed jjmhalew closed 1 year ago

jjmhalew commented 1 year ago

When calling the CreateMandateAsync() function from MandateClient I am receiving a MollieApiException 500 error:

Unprocessable Entity - The 'consumerAccount' field is missing

I followed the README Mandate API documentation and used the code below https://github.com/Viincenttt/MollieApi#6-mandate-api

var mandateRequest = new MandateRequest()
{
    Method = PaymentMethod.DirectDebit,
    ConsumerName = "John Smit",
    MandateReference = "My reference",
    SignatureDate = DateTime.Now
};
var mandateResponse = await _mandateClient.CreateMandateAsync(customerId, mandateRequest);

Hopefully the consumerAccount field can be added soon. Any response would be highly appreciated.

Viincenttt commented 1 year ago

Hi @jjmhalew ,

The example is wrong, I'll update the documentation. The correct code should be:

SepaDirectDebitMandateRequest mandateRequest = new SepaDirectDebitMandateRequest() {
    ConsumerAccount = "NL26ABNA0516682814",
    ConsumerName = "John Smit",
    MandateReference = "My reference",
    SignatureDate = DateTime.Now
};

The ConsumerAccount property is only available if you create a SepaDirectDebitMandateRequest object.

Let me know if you have any further questions.

Kind regards, Vincent