KYC API

Manages the following endpoints: Session and Merchant.

Installation

dotnet CLI

Install the latest SDK using dotnet CLI:

dotnet add package PingPayment.KYC

NuGet.exe

Install the latest SDK using NuGet.exe:

nuget install PingPayment.KYC

Visual Studio

From within Visual Studio:

  1. Open the Solution Explorer.
  2. Right-click on a project within your solution.
  3. Click on Manage NuGet Packages...
  4. Click on the Browse tab and search for "PingPayments.KYC".
  5. Click on the PingPayments.KYC package, select the appropriate version in the right-tab and click Install.


Client

The client exposes all enpoints and It's operations that let you create and interact with Ping Payments KYC API through your Ping Payments account. Ping Payment KYC Client uses the Http Client for sending and receiving HTTP responses.

Ping Payment KYC Client

The using directive allows you to use types defined in a namespace without specifying the fully qualified namespace of that type. Add the following using directive from the PingPayments.KYC namespace:

using PingPayments.KYC;

Initializing the client with an appropriate environment.

  • For testing use the Sandbox environment, PingEnvironments.KYC.SandboxUri.
  • For Production use PingEnvironments.KYC.ProductionUri.
var httpClient = new HttpClient().ConfigurePingPaymentsClient(PingEnvironments.KYC.SandboxUri, tenantId);
var api = new PingKycApiClient(httpClient);

Or use Dependency injection

services.AddHttpClient<IPingKycApiClient, PingKycApiClient>(client =>
{
    client.ConfigurePingPaymentsClient(PingEnvironments.KYC.SandboxUri, tenantId);
});


Session (Endpoint)

The Session enpoint exposes one method dedicated to dealing with KYC sessions.

Method


Initiate Session

Initiate a new verification session.

Usage:

  1. Create a Ping KYC Client.

  2. Call the Initiate() method with a IntiateSessionRequest.

    1. await api.Session.V1.Initiate(initiateSessionRequest);
      
  3. Handle response.

Parameters

ParameterTypeRequierdDescription
IntiateSessionRequestInitiateSessionRequestYesRequest body required to initiate a new verification session.

Returns

Object is being returned with two fields: validation_url and verification_id. If there is a problem with the request an error response will be returned.


Example Usage

//Create a new InitiateSessionRequest
var initiateSessionRequest = new InitiateSessionRequest("[email protected]", "0706542314", "199409082333")

//Make call to API
var response = await api.Session.V1.Initiate(initiateSessionRequest);

Response

201 CREATED

{
  "validation_url": Uri,
  "verification_id": "string"
}


Merchants (Endpoint)

The Merchant endpoint exposes three methods dedicated to dealing with KYC associated with merchants.

Methods


Get Merchant

Get merchants based on the GetKycRequest .

Usage

  1. Create a Ping KYC Client.
  2. Call the Get() method with a GetKycRequest.
    1. await api.Merchant.V1.Get(getKycRequest);
      
  3. Handle response.
ParameterTypeRequierdDescription
GetKycRequestGetKycRequestYesRequest body required to get merchant

Returns

A list of objects is being returned. Each object in the list contains information about a merchant. If there is a problem with the request an error response will be returned.


Example Usage

//Create a new GetKycRequest
var getKycRequest = new GetKycRequest
{
    Page = 1,
    PageSize = 10,
};

//Make call to API
var response = await api.Merchant.V1.Get(getKycRequest);

Response

200 OK

[
  {
    "addresses": [],
    "bank_account": {
      "bic": "NDEASESS",
      "iban": "SE7280000810340009783242"
    },
    "country": "se",
    "email": "[email protected]",
    "id": "021d404f-0a3f-46c1-8189-6fc27151b1f2",
    "metadata": {},
    "name": "Svante Larsson",
    "person_data": {
      "birthdate": "1985-12-24",
      "firstname": "Svante",
      "gender": "Male",
      "identity": "198002015841",
      "lastname": "Larsson"
    },
    "phone": "0705555555",
    "type": "person"
  }
]


