SmatPay Merchant Public Api
  1. Payments
SmatPay Merchant Public Api
  • Payments
    • Introduction to the SmatPay API
    • Integration Guide - Quick Start
    • Integration Guide - Payments
    • SmatPay WooCommerce
    • .NET SDK
    • Get Token Sandbox
      POST
    • Get Token Production
      POST
    • Get Currencies
      GET
    • Get Banks
      GET
    • Get Payment intervals
      GET
    • Payment Calculator
      POST
    • Test Webhook Sandbox
      POST
    • Test Webhook Production
      POST
    • Pay Innbucks Sandbox
      POST
    • Pay Innbucks Sandbox Bulk
      POST
    • Pay Innbucks Production
      POST
    • Pay Innbucks Production Bulk
      POST
    • Pay ZimSwitch Sandbox
      POST
    • Pay Visa Sandbox
      POST
    • Pay Visa Production
      POST
    • Pay Mastercard Sandbox
      POST
    • Pay Mastercard Production
      POST
    • Pay Mastercard Sandbox Bulk
      POST
    • Pay Mastercard Production Bulk
      POST
    • Pay Visa Sandbox Bulk
      POST
    • Pay Visa Production Bulk
      POST
    • Pay ZimSwitch Sandbox Bulk
      POST
    • Pay ZimSwitch Production
      POST
    • Pay ZimSwitch Production Bulk
      POST
    • Pay Ecocash Sandbox
      POST
    • Pay Ecocash Sandbox Bulk
      POST
    • Bulk Payouts Sandbox
      POST
    • Bulk Payouts Production
      POST
    • Pay Ecocash Production
      POST
    • Pay Ecocash Production Bulk
      POST
    • Payment Status Innbucks Sandbox
      GET
    • Payment Status Innbucks Production
      GET
    • Payment Status Ecocash Sandbox
      GET
    • Payment Status Ecocash Production
      GET
    • Payment Status ZimSwitch Sandbox
      GET
    • Payment Status ZimSwitch Production
      GET
    • Payment Status Visa Sandbox
      GET
    • Payment Status MasterCard Sandbox Copy
      GET
    • Payment Status Visa Production
      GET
    • Payment Status Mastercard Production
      GET
    • Generate Recurring Payment Sandbox
      POST
    • Generate Payment Token Sandbox
      POST
    • Generate Payment Token With Payment Sandbox
      POST
    • Cancel Recurring Payment Sandbox
      POST
    • Fast Checkout
      POST
    • Fast Checkout Sandbox
      POST
  • Fiscalization
    • add-invoice
    • add-debit-note
    • add-credit-note
    • money-type-list
  1. Payments

.NET SDK

Here are step-by-step instructions on how to install NuGet packages using different methods in a .NET environment:

1. Using Visual Studio#

a. Package Manager UI
1.
Open Your Project: Start Visual Studio and open your existing project or solution.
2.
Manage NuGet Packages:
Right-click on your project in the Solution Explorer.
Select Manage NuGet Packages.
3.
Browse for Packages:
In the NuGet Package Manager window, go to the Browse tab.
Search for your package (e.g., SmatPaySDK).
4.
Install the Package:
Select the package from the list.
Click the Install button.
Follow any prompts to accept licenses.
b. Package Manager Console
1.
Open Package Manager Console:
Go to Tools > NuGet Package Manager > Package Manager Console.
2.
Install the Package:
In the console, run the following command:
Install-Package SmatPaySDK
Press Enter. Wait for the installation to complete.

2. Using .NET CLI#

If you're using the .NET Core CLI, you can install packages directly from the command line.
1.
Open Command Prompt or Terminal.
2.
Navigate to Your Project Directory:
cd path\to\your\project
3.
Install the Package:
dotnet add package SmatPaySDK
This command will add the specified package to your project.

3. Editing the Project File Manually#

You can also manually add the package reference in your project file (.csproj).
1.
Open Your Project File: Locate and open the .csproj file associated with your project.
2.
Add Package Reference: Add the following line inside an ItemGroup tag:
Screenshot 2024-10-21 165525.png
3.
Save the File and close it.
4.
Restore Packages:
Open the terminal and navigate to your project directory
Run the following command to restore the packages:
dotnet restore

4. Verifying Installation#

After installing the package, you can verify it:
Check your Solution Explorer under the Dependencies node for the installed package.
You can also check your .csproj file to ensure the package reference was added.

5. Using the Package#

