Skip to content

citypay/citypay-api-client-dotnet

Repository files navigation

CityPay API Client for DotNet

Build Status

Welcome to the CityPay API, a robust HTTP API payment solution designed for seamless server-to-server transactional processing. Our API facilitates a wide array of payment operations, catering to diverse business needs. Whether you're integrating Internet payments, handling Mail Order/Telephone Order (MOTO) transactions, managing Subscriptions with Recurring and Continuous Authority payments, or navigating the complexities of 3-D Secure authentication, our API is equipped to support your requirements. Additionally, we offer functionalities for Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids, and Completion processing, alongside the capability for tokenised payments.

Compliance and Security Overview

Ensuring the security of payment transactions and compliance with industry standards is paramount. Our API is designed with stringent security measures and compliance protocols to safeguard sensitive information and meet the rigorous requirements of Visa, MasterCard, and the PCI Security Standards Council.

Key Compliance and Security Measures

  • TLS Encryption: All data transmissions must utilise TLS version 1.2 or higher, employing strong cryptography. Our infrastructure strictly enforces this requirement to maintain the integrity and confidentiality of data in transit. We conduct regular scans and assessments of our TLS endpoints to identify and mitigate vulnerabilities.
  • Data Storage Prohibitions: Storing sensitive cardholder data (CHD), such as the card security code (CSC) or primary account number (PAN), is strictly prohibited. Our API is designed to minimize your exposure to sensitive data, thereby reducing your compliance burden.
  • Data Masking: For consumer protection and compliance, full card numbers must not be displayed on receipts or any customer-facing materials. Our API automatically masks PANs, displaying only the last four digits to facilitate safe receipt generation.
  • Network Scans: If your application is web-based, regular scans of your hosting environment are mandatory to identify and rectify potential vulnerabilities. This proactive measure is crucial for maintaining a secure and compliant online presence.
  • PCI Compliance: Adherence to PCI DSS standards is not optional; it's a requirement for operating securely and legally in the payments ecosystem. For detailed information on compliance requirements and resources, please visit the PCI Security Standards Council website https://www.pcisecuritystandards.org/.
  • Request Validation: Our API includes mechanisms to verify the legitimacy of each request, ensuring it pertains to a valid account and originates from a trusted source. We leverage remote IP address verification alongside sophisticated application firewall technologies to thwart a wide array of common security threats.

Getting Started

Before integrating with the CityPay API, ensure your application and development practices align with the outlined compliance and security measures. This preparatory step is crucial for a smooth integration process and the long-term success of your payment processing operations.

For further details on API endpoints, request/response formats, and code examples, proceed to the subsequent sections of our documentation. Our aim is to provide you with all the necessary tools and information to integrate our payment processing capabilities seamlessly into your application.

Thank you for choosing CityPay API. We look forward to supporting your payment processing needs with our secure, compliant, and versatile API solution.

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: 6.6.40
  • SDK version: 1.3.3
  • Generator version: 7.5.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen For more information, please visit https://www.citypay.com/contacts/