Verify merchant

Send verification data for merchant.

Usage

  1. Create a Ping KYC Client.
  2. Call the Verification() method with a KycVerificationRequest.
    1. await api.Merchant.V1.Verification(kycVerificationRequest);
      
  3. Handle response.

Parameters

ParameterTypeRequierdDescription
KycVerificationRequestKycVerificationRequestYesRequest body required to make a verification.

Returns

Empty response. If there is a problem with the request an error response will be returned.


Example Usage

var kycVerificationRequest = new KycVerificationRequest
 (
    bankAccount,
  	"SE",
    "[email protected]",
     merchantId,
     "Svante",
     "0705555555",
     LegalEntityTypeEnum.person,
     personData: personData
);

var response = await api.Merchant.V1.Verification(kycVerificationRequest);

Response

204 No content

{}


Merchant AIS

Account Information Service for Merchants.

Usage

  1. Create a Ping KYC Client.
  2. Call the AIS() method with a aisMerchantRequest.
    1. await api.Merchant.V1.AIS(aisMerchantRequest);
      
  3. Handle response.

Parameters

ParameterTypeRequierdDescription
aisMerchantRequestAisMerchantRequestYesRequest body required to perform a verification.

Returns

Object is being returned with two fields: If the response is 200 ais_url and verification_id is returned, If the response is 201 merchant_id and message is returned. If there is a problem with the request an error response will be returned.


Example Usage

var request = new AisMerchantRequest
(
   "SE",
   merchantId
   distributionObj,
   "[email protected]",
   "0701231212",
   "199611015676",
   redirects,
   style
);
var response = await api.Merchant.V1.AIS(request);

Response

200 ok

{
  "ais_url": "www.somesite.se",
  "verification_id": "id"
}

201 Created

{
  "merchant_id": "88b5dae6-c691-49c4-86f8-8d51b0b2bbc",
  "message": "The entity was already registered, created new merchant"
}

Agreement (Endpoint)

The Agreement endpoint exposes five methods dedicated to dealing with oneflow agreements.

Methods


Create Agreement

Create an agreement .

Usage

  1. Create a Ping KYC Client.
  2. Call the Create() method with a CreateRequest.
    1. await api.Agreement.V1.Create(createRequest);
      
  3. Handle response.
ParameterTypeRequierdDescription
createRequestCreateRequestBodyYesRequest body required to create agreement

Returns

Returns a Guid for that agreement. If there is a problem with the request an error response will be returned.


Example Usage

//Create a new agreement
var createRequest = new CreateRequest
{
	TemplateId = templateId,
  MerchantId = merchantId,
  Name = "Example",
  Provider = AgreementTypeEnum.oneflow,
  ProviderParameters = new ProviderParameters
  {
  	Party = new Organization
    {
    	Country = CountryEnum.SE,
      Identity = "organization nunmber",
      Name = "Exampler AB",
      SubParties = new List<Subparty>
      {
      	new Subparty
        {
        	Identity = "yyyyMMddxxxx",
          Name = "firstname lastname",
          Email = "[email protected]",
          Country = CountryEnum.SE,
          Editor = true,
          PhoneNumber = "46701234567",
          Signatory = true,
          SignMethod = SignMethodEnum.standard_esign,
          Title = "Head of examples"
        }
      }
    }
	}
};

//Make call to API
var response = await api.Agreement.V1.Create(createRequest);

Response

200 OK

[
  {
    "addresses": [],
    "bank_account": {
      "bic": "NDEASESS",
      "iban": "SE7280000810340009783242"
    },
    "country": "se",
    "email": "[email protected]",
    "id": "021d404f-0a3f-46c1-8189-6fc27151b1f2",
    "metadata": {},
    "name": "Svante Larsson",
    "person_data": {
      "birthdate": "1985-12-24",
      "firstname": "Svante",
      "gender": "Male",
      "identity": "198002015841",
      "lastname": "Larsson"
    },
    "phone": "0705555555",
    "type": "person"
  }
]


Get Agreement

Get and returns information about that Agreement.

