ThawaniPaySDKNET 1.0.0

dotnet add package ThawaniPaySDKNET --version 1.0.0
NuGet\Install-Package ThawaniPaySDKNET -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="ThawaniPaySDKNET" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ThawaniPaySDKNET --version 1.0.0
#r "nuget: ThawaniPaySDKNET, 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.
// Install ThawaniPaySDKNET as a Cake Addin
#addin nuget:?package=ThawaniPaySDKNET&version=1.0.0

// Install ThawaniPaySDKNET as a Cake Tool
#tool nuget:?package=ThawaniPaySDKNET&version=1.0.0

ThawaniSDK (.NET) (.NET 5 / .NET Core)

You can find the package on GitHub.

The error codes can be found on Thawani Docs.

For creating a Payment Session:

var checkout = new ThawaniPaySDK.Checkout();
//If you have your API Keys and want to use the Production instead of UAT
var checkout = new ThawaniPaySDK.Checkout("apiKey", "publicKey");
var products = new List<ThawaniPaySDK.Models.CommonModels.ProductModel>()
{
    new ThawaniPaySDK.Models.CommonModels.ProductModel()
    {
        name = "Product 1",
        quantity = 1,
        unit_amount = 100
    }
};

var sessionModel = new ThawaniPaySDK.Models.CheckoutModels.CheckoutSessionCreateRequestModel()
{
    success_url = "https://domain.com/success/",
    cancel_url = "https://domain.com/cancel/",
    mode = "payment",
    client_reference_id = "",
    customer_id = "", //If you have a customer id, the customer can save their cards. We will see how you can initiate a payment intent using a saved card
    products = products,
    metadata = new ThawaniPaySDK.Models.CommonModels.MetadataModel()
    {
        customer_email = "example@domain.com", //Mandatory
        customer_name = "Customer Name", //Mandatory
        customer_phone = "968 12345678", //Mandatory
        customer_id = "", //Optional
        order_id = "" //Optional
    }
};

var sessionInfo = checkout.CreateSession(sessionModel);
var url = checkout.GeneratePaymentURL(sessionInfo.data.session_id);

The payment status of the Checkout Session, one of paid, unpaid, or cancelled. You can use this value to decide when to fulfill your customer’s order.

For creating a Customer (This is required before you can make Payment Intents):

var customer = new ThawaniPaySDK.Customer();
var customerCreateModel = customer.CreateCustomer(new ThawaniPaySDK.Models.CustomerModels.CustomerCreateRequestModel()
{
    client_customer_id = "",
    //A unique Identification from you, it could be an Email or a UserId.
    //It would later be used for retrieval of the Customer Info
});

var customerDeleteModel = customer.DeleteCustomer("customer_id");
//The above will delete customer

var paymentMethods = new ThawaniPaySDK.PaymentMethods();
var customerPaymentMethods = paymentMethods.ListCustomerPaymentMethods("customer_id");
//This above will list out all of the cards with their Masked Numbers, NickName, Brand and an Id (Payment Method Id)

var paymentMethodDeletedModel = paymentMethods.DeleteCustomerPaymentMethod("payment_method_id");
//The above will delete Payment Method

For creating a Payment Intent:

var paymentIntent = new ThawaniPaySDK.PaymentIntent();
//If you have your API Keys and want to use the Production instead of UAT
var paymentIntent = new ThawaniPaySDK.PaymentIntent("apiKey", "publicKey");
var paymentIntentModel = paymentIntent.CreatePaymentIntent(new ThawaniPaySDK.Models.PaymentIntentModels.CreatePaymentIntentRequestModel()
{
    amount = 100,
    client_reference_id = "", //The Customer Id
    metadata = new ThawaniPaySDK.Models.CommonModels.MetadataModel()
    {
        customer_email = "example@domain.com", //Mandatory
        customer_name = "Customer Name", //Mandatory
        customer_phone = "968 12345678", //Mandatory
        customer_id = "", //Optional
        order_id = "" //Optional
    },
    payment_method_id = "", //The Card Id saved at Thawani
    return_url = "https://domain.com/returnURL"
});

var paymentIntentConfirmModel = paymentIntent.ConfirmPaymentIntent(new ThawaniPaySDK.Models.PaymentIntentModels.ConfirmPaymentIntentRequestModel()
{
    amount = 100,
    payment_method_id = "", //The Card Id saved at Thawani
},
paymentIntentModel.data.id);

var paymentIntentURL = paymentIntentConfirmModel.data.next_action.url;

var paymentIntentRetrieveModel = paymentIntent.RetrievePaymentIntent(paymentIntentModel.data.id);

Status of this PaymentIntent, one of requires_payment_method, requires_confirmation, requires_action, cancelled, or succeeded

For further details, you can check Thawani's official docs page.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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 326 7/31/2021