This project serves as a sample installation of a project utilizing AndDone's DotNet client library to integrate with our APIs.
By following the instructions below, you will be able to see our API endpoints in action quickly.
- Base DotNet Client Library: AndDone-SecureAPI-ClientLibrary-DotNet
- Developer Documentation: DevDocs
- API Explorer: AndDone API Explorer
- .Net 8 SDK Runtime Download .NET 8
Or
- .Net Standard2.0 Runtime Download .NET Core 2.0
- Open a Powershell window
- Create a new folder in the workspace folder of choice (ex: d:\workspace\anddone)
cd d:\workspace
mkdir anddone- Change to the new folder
cd anddone- Clone the repository
git clone https://github.com/anddone-kit/AndDone-SecureAPI-FrameWork-DotNet.git- Change to the project folder
cd anddone-dotnet-sdk-sample-installation- Restore packages and Build Solution
dotnet build APISample.sln -c Release --property WarningLevel=0- Find and note your company AndDone Developer settings.
- Login to (UAT) https://portal.uat.anddone.com/ (Production) https://portal.anddone.com/
- In the left menu, click "Developer" then "API Keys"
- Your xApiKey will be the API Key
- Your xAppKey will be the App Key
- You will need to register your Origin with us to execute API calls against our Secure endpoints.
- Typically, we use your domain for production or other hosted environments and IP address for local development environments.
- Contact AndDone support (integrations@anddone.com) or your onboarding agent to ensure all your domains or IP addresses you may use are registered for use with our secure APIs.
- Create a settings file to contain AndDone specific settings
cd src\APISample\bin\Release\net8.0-windows- Using your favorite editor, create a file "appsettings.json"
- COpy below into the "appsettings.json" and enter the xAPIKey, xAPPKey and Origin to the values to match your company settings. Do not modify the BasePath or xVersion settings. Save the settings and close the file.
{
"Settings": {
"BasePath": "https://api.uat.anddone.com",
"BasePath2": "https://api2.uat.anddone.com",
"xApiKey": "",
"xAppKey": "",
"xVersion": "2.3",
"Origin": ""
}
}- In Powershell, make sure you are in the folder d:\workspace\anddone\anddone-dotnet-sdk-sample-isntallation\src\APISample\bin\Release\net8.0-windows
- Enter the following command:
.\APISample.exe- You should see a screen similar to the following:
- Click the "Configuration" button in the bottom left menu to verify your company settings.
The API Calls are grouped into sections (menu buttons) on the left side menu. For example, you can click on the "Payments" button to see all the Payment related API Calls.
For every API call, a Request Payload (in JSON format) is required. All Request JSON Files are located in the "Requests" folder. When you Click on an API section in the Left Menu, you will see a tab for each specific API Call. Each tab will show the location and filename of the Request Payload. In order to change the Request Payload, use an editor to modify the JSON file. Save the file and re-run the API Call. You do not need to stop/start the APISample application.
The Reports Payload requires a "reportId" and "date". To obtain these values:
- Login to (UAT) https://portal.uat.anddone.com/ (Production) https://portal.anddone.com/
- In the left menu, click "Reporting".
- Choose a Report and click "Generate Report"
- Enter the date for the data you want and click "Generate"
- This will take you to the Report List page.
- Note the URL will be in the format of: "/merchant/reports/generate-reports/KGx1n813"
- The final path in the URL (ex: KGx1n813) will be the "reportId" to use for the payload
- The "date" for the payload is the "Report Date" column on the Report List page, in the format "mm-dd-yyyy"
Note that instead of generating a new report, after clicking the left menu "Reporting", you can select already generated reports and follow the same steps for obtaining the "reportId" and "date"
After clicking a button to execute an API Call, there will be 2 outputs displayed on the screen. The first will be the "Response Code" returned from the API Call. The second will be the Raw JSON returned from the API Call.
Some Request Payloads for an API Call may require dependent data from a different API Call. For example, for "Payments", click the "Payments" section in the left menu. Then click the "Create" tab and verify your Request Payload. After verification, click the "Create" button. The Response JSON will contain a "transactionId". You can see the "Details" of the payment just created by click on the "Details" tab. Update the reuqest payload for the Payment Details with the "transactionId" returned from the "Create" API Call. You can then click the "Payment Details" to retrieve the details of the payment just created.
When Data Dependence exists, the tab containing the API Call will point out the depenedencies.
To update the API Sample project, do the following:
- Change to the root folder
cd d:\workspace\anddone\anddone-dotnet-sdk-sample-isntallation- Pull the latest changes
git pull- Rebuild the project
dotnet build APISample.sln -c Release --property WarningLevel=0To include the AndDone's DotNet client library in your project:
- Manually
- Create a GitHub Personal Access Token (PAT) by logging into GitHub
- Select User -> Settings -> Developer Settings -> Personal access tokens -> Tokens (classic)
- Select Generate new token -> Generate new token (classic)
- Give an identifiable description name
- Copy Token to be used below as GH_PAT
- Add the GHCR reference to the local machine by running the following in Powershell:
dotnet nuget add source --username {GH_USER} --password {GH_PAT} --store-password-in-clear-text --name githubanddone "https://nuget.pkg.github.com/AndDone-kit/index.json"7. In your .csproj file, add a package reference to:
<PackageReference Include="AndDoneSecureClientLibrary" Version="1.0.0" />- Within Visual Studio
- Open your solution in Visual Studio
- Select Tools -> Nuget Package Manager -> Manage NuGet Package for solution
- Click Gear Setting and add Package Source: https://nuget.pkg.github.com/AndDone-kit/index.json with any name
- Select same name in Package Source drop down
- Click Browse Tab and select "AndDoneSecureClientLibrary"
- Select your project and "Install"