Usage

  1. Create a Ping KYC Client.
  2. Call the Get() method.
    1. await api.Agreement.V1.Get(agreementId);
      
  3. Handle response

Parameters

ParameterTypeRequierdDescription
agreementId GuidYesGuid of an agreement

Returns

Object with information about the agreements, or an error response.


Example Usage

//Call the API
var response = await api.Agreement.V1.Get(agreementId);

Response

200 OK

{
   "agreement_template_id": "88888888-4444-4444-4444-888888884444",
   "merchant_id": "88888888-4444-4444-4444-888888884444",
   "name": "name",
   "provider": "oneflow",
   "provider_data": 
   {
      "data_fields": [
        {
          "filled_out": true,
          "id": "1",
          "name": "example"
        }
      ],
      "participants": [
        {
          "identity": "id",
          "name": "example",
          "sign_state": "signed",
          "signatory": "true"
        }
      ],
      "state": "signed",
  		"published_at": "date",
  		"signed": true
		}
}

List Agreement Templates

Get a list of agreement templates.

Usage:

  1. Create a Ping KYC Client.
  2. Call the ListTemplates() method:
    1. await api.Agreement.V1.ListTemplates(templateId);
      
  3. Handle response

Parameters

ParameterTypeRequierdDescription
templateId GuidNoGuid of a specific agreement template

Returns

An object with a list of agreement templates, or an error response.


Example Usage

var response = await api.Agreement.V1.ListTemplates(templateId);

Response

200 OK

[
  {
    "id": "55555555-5555-5555-5555-555555555555",
    "name": "template name",
    "provider": "oneflow"
  }
]

Create Agreement Access Link

Creates an access link to an agreement for a praticipant

Usage:

  1. Create a Ping KYC Client.
  2. Call the CreateAccessLink() method:
    1. await api.Agreement.V1.CreateAccessLink(CreateAccessLinkRequest);
      
  3. Handle response

Parameters

ParameterTypeRequierdDescription
createAccessLinkRequestCreateAccessLinkRequestBodyYesRequest body required to create an access link for an agreement

Returns

A string with a link, or an error response.


Example Usage

var createAccessLinkRequest = new CreateAccessLinkRequestBody
{
	AgreementId = agreementId,
  ProviderParameters = new CreateAccessLinkParameters
  {
  	ParticipantId = participantId,
  }
};
var response = await api.Agreement.V1.CreateAccessLink(createAccessLinkRequest);

Response

200 OK

{
    "link": "I'm a link"
}

Update Agreement

Allows you to update an agreement.

Usage

  1. Create a Ping KYC Client.
  2. Call the Update() method with an updateRequest:
    1. await api.Agreement.V1.Update(updateRequest);
      
  3. Handle response

Parameters

ParameterTypeRequierdDescription
updateRequestUpdateRequestYesRequest body

Returns

Empty response, or an error response.


Example Usage

using PingPayments.KYC.Agreement.V1.Update

// Create a UpdateTenantRequest
 var updateRequest = new UpdateRequest{
 	AgreementId = agreementId,
  ProviderParameters = new UpdateAgreementProviderParameters{
  	DataFields = new[] {
    	new UpdateAgreementDataField
      {
      	Id = "id",
        Value = "value"
      }
  	}
  }
 };

//Call the API
var response = await api.Agreement.V1.Update(updateRequest);

Response

204 No content

{}

Publish Agreement

Publish an agreement.

Usage:

  1. Create a Ping KYC Client.
  2. Call the Publish() method:
    1. await api.Agreement.V1.Publish(publishRequest);
      
  3. Handle response

Parameters

ParameterTypeRequierdDescription
publishRequestPublishRequestYesRequest body

Returns

Empty response, or an error response.


Example Usage

publishRequest = new PublishRequest{
  AgreementId = agreementId,
  ProviderParameters = new PublishAgreementParameters{
  	Subject = "Cat",
    Message = "Is hungry"
  }
}
await api.Agreement.V1.Publish(publishRequest);

Response

204 No Content