Skip to content

Instantly share code, notes, and snippets.

[HttpPost]
public ActionResult Complete()
{
// Payment data comes in url so we have to get it from url
// This id is razorpay unique payment id which can be use to get the payment details from razorpay server
string paymentId = Request.Params["rzp_paymentid"];
// This is orderId
string orderId = Request.Params["rzp_orderid"];
// Generate random receipt number for order
Random randomObj = new Random();
string transactionId = randomObj.Next(10000000, 100000000).ToString();
Razorpay.Api.RazorpayClient client = new Razorpay.Api.RazorpayClient("-- Razorpay Key --", "-- Razorpay Secret --");
Dictionary<string, object> options = new Dictionary<string, object>();
options.Add("amount", paymentData.amount * 100); // Amount will in paise
options.Add("receipt", transactionId);
options.Add("currency", "INR");
options.Add("payment_capture", "0"); // 1 - automatic , 2 - manual
@model razorpay_demo.Controllers.PaymentController.OrderModel
<!-- // Click this button automatically when this page load using javascript -->
<!-- You can hide this button -->
<button id="rzp-button1" hidden>Pay</button>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<script>
var options = {
"key": "@Html.DisplayFor(model => model.razorpayKey)", // Enter the Key ID generated from the Dashboard
"amount": "@Html.DisplayFor(model => model.amount)", // Amount is in currency subunits. Default currency is INR. Hence, 50000 refers to 50000 paise
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
// If necessary, modify the path in the require statement below to refer to the
// location of your Composer autoload.php file.
require './vendor/autoload.php';
composer require phpmailer/phpmailer
public void SendNotification()
{
try
{
dynamic data = new
{
to = YOUR_FCM_DEVICE_ID, // Uncoment this if you want to test for single device
// registration_ids = singlebatch, // this is for multiple user
notification = new
{
dynamic data = new
{
// to = YOUR_FCM_DEVICE_ID, // Uncoment this if you want to test for single device
registration_ids = singlebatch, // this is for multiple user
data = new
{
message = "-Your message-",
name = "Shoury",
userId = 134,
status = true
dynamic data = new
{
// to = YOUR_FCM_DEVICE_ID, // Uncoment this if you want to test for single device
registration_ids = singlebatch, // this is for multiple user
notification = new
{
title = _model.title, // Notification title
body = _model.message, // Notification body data
link = _model.link // When click on notification user redirect to this link
}
<?php
require './vendor/autoload.php';
$params = array(
'credentials' => array(
'key' => '-- Your IAM User Key --',
'secret' => '-- Your IAM User Key Secret --',
),
'region' => 'us-east-1', // < your aws from SNS Topic region
'version' => 'latest'
composer require aws/aws-sdk-php