Frameworks supported

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using CityPayAPI.Api;
using CityPayAPI.Client;
using CityPayAPI.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out CityPayAPI.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using CityPayAPI.Api;
using CityPayAPI.Client;
using CityPayAPI.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://api.citypay.com";
            // Create a temporal ApiKey using your client id and licence key
            config.AddApiKey("cp-api-key", new ApiKey("CLIENT_ID", "LICENCE_KEY").GenerateKey());

            var apiInstance = new AuthorisationAndPaymentApi(config);
            var authRequest = new AuthRequest(); // AuthRequest | 

            try
            {
                // Authorisation
                Decision result = apiInstance.AuthorisationRequest(authRequest);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling AuthorisationAndPaymentApi.AuthorisationRequest: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.citypay.com

Class Method HTTP request Description
AuthorisationAndPaymentApi AuthorisationRequest POST /v6/authorise Authorisation
AuthorisationAndPaymentApi BinRangeLookupRequest POST /v6/bin Bin Lookup
AuthorisationAndPaymentApi CResRequest POST /v6/cres CRes
AuthorisationAndPaymentApi CaptureRequest POST /v6/capture Capture
AuthorisationAndPaymentApi CreatePaymentIntent POST /v6/intent/create Create a Payment Intent
AuthorisationAndPaymentApi PaResRequest POST /v6/pares PaRes
AuthorisationAndPaymentApi RefundRequest POST /v6/refund Refund
AuthorisationAndPaymentApi RetrievalRequest POST /v6/retrieve Retrieval
AuthorisationAndPaymentApi VoidRequest POST /v6/void Void
BatchProcessingApi BatchProcessRequest POST /v6/batch/process Batch Process Request
BatchProcessingApi BatchRetrieveRequest POST /v6/batch/retrieve Batch Retrieve Request
BatchProcessingApi CheckBatchStatusRequest POST /v6/batch/status Check Batch Status
CardHolderAccountApi AccountCardDeleteRequest DELETE /v6/account/{accountid}/card/{cardId} Card Deletion
CardHolderAccountApi AccountCardRegisterRequest POST /v6/account/{accountid}/register Card Registration
CardHolderAccountApi AccountCardStatusRequest POST /v6/account/{accountid}/card/{cardId}/status Card Status
CardHolderAccountApi AccountChangeContactRequest POST /v6/account/{accountid}/contact Contact Details Update
CardHolderAccountApi AccountCreate POST /v6/account/create Account Create
CardHolderAccountApi AccountDeleteRequest DELETE /v6/account/{accountid} Account Deletion
CardHolderAccountApi AccountExistsRequest GET /v6/account-exists/{accountid} Account Exists
CardHolderAccountApi AccountRetrieveRequest GET /v6/account/{accountid} Account Retrieval
CardHolderAccountApi AccountStatusRequest POST /v6/account/{accountid}/status Account Status
CardHolderAccountApi ChargeRequest POST /v6/charge Charge
DirectPostApi DirectCResAuthRequest POST /direct/cres/auth/{uuid} Handles a CRes response from ACS, returning back the result of authorisation
DirectPostApi DirectCResTokeniseRequest POST /direct/cres/tokenise/{uuid} Handles a CRes response from ACS, returning back a token for future authorisation
DirectPostApi DirectPostAuthRequest POST /direct/auth Direct Post Auth Request
DirectPostApi DirectPostTokeniseRequest POST /direct/tokenise Direct Post Tokenise Request
DirectPostApi TokenRequest POST /direct/token Direct Post Token Request
OperationalFunctionsApi AclCheckRequest POST /v6/acl/check ACL Check Request
OperationalFunctionsApi DomainKeyCheckRequest POST /dk/check Domain Key Check Request
OperationalFunctionsApi DomainKeyGenRequest POST /dk/gen Domain Key Generation Request
OperationalFunctionsApi ListMerchantsRequest GET /v6/merchants/{clientid} List Merchants Request
OperationalFunctionsApi PingRequest POST /v6/ping Ping Request
PaylinkApi TokenAdjustmentRequest POST /paylink/{token}/adjustment Paylink Token Adjustment
PaylinkApi TokenCancelRequest PUT /paylink/{token}/cancel Cancel a Paylink Token
PaylinkApi TokenChangesRequest POST /paylink/token/changes Paylink Token Audit
PaylinkApi TokenCloseRequest PUT /paylink/{token}/close Close Paylink Token
PaylinkApi TokenCreateBillPaymentRequest POST /paylink/bill-payment Create Bill Payment Paylink Token
PaylinkApi TokenCreateRequest POST /paylink/create Create Paylink Token
PaylinkApi TokenPurgeAttachmentsRequest PUT /paylink/{token}/purge-attachments Purges any attachments for a Paylink Token
PaylinkApi TokenReconciledRequest PUT /paylink/{token}/reconciled Reconcile Paylink Token
PaylinkApi TokenReopenRequest PUT /paylink/{token}/reopen Reopen Paylink Token
PaylinkApi TokenResendNotificationRequest POST /paylink/{token}/resend-notification Resend a notification for Paylink Token
PaylinkApi TokenStatusRequest GET /paylink/{token}/status Paylink Token Status
ReportingApi BatchedTransactionReportRequest POST /v6/merchant-batch/{merchantid}/{batch_no}/transactions Batch Transaction Report Request
ReportingApi MerchantBatchReportRequest POST /v6/merchant-batch/report Merchant Batch Report Request
ReportingApi MerchantBatchRequest GET /v6/merchant-batch/{merchantid}/{batch_no} Merchant Batch Request
ReportingApi RemittanceRangeReport POST /v6/remittance/report/{clientid} Remittance Report Request
ReportingApi RemittanceReportRequest GET /v6/remittance/report/{clientid}/{date} Remittance Date Report Request

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

cp-api-key

  • Type: API key
  • API key parameter name: cp-api-key
  • Location: HTTP header

cp-domain-key

  • Type: API key
  • API key parameter name: cp-domain-key
  • Location: URL query string

About

DotNet Client SDK to CityPay API

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages