AuroPayPayments 1.0.0

dotnet add package AuroPayPayments --version 1.0.0
                    
NuGet\Install-Package AuroPayPayments -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AuroPayPayments" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AuroPayPayments" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="AuroPayPayments" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AuroPayPayments --version 1.0.0
                    
#r "nuget: AuroPayPayments, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AuroPayPayments@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AuroPayPayments&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=AuroPayPayments&version=1.0.0
                    
Install as a Cake Tool

Auropay .NET SDK

The Auropay .NET SDK provides a streamlined integration for merchants to interact with Auropay's payment APIs. This SDK abstracts complex API interactions, allowing merchants to focus on delivering excellent user experiences. It includes support for creating payment links, refunds, querying payment status, and generating payment QR codes.


Features

  • Create Payment Link: Simplify generating payment links with extensive customization options.
  • Create Refund: Enable seamless refund processing for orders.
  • Get Payment Status by Transaction ID or Reference ID: Retrieve transaction details easily.
  • Generate Payment QR Code: Support for dynamic QR code generation for payments.
  • Secure and User-friendly: Built with industry-standard encryption and ease of use in mind.
  • Comprehensive Documentation: Includes detailed examples and configuration guides for easy onboarding.

Table of Contents

  1. Requirements
  2. Installation
  3. Configuration
  4. Usage Examples
  5. License

Requirements

  • Programming Language: Compatible with .NET 8.
  • API Keys: Access your API key and secret from the Auropay merchant dashboard.

Installation

Install the Auropay .NET SDK via NuGet:

  dotnet add package AuroPayPayments -- version
NuGet\Install-Package AuroPayPayments -Version
<PackageReference Include="AuroPayPayments" Version="1.0.0" />

Prerequisites for Configuration

Store your API key and secret securely in environment variables or configuration files:

var clientConfig = new AuropayApiClientConfiguration
{
    Environment = "UAT",
    AccessKey = accessKey,
    SecretKey = secretKey,
    Version = "1.0"
};

Usage Examples

1. Initialize the AuropayClient

var apiClient = new AuropayApiClient(clientConfig);

Method: CreatePaymentLink

This method utilizes the settings provided in the PaymentLinkRequest to generate a payment link. The returned response contains details such as the payment link URL, expiration time, and other relevant metadata.

Properties Data Types Details
ExpireOn DateTime Time when the generated link will expire (e.g., DateTime.Parse("2025-01-31T23:59:59"))
Amount decimal Transaction amount for the payment link.
Customers List<Customer> List of customer details. Example: new List<Customer> { new Customer("FirstName", "LastName", "email@example.com", "9999999999") }
InvoiceNumber (optional) string Custom invoice number to show on payment form details.
CallbackUrl string Callback URL for payment updates.
ShortDescription string Brief description of the payment.
Title string Title for the payment link.
ShowSummary bool Display summary on the payment page.
ResponseType int Desired response format (e.g., JSON).
PaymentDescription string Detailed description of the payment.

Code Snippet:

var createPaymentLinkRequest = new CreatePaymentLinkRequest
{
    Title = form["Title"],
    ExpireOn = form["ExpireOn"],
    ShortDescription = form["ShortDescription"],
    Amount = double.TryParse(form["Amount"], out var amount) ? amount : 0,
    Currency = form["Currency"],
    Customer = new PaymentCustomer
    {
        FirstName = form["Customer_FirstName"],
        LastName = form["Customer_LastName"],
        Email = form["Customer_Email"],
        Phone = form["Customer_Phone"]
    },
    CallbackParameters = new CallbackParameters
    {
        CallbackApiUrl = form["CallbackParameters_CallbackApiUrl"],
        ReferenceNo = form["CallbackParameters_ReferenceNo"]
    },
    ResponseType = RequestPayResponseType.CallBack
};

var response = await apiClient.CreatePaymentLink(createPaymentLinkRequest);

var jsonResponse = JsonSerializer.Serialize(response, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine($"API Response: {jsonResponse}");

3. Create Refund

Method: CreateRefund

Properties Data Types Details
TransactionId string Unique identifier for the order to refund.
AmountToRefund decimal Amount to refund.
OriginalAmount decimal Original transaction amount.
Remark (optional) string Reason for the refund.

Code Snippet:

var createRefundRequest = new CreateRefundRequest
{
    OrderId = form["OrderId"],
    Amount = double.TryParse(form["Amount"], out var amount) ? amount : 0,
    Remarks = form["Remarks"]
};

var response = await apiClient.CreateRefund(createRefundRequest);

var jsonResponse = JsonSerializer.Serialize(response, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine($"API Response: {jsonResponse}");

4. Get Payment Status by Transaction ID

Method: GetTransactionById

Properties Data Types Details
TransactionId string Unique identifier for the transaction.

Code Snippet:

var paymentById = await apiClient.GetTransactionById(paymentId);
var jsonResponse = JsonSerializer.Serialize(paymentById, new JsonSerializerOptions { WriteIndented = true });

context.Response.ContentType = "application/json";
await context.Response.WriteAsync(jsonResponse);

5. Generate Payment QR Code

Method: CreatePaymentQRCode

This method generates a dynamic QR code for payments using the CreateQRCodeRequest object.

Code Snippet:

var createQRCodeRequest = new CreateQRCodeRequest
{
    Title = form["Title"],
    ExpireOn = form["ExpireOn"],
    ShortDescription = form["ShortDescription"],
    Amount = double.TryParse(form["Amount"], out var amount) ? amount : 0,
    Currency = form["Currency"],
    Customers = new List<PaymentLinkCustomerRequest>
    {
        new PaymentLinkCustomerRequest
        {
            FirstName = form["Customer_FirstName"],
            LastName = form["Customer_LastName"],
            Email = form["Customer_Email"],
            Phone = form["Customer_Phone"]
        }
    },
    CallbackParameters = new CallbackParameters
    {
        CallbackApiUrl = form["CallbackParameters_CallbackApiUrl"],
        ReferenceNo = form["CallbackParameters_ReferenceNo"]
    },
    ResponseType = RequestPayResponseType.CallBack
};

var response = await apiClient.CreateQRCode(createQRCodeRequest);

var jsonResponse = JsonSerializer.Serialize(response, new JsonSerializerOptions { WriteIndented = true });
Console.WriteLine($"API Response: {jsonResponse}");

6. Get Payment Status by Reference Number

Method: GetTransactionByRefNo

Properties Data Types Details
ReferenceNo string Unique identifier for the transaction.

Code Snippet:

var paymentByRefNo = await apiClient.GetTransactionByRefNo(refNo);
var jsonResponse = JsonSerializer.Serialize(paymentByRefNo, new JsonSerializerOptions { WriteIndented = true });

context.Response.ContentType = "application/json";
await context.Response.WriteAsync(jsonResponse);

License

Distributed under the MIT License. See LICENSE for more information.


For more information, visit the Auropay Documentation.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 561 3/25/2025