Skip to content

04. Refund API

Vincent Kok edited this page Jun 7, 2024 · 2 revisions

Create a new refund

using IRefundClient refundClient = new RefundClient("{yourApiKey}");
RefundResponse refundResponse = await this._refundClient.CreateRefundAsync("{paymentId}", new RefundRequest() {
	Amount = new Amount(Currency.EUR, "100"),
	Description = "{description}"
});

Retrieve a refund by payment and refund id

using IRefundClient refundClient = new RefundClient("{yourApiKey}");
RefundResponse refundResponse = await this._refundClient.GetPaymentRefundAsync("{paymentId}", "{refundId}");

List payment refunds

Mollie allows you to set offset and count properties so you can paginate the list. The offset and count parameters are optional.

using IRefundClient refundClient = new RefundClient("{yourApiKey}");
ListResponse<RefundListData> refundList = await this._refundClient.GetPaymentRefundListAsync("{paymentId}", "{offset}", "{count}");

Cancel a payment refund

using IRefundClient refundClient = new RefundClient("{yourApiKey}");
await refundClient.CancelPaymentRefundAsync("{paymentId}", "{refundId}");

Create order refund

When using the Orders API, refunds should be made against the Order. When using pay after delivery payment methods such as Klarna Pay later and Klarna Slice it, this ensures that your customer will receive credit invoices with the correct product information on them and generally have a great experience.

OrderRefundRequest orderRefundRequest = new OrderRefundRequest() {
	Lines = new List<OrderLineDetails>() {
		Id = {orderLineId},
		Quantity = 5,
		Amount = new Amount("EUR", 5)
	},
	Description = ""
};
using IRefundClient refundClient = new RefundClient("{yourApiKey}");
OrderRefundResponse result = await refundClient.CreateOrderRefundAsync({orderId}, orderRefundRequest);

List order refunds

Retrieve all order refunds.

using IRefundClient refundClient = new RefundClient("{yourApiKey}");
ListResponse<RefundResponse> result = await refundClient.GetOrderRefundListAsync({orderId});