Skip to content

Repository files navigation

Cashfree PG .Net SDK

GitHub Discord GitHub last commit (branch) GitHub release (with filter) GitHub forks

The Cashfree PG .Net SDK offers a convenient solution to access Cashfree PG APIs from a server-side .Net applications.

Documentation

Cashfree's PG API Documentation - https://docs.cashfree.com/reference/pg-new-apis-endpoint

Learn and understand payment gateway workflows at Cashfree Payments here

Try out our interactive guides at Cashfree Dev Studio !

Getting Started

Installation

dotnet add package cashfree-dotnet-pg

Configuration

Version >= 5

using cashfree_pg.Client;
using cashfree_pg.Model;

var cashfree = new Cashfree(Cashfree.SANDBOX, "<x-client-id>", "<x-client-secret>", null, null, null, null);

Generate your API keys (x-client-id , x-client-secret) from Cashfree Merchant Dashboard

Basic Usage

Create Order

var customerDetails = new CustomerDetails("walterwNrcMi", null, "9999999999");
var createOrdersRequest = new CreateOrderRequest(null, 1.0, "INR", customerDetails);
try {
    // Create Order
    var result = cashfree.PGCreateOrder(createOrdersRequest, null, null, null);
    Console.WriteLine(result);
    Console.WriteLine(result.StatusCode);
    Console.WriteLine((result.Content as OrderEntity));
} catch (ApiException e) {
    Console.WriteLine("Exception when calling PGCreateOrder: " + e.Message);
    Console.WriteLine("Status Code: " + e.ErrorCode);
    Console.WriteLine(e.StackTrace);
}

Get Order

try {
    var result = cashfree.PGFetchOrder("<order_id>>", null, null);
    Console.WriteLine(result);
    Console.WriteLine(result.StatusCode);
    Console.WriteLine((result.Content as OrderEntity));
} catch (ApiException e) {
    Console.WriteLine("Exception when calling PGFetchOrder: " + e.Message);
    Console.WriteLine("Status Code: " + e.ErrorCode);
    Console.WriteLine(e.StackTrace);
}

Licence

Apache Licensed. See LICENSE.md for more details

About

.NET Framework for Cashfree Payment Gateway

Topics

Resources

Code of conduct

Security policy

Stars

3 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages