Class LatitudePayClient
The primary class used to integrate to the LatitudePay API.
Inherited Members
Namespace: Yort.LatitudePay.InStore
Assembly: Yort.LatitudePay.InStore.dll
Syntax
public sealed class LatitudePayClient : ILatitudePayClient, IDisposable
Remarks
Instances of this class should be reused between requests. If working in a single POS, create a copy on startup or first use and then re-use for subsequent payments. Dispose only when you're done with the instance completely, such as on shutdown or if about to create a new instance with alternate configuration.
If working in a payment service/gateway or web POS handling multiple lanes, then create a pool of instances (one for each lane) and re-use as appropriate.
Instances of this class should be thread safe, multiple calls for the same or different payments through the same instance should work as expected.
Constructors
| Improve this Doc View SourceLatitudePayClient(LatitudePayClientConfiguration)
Initializes a new instance of the LatitudePayClient class.
Declaration
public LatitudePayClient(LatitudePayClientConfiguration configuration)
Parameters
Type | Name | Description |
---|---|---|
LatitudePayClientConfiguration | configuration | A LatitudePayClientConfiguration instance containing information required to connect to the LatitudePay API. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentException | Thrown if ApiSecret is an empty string or contains only whitespace. |
See Also
Methods
| Improve this Doc View SourceCancelPurchaseAsync(LatitudePayCancelPurchaseRequest)
Cancels a (pending) payment plan previously requested via CreatePosPurchaseAsync(LatitudePayCreatePosPurchaseRequest).
Declaration
public Task<LatitudePayCancelPurchaseResponse> CancelPurchaseAsync(LatitudePayCancelPurchaseRequest request)
Parameters
Type | Name | Description |
---|---|---|
LatitudePayCancelPurchaseRequest | request | A LatitudePayCancelPurchaseRequest containing the token of the payment plan to cancel. |
Returns
Type | Description |
---|---|
Task<LatitudePayCancelPurchaseResponse> | An instance of a LatitudePayCancelPurchaseResponse indicating if the cancellation was successful. |
Remarks
This only cancels pending/unapproved payment plans. If a plan has been accepted/approved you must refund it instead of cancel it.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentOutOfRangeException | Thrown if any sub-properties of |
ArgumentException | Thrown if any sub-properties of |
ObjectDisposedException | Thrown if Dispose() has been called on this instance. |
UnauthorizedAccessException | Thrown if the system is unable to obtain an authorisation token from the API (see the inner exception for details). |
HttpRequestException | Thrown if an error occurs making the request to the API. |
See Also
CreatePosPurchaseAsync(LatitudePayCreatePosPurchaseRequest)
Creates a new 'payment plan'.
Declaration
public Task<LatitudePayCreatePosPurchaseResponse> CreatePosPurchaseAsync(LatitudePayCreatePosPurchaseRequest request)
Parameters
Type | Name | Description |
---|---|---|
LatitudePayCreatePosPurchaseRequest | request | A LatitudePayCreatePosPurchaseRequest instance specifying options for the payment plan to be created. |
Returns
Type | Description |
---|---|
Task<LatitudePayCreatePosPurchaseResponse> | A LatitudePayCreatePosPurchaseResponse instance containing details of the pending payment plan. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentOutOfRangeException | Thrown if any sub-properties of |
ArgumentException | Thrown if any sub-properties of |
ObjectDisposedException | Thrown if Dispose() has been called on this instance. |
UnauthorizedAccessException | Thrown if the system is unable to obtain an authorisation token from the API (see the inner exception for details). |
HttpRequestException | Thrown if an error occurs making the request to the API. |
See Also
CreateRefundAsync(LatitudePayCreateRefundRequest)
Refunds a previously approved payment plan.
Declaration
public Task<LatitudePayCreateRefundResponse> CreateRefundAsync(LatitudePayCreateRefundRequest request)
Parameters
Type | Name | Description |
---|---|---|
LatitudePayCreateRefundRequest | request | A LatitudePayCreateRefundRequest instance containing details of the refund and payment plan to refund against. |
Returns
Type | Description |
---|---|
Task<LatitudePayCreateRefundResponse> | A LatitudePayCreateRefundResponse instance indicating if the refund was successful and details of the refund created. |
Remarks
You can only refund a previously accepted payment plan. Use CancelPurchaseAsync(LatitudePayCancelPurchaseRequest) to cancel a payment plan that is pending.
A refund can be full or partial, and multiple partial refunds can be made. You can only refund up to the total amount of the original payment plan, across all refunds.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentOutOfRangeException | Thrown if any sub-properties of |
ArgumentException | Thrown if any sub-properties of |
ObjectDisposedException | Thrown if Dispose() has been called on this instance. |
UnauthorizedAccessException | Thrown if the system is unable to obtain an authorisation token from the API (see the inner exception for details). |
HttpRequestException | Thrown if an error occurs making the request to the API. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
GetConfigurationAsync(LatitudePayConfigurationRequest)
Gets configuration information for the current merchant account, specifying the supported currency, minimum and maximum purchase values etc.
Declaration
public Task<LatitudePayConfigurationResponse> GetConfigurationAsync(LatitudePayConfigurationRequest request)
Parameters
Type | Name | Description |
---|---|---|
LatitudePayConfigurationRequest | request | A LatitudePayConfigurationRequest that specifies options for the data returned. |
Returns
Type | Description |
---|---|
Task<LatitudePayConfigurationResponse> | A LatitudePayConfigurationResponse instance. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ObjectDisposedException | Thrown if Dispose() has been called on this instance. |
UnauthorizedAccessException | Thrown if the system is unable to obtain an authorisation token from the API (see the inner exception for details). |
HttpRequestException | Thrown if an error occurs making the request to the API. |
GetPurchaseStatusAsync(LatitudePayPurchaseStatusRequest)
Gets the status of a payment plan previously requested via CreatePosPurchaseAsync(LatitudePayCreatePosPurchaseRequest).
Declaration
public Task<LatitudePayPurchaseStatusResponse> GetPurchaseStatusAsync(LatitudePayPurchaseStatusRequest request)
Parameters
Type | Name | Description |
---|---|---|
LatitudePayPurchaseStatusRequest | request | A LatitudePayPurchaseStatusRequest instance containing the token of the payment plan who's status should be queried. |
Returns
Type | Description |
---|---|
Task<LatitudePayPurchaseStatusResponse> | A LatitudePayPurchaseStatusResponse instance containing the status and other details of the plan. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
ArgumentOutOfRangeException | Thrown if any sub-properties of |
ArgumentException | Thrown if any sub-properties of |
ObjectDisposedException | Thrown if Dispose() has been called on this instance. |
UnauthorizedAccessException | Thrown if the system is unable to obtain an authorisation token from the API (see the inner exception for details). |
HttpRequestException | Thrown if an error occurs making the request to the API. |