foxip / mollie-api-csharp

Mollie API client for C#
BSD 2-Clause "Simplified" License
13 stars 10 forks source link

mollie-api-csharp

Mollie API client for C#

How to use the API client

Initializing the Mollie API client, and setting your API key.

var mollieClient = new MollieClient("your_api_key_here");

Loading iDeal issuers

var issuers = await mollieClient.GetIssuers();
foreach (var issuer in issuers.data)
{
   Console.WriteLine(issuer.name);
}

Creating a new payment.

var payment = new Payment 
{ 
   amount = 99.99M, 
   description = "Test payment", 
   redirectUrl = "http://www.myshop.net/payments/completed/?orderId=1245",
   webhookUrl = "http://www.myshop.net/webhooks/mollie/",
};
var paymentStatus = await mollieClient.StartPayment(payment);
var molliePaymentId = paymentStatus.id;
Response.Redirect(paymentStatus.links.paymentUrl);

Getting payment status

var paymentStatus = await mollieClient.GetStatus(molliePaymentId);
if (paymentStatus.status == Status.paid)
{
   Console.WriteLine("Your order is paid");
}