Skip to content

14. Payment link Api

Vincent Kok edited this page Jul 9, 2024 · 4 revisions

Create payment link

PaymentLinkRequest paymentLinkRequest = new PaymentLinkRequest() {
	Description = "Test",
	Amount = new Amount(Currency.EUR, 50),
	WebhookUrl = this.DefaultWebhookUrl,
	RedirectUrl = this.DefaultRedirectUrl,
	ExpiresAt = DateTime.Now.AddDays(1)
};
using IPaymentLinkClient client = new PaymentLinkClient({yourApiKey});
PaymentLinkResponse createdPaymentLink = await this._paymentLinkClient.CreatePaymentLinkAsync(paymentLinkRequest);

Get payment link

using IPaymentLinkClient client = new PaymentLinkClient({yourApiKey});
PaymentLinkResponse result = await this._paymentLinkClient.GetPaymentLinkAsync({yourPaymentLinkId});

List payment links

using IPaymentLinkClient client = new PaymentLinkClient({yourApiKey});
ListResponse<PaymentLinkResponse> result = await this._paymentLinkClient.GetPaymentLinkListAsync();

Update payment link

using IPaymentLinkClient client = new PaymentLinkClient({yourApiKey});
PaymentLinkUpdateRequest paymentLinkUpdateRequest = new() {
    Description = "Updated description",
    Archived = true
};
PaymentLinkResponse updatedPaymentLink = await this._paymentLinkClient.UpdatePaymentLinkAsync({yourPaymentLinkId}, paymentLinkUpdateRequest);

Delete payment link

using IPaymentLinkClient client = new PaymentLinkClient({yourApiKey});
await this._paymentLinkClient.DeletePaymentLinkAsync({yourPaymentLinkId});

List payment link payments

using IPaymentLinkClient client = new PaymentLinkClient({yourApiKey});
var result = await _paymentLinkClient.GetPaymentLinkPaymentListAsync({yourPaymentLinkId});