Show / Hide Table of Contents
    • Yort.Zip.InStore
      • CancelOrderRequest
      • CancelOrderResponse
      • CommitOrderRequest
      • CreateOrderRequest
      • CreateOrderResponse
      • EnrolRequest
      • EnrolResponse
      • IZipClient
      • OrderStatusRequest
      • OrderStatusResponse
      • RefundOrderRequest
      • RefundOrderResponse
      • RollbackOrderRequest
      • ZipApiException
      • ZipClient
      • ZipClientConfiguration
      • ZipEnvironment
      • ZipEnvironment.NewZealand
      • ZipErrorResponse
      • ZipOrder
      • ZipOrderItem
      • ZipOrderStatus
      • ZipPaymentFlow
      • ZipRequestOptionsBase
      • ZipValidationError

    Class ZipClient

    The main class used to interact with the Zip payments API.

    Inheritance
    Object
    ZipClient
    Implements
    IZipClient
    IDisposable
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: Yort.Zip.InStore
    Assembly: Yort.Zip.InStore.dll
    Syntax
    public class ZipClient : IZipClient, IDisposable

    Constructors

    | Improve this Doc View Source

    ZipClient(HttpClient, ZipClientConfiguration)

    Full constructor.

    Declaration
    public ZipClient(HttpClient httpClient, ZipClientConfiguration configuration)
    Parameters
    Type Name Description
    HttpClient httpClient

    See the method remarks for important information. An HttpClient instance to use to access the Zip API, or null to have the ZipClient create it's own internally. Supply your own if you wish to apply handlers for logging, retry logic etc.

    ZipClientConfiguration configuration

    A ZipClientConfiguration instance providing client credentials, the API environment to access and other required details.

    Remarks

    If you are injecting an instance of HttpClient via the httpClient make sure the 'AllowAutoRedirect' property on the inner most handler (and any intermediate ones) is set to false. The Zip API returns redirect responses in some situations that must be handled manually by the ZipClient instance for correct behaviour to be applied.

    | Improve this Doc View Source

    ZipClient(ZipClientConfiguration)

    Partial constructor.

    Declaration
    public ZipClient(ZipClientConfiguration configuration)
    Parameters
    Type Name Description
    ZipClientConfiguration configuration

    A ZipClientConfiguration instance providing client credentials, the API environment to access and other required details.

    Methods

    | Improve this Doc View Source

    CancelOrderAsync(CancelOrderRequest)

    Requests a previously created order be cancelled.

    Declaration
    public Task<CancelOrderResponse> CancelOrderAsync(CancelOrderRequest request)
    Parameters
    Type Name Description
    CancelOrderRequest request

    A CancelOrderRequest providing details of the order to be cancelled and operation/terminal that is requesting cancellation.

    Returns
    Type Description
    Task<CancelOrderResponse>

    A CancelOrderResponse instance.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if request or any required sub-property is null.

    ArgumentException

    Thrown if any sub-property of request is determined to be invalid.

    ZipApiException

    Thrown if the Zip API returns an error response.

    UnauthorizedAccessException

    Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration.

    HttpRequestException

    Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing.

    OperationCanceledException

    Thrown if a timeout occurs calling the Zip API.

    | Improve this Doc View Source

    CommitOrderAsync(CommitOrderRequest)

    Commits (completes) an order previously created via CreateOrderAsync(CreateOrderRequest) using the Auth flow.

    Declaration
    public Task CommitOrderAsync(CommitOrderRequest request)
    Parameters
    Type Name Description
    CommitOrderRequest request

    A CommitOrderRequest containing details of the order to commit.

    Returns
    Type Description
    Task

    A task that can be awaited to know when the operation has completed. If the task does not return an exception, the auth completed succesfully. Use the GetOrderStatusAsync(OrderStatusRequest) to confirm.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if request or any required sub-property is null.

    ArgumentException

    Thrown if any sub-property of request is determined to be invalid.

    ZipApiException

    Thrown if the Zip API returns an error response.

    UnauthorizedAccessException

    Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration.

    HttpRequestException

    Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing.

    OperationCanceledException

    Thrown if a timeout occurs calling the Zip API.

    | Improve this Doc View Source

    CreateOrderAsync(CreateOrderRequest)

    Creates a new order (payment) with Zip.

    Declaration
    public Task<CreateOrderResponse> CreateOrderAsync(CreateOrderRequest request)
    Parameters
    Type Name Description
    CreateOrderRequest request

    Details of the order to be created.

    Returns
    Type Description
    Task<CreateOrderResponse>

    Details of the created order if succesful, otherwise throws an exception.

    Remarks

    If the EnableUniqueMerchantReferenceCheck is true and the specified MerchantReference has been used before this method will behave in an idempotent way, returning a successful response but without creating a duplicate order. If EnableUniqueMerchantReferenceCheck is false and duplicate merchant reference is used, a dupliate order will be created in Zip.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if request is null.

    ArgumentException

    Thrown if any sub-property of request is determined to be invalid.

    ZipApiException

    Thrown if the Zip API returns an error response.

    UnauthorizedAccessException

    Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration.

    HttpRequestException

    Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing.

    OperationCanceledException

    Thrown if a timeout occurs calling the Zip API.

    | Improve this Doc View Source

    Dispose()

    Disposes this instance and all internal resources.

    Declaration
    public void Dispose()
    See Also
    Dispose(Boolean)
    | Improve this Doc View Source

    Dispose(Boolean)

    Disposes resources used by this instance.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    Boolean disposing

    True if dispose is being called explicitly by client code, or false if it is being called from a finalizer (indicating only unmanaged resources should be cleaned up).

    See Also
    Dispose()
    | Improve this Doc View Source

    EnrolAsync(EnrolRequest)

    Allows retrieval of the client id and secret used to request new auth tokens using the Zip device enrolment system.

    Declaration
    public Task<EnrolResponse> EnrolAsync(EnrolRequest request)
    Parameters
    Type Name Description
    EnrolRequest request

    A EnrolRequest instance providing details of the device to enrol.

    Returns
    Type Description
    Task<EnrolResponse>

    A EnrolResponse instance containing details of the token returned.

    Remarks

    On a successful response, not only does the EnrolResponse returned contain the client id and secret so the caller can persist them for future sessions, but the client id and secret returned will be automatically applied to the configuration for this ZipClient instance.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if request or any required sub-property is null.

    ArgumentException

    Thrown if any sub-property of request is determined to be invalid.

    ZipApiException

    Thrown if the Zip API returns an error response.

    UnauthorizedAccessException

    Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration.

    HttpRequestException

    Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing.

    OperationCanceledException

    Thrown if a timeout occurs calling the Zip API.

    | Improve this Doc View Source

    GetOrderStatusAsync(OrderStatusRequest)

    Requests the current status of the specified order from the Zip API.

    Declaration
    public Task<OrderStatusResponse> GetOrderStatusAsync(OrderStatusRequest request)
    Parameters
    Type Name Description
    OrderStatusRequest request

    A OrderStatusRequest providing details of the order to return the status of.

    Returns
    Type Description
    Task<OrderStatusResponse>

    If successful a OrderStatusResponse containing details of the specified order's status. Otherwise throws an exception.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if request or any required sub-property is null.

    ArgumentException

    Thrown if any sub-property of request is determined to be invalid.

    ZipApiException

    Thrown if the Zip API returns an error response.

    UnauthorizedAccessException

    Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration.

    HttpRequestException

    Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing.

    OperationCanceledException

    Thrown if a timeout occurs calling the Zip API.

    | Improve this Doc View Source

    RefundOrderAsync(RefundOrderRequest)

    Refunds some or all of the money taken as part of a previously completed order.

    Declaration
    public Task<RefundOrderResponse> RefundOrderAsync(RefundOrderRequest request)
    Parameters
    Type Name Description
    RefundOrderRequest request

    A RefundOrderRequest specifying details of the refund to create and the order to create it against.

    Returns
    Type Description
    Task<RefundOrderResponse>

    A RefundOrderResponse with details of a succesful outcome.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if request or any required sub-property is null.

    ArgumentException

    Thrown if any sub-property of request is determined to be invalid.

    ZipApiException

    Thrown if the Zip API returns an error response.

    UnauthorizedAccessException

    Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration.

    HttpRequestException

    Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing.

    OperationCanceledException

    Thrown if a timeout occurs calling the Zip API.

    | Improve this Doc View Source

    RollbackOrderAsync(RollbackOrderRequest)

    Rolls back (cancels/undoes) an order previously created via CreateOrderAsync(CreateOrderRequest) using the Auth flow.

    Declaration
    public Task RollbackOrderAsync(RollbackOrderRequest request)
    Parameters
    Type Name Description
    RollbackOrderRequest request

    A RollbackOrderRequest containing details of the order to rollback.

    Returns
    Type Description
    Task

    A task that can be awaited to know when the operation has completed. If the task does not return an exception, the auth rolled back succesfully. Use the GetOrderStatusAsync(OrderStatusRequest) to confirm.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if request or any required sub-property is null.

    ArgumentException

    Thrown if any sub-property of request is determined to be invalid.

    ZipApiException

    Thrown if the Zip API returns an error response.

    UnauthorizedAccessException

    Thrown if the request to Zip is unauthorised, or if insufficient/incorrect client authentication details have been provided via the ZipClientConfiguration.

    HttpRequestException

    Thrown for some types of network and HTTP failures, usually where the request has not made it to the server for processing.

    OperationCanceledException

    Thrown if a timeout occurs calling the Zip API.

    Implements

    IZipClient
    System.IDisposable

    See Also

    IZipClient
    • Improve this Doc
    • View Source
    Back to top Copyright (c) 2020 Troy Willmot