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:
- Open the Solution Explorer.
- Right-click on a project within your solution.
- Click on Manage NuGet Packages...
- Click on the Browse tab and search for "PingPayments.KYC".
- 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:
-
Create a Ping KYC Client.
-
Call the
Initiate()
method with aIntiateSessionRequest
.-
await api.Session.V1.Initiate(initiateSessionRequest);
-
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
IntiateSessionRequest | InitiateSessionRequest | Yes | Request 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
- Create a Ping KYC Client.
- Call the
Get()
method with aGetKycRequest
.-
await api.Merchant.V1.Get(getKycRequest);
-
- Handle response.
Parameter | Type | Requierd | Description |
---|---|---|---|
GetKycRequest | GetKycRequest | Yes | Request 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
- Create a Ping KYC Client.
- Call the
Verification()
method with aKycVerificationRequest
.-
await api.Merchant.V1.Verification(kycVerificationRequest);
-
- Handle response.
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
KycVerificationRequest | KycVerificationRequest | Yes | Request 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
- Create a Ping KYC Client.
- Call the
AIS()
method with aaisMerchantRequest
.-
await api.Merchant.V1.AIS(aisMerchantRequest);
-
- Handle response.
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
aisMerchantRequest | AisMerchantRequest | Yes | Request 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
- Create a Ping KYC Client.
- Call the
Create()
method with aCreateRequest
.-
await api.Agreement.V1.Create(createRequest);
-
- Handle response.
Parameter | Type | Requierd | Description |
---|---|---|---|
createRequest | CreateRequestBody | Yes | Request 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
- Create a Ping KYC Client.
- Call the
Get()
method.-
await api.Agreement.V1.Get(agreementId);
-
- Handle response
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
agreementId | Guid | Yes | Guid 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:
- Create a Ping KYC Client.
- Call the
ListTemplates()
method:-
await api.Agreement.V1.ListTemplates(templateId);
-
- Handle response
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
templateId | Guid | No | Guid 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:
- Create a Ping KYC Client.
- Call the
CreateAccessLink()
method:-
await api.Agreement.V1.CreateAccessLink(CreateAccessLinkRequest);
-
- Handle response
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
createAccessLinkRequest | CreateAccessLinkRequestBody | Yes | Request 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
- Create a Ping KYC Client.
- Call the
Update()
method with anupdateRequest
:-
await api.Agreement.V1.Update(updateRequest);
-
- Handle response
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
updateRequest | UpdateRequest | Yes | Request 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:
- Create a Ping KYC Client.
- Call the
Publish()
method:-
await api.Agreement.V1.Publish(publishRequest);
-
- Handle response
Parameters
Parameter | Type | Requierd | Description |
---|---|---|---|
publishRequest | PublishRequest | Yes | Request 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
Updated 8 months ago