Once the package is installed, you can start using it in your code by adding the necessary using directives. For example:
using SmatPaySDK.models;
using SmatPaySDK.services;
Feel free to reach out if you have any further questions or need additional details! Code smaples are included when you import the package
Imports System Imports System.Threading.Tasks Imports SmatPaySDKVB.SmatPaySDK.models Imports SmatPaySDKVB.SmatPaySDK.services
Module Program
Private ReadOnly baseUrl As String = SmatPayConstants.STAGING_ENVIRONMENT
Private authKey As String = ""
Sub Main(args As String())
____MainAsync().GetAwaiter().GetResult()
End Sub
Private Async Function MainAsync() As Task
____' Initialize the service using a real base URL and authentication key
____Dim authSandBoxService As New AuthSandBoxAPIService(baseUrl)
____Dim merchant As New Merchant() With {
________.MerchantId = "311722504951049",
________.MerchantKey = "959d936d-c79a-4711-9528-2d0dc4399142",
________.MerchantApiKey = "V8S5M2C3L0nYPz8ZDVRhq"
____}
____Dim authObject As MerchantResponse = Await authSandBoxService.GetTokenAsync(merchant)
____authKey = authObject.Token
____Await CheckInnBucksStatus()
____Await CheckEcocashStatus()
____Await CheckZimSwitchStatus()
End Function
Private Async Function CheckInnBucksStatus() As Task
____' Create a request object
____Dim statusRequest As New PayInnbucksStatusRequest() With {
________.TransactionReference = "71454554123134",
________.TransactionCode = "701878860",
________.WalletName = "Innbucks"
____}
____Dim paymentStatusService As New DirectStatusSandBoxAPIService(baseUrl, authKey)
____Try
________' Call the SDK method
________Dim paymentStatuses As List(Of PaymentStatusResponse) = Await paymentStatusService.PayInnBucksStatusAsync(statusRequest)
________' Output the results to the console
________Console.WriteLine("Payment Status Response InnBucks:")
________For Each paymentStatus In paymentStatuses
____________Console.WriteLine($"Status: {paymentStatus.Status}")
____________Console.WriteLine($"Payment Reference: {paymentStatus.PaymentReference}")
____________Console.WriteLine($"Payment Method: {paymentStatus.PaymentMethod}")
____________Console.WriteLine($"Payment Date: {paymentStatus.PaymentDate}")
____________Console.WriteLine()
________Next
____Catch ex As Exception
________' Handle any errors
________Console.WriteLine($"Error: {ex.Message}")
____End Try
End Function
Private Async Function CheckEcocashStatus() As Task
____' Create a request object
____Dim statusRequest As New PayEcocashStatusRequest() With {
________.TransactionReference = "INV-000-002",
________.WalletName = "Ecocash"
____}
____Dim paymentStatusService As New DirectStatusSandBoxAPIService(baseUrl, authKey)
____Try
________' Call the SDK method
________Dim paymentStatuses As List(Of PaymentStatusResponse) = Await paymentStatusService.PayEcocashStatusAsync(statusRequest)
________' Output the results to the console
________Console.WriteLine("Payment Status Response Ecocash:")
________For Each paymentStatus In paymentStatuses
____________Console.WriteLine($"Status: {paymentStatus.Status}")
____________Console.WriteLine($"Payment Reference: {paymentStatus.PaymentReference}")
____________Console.WriteLine($"Payment Method: {paymentStatus.PaymentMethod}")
____________Console.WriteLine($"Payment Date: {paymentStatus.PaymentDate}")
____________Console.WriteLine()
________Next
____Catch ex As Exception
________' Handle any errors
________Console.WriteLine($"Error: {ex.Message}")
____End Try
End Function
Private Async Function CheckZimSwitchStatus() As Task
____' Create a request object
____Dim statusRequest As New PayZimSwitchStatusRequest() With {
________.TransactionReference = "3E71FD08FBA6CDAB6E1DCF890C60ED9B.uat01-vm-tx01",
________.WalletName = "ZimSwitch"
____}
____Dim paymentStatusService As New DirectStatusSandBoxAPIService(baseUrl, authKey)
____Try
________' Call the SDK method
________Dim paymentStatuses As List(Of PaymentStatusResponse) = Await paymentStatusService.PayZimSwitchStatusAsync(statusRequest)
________' Output the results to the console
________Console.WriteLine("Payment Status Response ZimSwitch:")
________For Each paymentStatus In paymentStatuses
____________Console.WriteLine($"Status: {paymentStatus.Status}")
____________Console.WriteLine($"Payment Reference: {paymentStatus.PaymentReference}")
____________Console.WriteLine($"Payment Method: {paymentStatus.PaymentMethod}")
____________Console.WriteLine($"Payment Date: {paymentStatus.PaymentDate}")
____________Console.WriteLine()
________Next
____Catch ex As Exception
________' Handle any errors
________Console.WriteLine($"Error: {ex.Message}")
____End Try
End Function
Modified at 2024-10-23 14:52:26
Previous
SmatPay WooCommerce
Next
Get Token Sandbox
Built with