Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net Route API Transfers #35

Open
shalabh2016 opened this issue Nov 17, 2019 · 0 comments
Open

.Net Route API Transfers #35

shalabh2016 opened this issue Nov 17, 2019 · 0 comments

Comments

@shalabh2016
Copy link

shalabh2016 commented Nov 17, 2019

Hello,

Also I have a build of RazorPay SDK working with .NET Core 3.0, if you want then I can share it with you the dll.

The documentation of .NET API is not complete so, I want to contribute a Transfer API example to your docs, please find it below:

var payment = _client.Payment.Fetch("PAYMENT_ID");
try{
	Dictionary<string, object> transfers = new Dictionary<string, object>();

	//Converting to UNIX Timestamp for Account Hold.
	DateTime temp = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
	var unixTimeStamp = (long)(DateTime.UtcNow.AddDays(1).Subtract(temp)).TotalSeconds;

	//Transfer Options
	Dictionary<string, object> options = new Dictionary<string, object>();
	options.Add("amount", 100);
	options.Add("currency", "INR");
	options.Add("account", "ACCOUNT_ID");

	//If you want to hold the account transfer
	options.Add("on_hold", 1);

	//If you want to hold the account transfer to specific DateTime
	options.Add("on_hold_until", unixTimeStamp);

	//Transfer List
	List<Dictionary<string, object>> transferList = new List<Dictionary<string, object>>();
	transferList.Add(options);
	
	//Creating Object to pass as "data" in Payment.Transfer(Dictionary<string, object> data)
	transfers.Add("transfers", transferList);
	
	// List<Transfer>
	var transferResult = payment.Transfer(transfers);	
	 var transferId = transferResult[0]["id"];

} catch {
	//Write To Console
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant