ericwj / mollie-api-csharp

Mollie API client for C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mollie-api-csharp

Mollie API client for C#

How to use the API client

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

MollieClient mollieClient = new MollieClient("your_api_key_here");

Loading iDeal issuers

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

Creating a new payment.

Payment 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/",
};
PaymentStatus paymentStatus = mollieClient.StartPayment(payment);
string molliePaymentId = paymentStatus.id;
Response.Redirect(paymentStatus.links.paymentUrl);

Getting payment status

PaymentStatus paymentStatus = mollieClient.GetStatus(molliePaymentId);
if (paymentStatus.status == Status.paid)
{
   Response.Write("Your order is paid");
}

Refunds

RefundStatus refundStatus = mollieClient.Refund(molliePaymentId);

PaymentMethods

PaymentMethods methods = mollieClient.GetPaymentMethods();
foreach (PaymentMethod method in methods.data)
{
	Console.WriteLine(method.image.normal);
}

About

Mollie API client for C#

License:BSD 2-Clause "Simplified" License


Languages

Language:C# 100.0%