Interface IPaymentInvoiceClient
Invoices kept by the provider: the ones its subscriptions issue, and the ones the caller issues for what it measured itself. Listing them, serving their PDF, paying one again, and crediting one back.
public interface IPaymentInvoiceClient
Remarks
The provider numbers, renders, charges and retries the invoice. A caller keeps a copy of what it lists and refreshes it from GetInvoiceAsync(string, CancellationToken) when an event about it arrives.
Methods
CreateCreditNoteAsync(PaymentCreditNoteRequest, CancellationToken)
Gives back part or all of a paid invoice: a credit note, with the money refunded to the card.
Task<IResult<PaymentCreditNoteDTO>> CreateCreditNoteAsync(PaymentCreditNoteRequest request, CancellationToken cancellationToken = default)
Parameters
requestPaymentCreditNoteRequestWhich invoice, how much, and the key that makes a repeat harmless.
cancellationTokenCancellationTokenCancels the call.
Returns
CreateInvoiceAsync(PaymentInvoiceRequest, CancellationToken)
Issues an invoice with the caller's lines and, unless asked otherwise, has the provider charge the customer's default payment method for it straight away.
Task<IResult<PaymentInvoiceDTO>> CreateInvoiceAsync(PaymentInvoiceRequest request, CancellationToken cancellationToken = default)
Parameters
requestPaymentInvoiceRequestWho owes it, for what, and the key that makes a repeat harmless.
cancellationTokenCancellationTokenCancels the call.
Returns
Remarks
The charge's outcome arrives by webhook. The invoice returned is as it stood once issued — open, usually, with its first charge on its way.
GetCreditNoteAsync(string, CancellationToken)
A credit note as the provider holds it now.
Task<IResult<PaymentCreditNoteDTO>> GetCreditNoteAsync(string creditNoteId, CancellationToken cancellationToken = default)
Parameters
creditNoteIdstringThe provider's identifier for it.
cancellationTokenCancellationTokenCancels the call.
Returns
GetCreditNotePdfAsync(string, CancellationToken)
The credit note's PDF, fetched by the server.
Task<IResult<PaymentDocumentDTO>> GetCreditNotePdfAsync(string creditNoteId, CancellationToken cancellationToken = default)
Parameters
creditNoteIdstringThe provider's identifier for it.
cancellationTokenCancellationTokenCancels the call.
Returns
GetInvoiceAsync(string, CancellationToken)
An invoice as the provider holds it now.
Task<IResult<PaymentInvoiceDTO>> GetInvoiceAsync(string invoiceId, CancellationToken cancellationToken = default)
Parameters
invoiceIdstringThe provider's identifier for it.
cancellationTokenCancellationTokenCancels the call.
Returns
GetInvoicePdfAsync(string, CancellationToken)
The invoice's PDF, fetched by the server so the provider's link never reaches a browser.
Task<IResult<PaymentDocumentDTO>> GetInvoicePdfAsync(string invoiceId, CancellationToken cancellationToken = default)
Parameters
invoiceIdstringThe provider's identifier for it.
cancellationTokenCancellationTokenCancels the call.
Returns
ListInvoicesAsync(string, string?, int, CancellationToken)
A customer's invoices, newest first, drafts left out.
Task<IResult<PaymentInvoicePageDTO>> ListInvoicesAsync(string customerId, string? startingAfter = null, int limit = 20, CancellationToken cancellationToken = default)
Parameters
customerIdstringWhose invoices.
startingAfterstringThe last invoice of the previous page, to read the next.
limitintHow many, 1 to 100.
cancellationTokenCancellationTokenCancels the call.
Returns
PayInvoiceAsync(string, CancellationToken)
Charges an open invoice again, from the customer's default payment method now.
Task<IResult<PaymentInvoiceDTO>> PayInvoiceAsync(string invoiceId, CancellationToken cancellationToken = default)
Parameters
invoiceIdstringThe provider's identifier for it.
cancellationTokenCancellationTokenCancels the call.
Returns
Remarks
For after the customer replaced a card that was refused.