Topic: Node.js

How to integrate CardConnect payment Gateway with Node JS 0

How to integrate CardConnect payment Gateway with Node JS

Today, We want to share with you How to integrate CardConnect payment Gateway with Node JS.In this post we will show you Payment Gateway API Integration with CardConnect using Node JS, hear for Node JS – Integrate Stripe Payment Gateway in Express JS we will give you demo and example for implement.In this post, we will learn about Payment Integration With Node.Js: : Express, Request and Paystack API with an example.

How to integrate CardConnect payment Gateway with Node JS

There are the Following The simple About How to integrate CardConnect payment Gateway with Node JS Full Information With Example and source code.

As I will cover this Post with live Working example to develop Node.js PayPal – Create Direct Credit Card Payment, so the CardConnect Payments Integration for SAP by CardConnect for this example is following below.

Step 1: npm init command simple Init Web App

npm init --yes

Step 2: Install the dependencies

npm install axios

Step 3 : payment.js SAVE file / run

	
const axios = require('axios');
 
const config_datas = new Buffer('example:atmiya25').toString('base64')
 
const FetchAuthRequestPaymentToken = async (data) => {
 
    try {
 
        const config = {
            headers: {
                'Content-Type': 'application/json',
                'Authorization': `Basic ${config_datas}`
            }
        };
 
        const URL = 'https://fts.cardconnect.com:6443/cardconnect/rest/auth';
 
        return await axios.put(URL, data, config);
 
    } catch (error) {
 
        throw (error);
 
    }
}
 
const makeCharge = async (data) => {
 
    try {
 
        const config = {
            headers: {
                'Content-Type': 'application/json',
                'Authorization': `Basic ${config_datas}`
            }
        };
 
        const URL = 'https://fts.cardconnect.com:6443/cardconnect/rest/capture';
 
        return await axios.put(URL, data, config);
 
    } catch (error) {
 
        throw (error);
 
    }
}
 
 
 
(async() => {
 
    const NrequestPaymentData = await FetchAuthRequestPaymentToken({
        account: '8957785856665999',
        merchid: '8989898989556',
        amount: '1800', // simple here Smallest currency unit. e.g. 100 cents to charge $1.00
        expiry: '1260',
        currency: 'USD'
    });
 
    const charge = await makeCharge({
        merchid: NrequestPaymentData.data.merchid, 
        retref: NrequestPaymentData.data.retref
    });
 
    console.log(charge);
 
})();

Step 4: simple Run the above nodejs source code with below simple command.

    node payment.js

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about How to integrate CardConnect payment Gateway with Node JS.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

No Access-Control-Allow-Origin header 0

No Access-Control-Allow-Origin header

No Access-Control-Allow-Origin header

Today, We want to share with you No Access-Control-Allow-Origin header.
In this post we will show you How to solve – No ‘Access-Control-Allow-Origin’, hear for How to fix Access-Control-Allow-Origin (CORS origin) we will give you demo and example for implement.
In this post, we will learn about ERROR : No “Access-Control-Allow-Origin” header is present with an example.

Error: “No Access-Control-Allow-Origin header” is some data present on the data requested main resource.

How to solve – No ‘Access-Control-Allow-Origin’ – Syntax

The simple used in server side Access-Control-Allow-Origin some response Data header indicates some results whether the data response can be more shared with data resources with the given PHP, .net, webapi, C#, etc. origin.

Access-Control-Allow-Origin: *
Access-Control-Allow-Origin: 

PHP SET- Access-Control-Allow-Origin

If you are using Latest <b.Node.js, For used to:

app.use(function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
    next();
});

For c# web services – webapi

Please put the following source code in your App web.config simple file under C# tag tag.

Please create sure you are not any access doing any some mistake in the jquery ajax call

jQuery

$.ajax({
    url: 'http://live24u.com/api/mycall',
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded'
    }, 
    type: "POST", /* methods or type:"GET" methods or type:"PUT" methods */
    dataType: "json", //dataType
    data: {
    },
    success: function (data) {
        console.log(data);    
    },
    error: function () {
        console.log("error");
    }
});

Mixed Content: The page was not data loaded over HTTPS. This some request has been blocked.

In some order to fix an issue for your WordPress website or ay blog, just put simple below source code into your root .htaccess file.

.htaccess

  
    Header set Access-Control-Allow-Origin "*"
  

As you Display Access-Control-Allow-Origin “*” some allows you to all the file access all folder and files resources and webfonts from all this domains.

We hope you get an idea about No ‘Access-Control-Allow-Origin’ solve this error header is present
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

NodeJS RESTful CRUD API and MYSQL – node js Restify Tutorial 0

NodeJS RESTful CRUD API and MYSQL - node js Restify Tutorial

NodeJS RESTful CRUD API and MYSQL – node js Restify Tutorial

In this Post We Will Explain About is NodeJS RESTful CRUD API and MYSQL – node js Restify Tutorial With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Node JS REST API Example Using Restify and MySQLExample

In this post we will show you Best way to implement creating a rest api using node.js and mysql, hear for building rest api with node js and mysqlwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Rest API Using Nodejs and RESTful Web-Services with MySQL

We are using following some files as well as Directory

We are creating a Directory ‘nodejs-RESTful-restapi-example’.It’s is our nodejs web-application name.

package.json: It’s file would have lots of nodejs some dependencies module for this best example.
config.js: It’s file would use for databse connection some parameters as well as object for db like as a mysql.
main.js: It’s file would use to make nodejs web-application server side as well as routes url.
node_modules Directory: It’s Directory would contains lots of nodejs packages.

Make MYSQL Database and Table Structure for simple User Authentication

We are using db like as a mysql server for store lots of the info like as a user registration information into stored MySQL table.you would make ‘live24u’ name database as well as into MySQL server.you would make ‘students’ table into ‘live24u’ mysql database using below some source script.

CREATE TABLE IF NOT EXISTS `students` (
  `studid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
  `students_name` varchar(255) NOT NULL COMMENT 'students name',
  `students_salary` double NOT NULL COMMENT 'students salary',
  `students_age` int(11) NOT NULL COMMENT 'students age',
  PRIMARY KEY (`studid`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 COMMENT='datatable demo table' AUTO_INCREMENT=3 ;

Make Package.json file

you would make package.json file for this RESTful Web-Services nodejs simple application into root path of following node js application Like as a ‘nodejs-RESTful-restapi-example’.It’s file create a simple what external libraries or some modules would be use in simple this nodejs web-application.You need to create below some sourcecode into simple package.json file.

{
  "name": "nodejs-restapi",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "live24u": "echo \"Error: no live24u specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "mysql": "^2.14.1",
    "RESTful": "^5.2.0"
  }
}

d:/nodejs-RESTful-restapi-example> npm install

The Node js RESTful Web Services Information are as follows:

Route Method Type Posted Data Json Description
/studentss GET Data Json Get lots of studentss data
/studentss/{studid} GET Data Json Get a single students data
/studentss POST Data Json {"students_name": "Rachel", "students_age": "34", "students_salary" : "23421"} Insert new students data row(records) into database
/studentss PUT Data Json {"students_name": "Rachel", "students_age": "34", "students_salary" : "23421", "studid":21} Update students data row(records) into database
/studentss DELETE Data Json {"studid" : 59} Delete particular students data row(records) from database

Make MySQL Connection with Nodejs

MySQL is very popular opensource simple relational Management database.you would make simple MySQL database simple connection data into config.js in your package file The config.js directory file location would Like as a be d:\nodejs-RESTful-restapi-example\config.js. you would simple add following source code into this file sample.

'use strict'
var mysql = require('mysql');
module.exports = {
    name: 'RESTful-Web-Services',
    hostname : 'http://localhost',
    version: '0.0.1',
    env: process.env.NODE_ENV || 'development',
    port: process.env.PORT || 3000,
    db: {
        get : mysql.makeConnection({
			host     : 'localhost',
			user     : 'root',
			password : '',
			database : 'live24u1'
		})
    }
}

Make Node.js Rest Api using Restify and MySQL

Phase 1: Maked main.js file into simple js frameworks node js project and maked simple dependency module steps instances.

	const config  = require('./config'),
      RESTful = require('RESTful'),
      mysql      = require('mysql')

Phase 2: Get MySQL connection object tomain.js file.

var connection = config.db.get;

Phase 3: you would add some RESTful API plugin for json data convert means parser as well as configuration (settings)like following below,

//use nodejs server
server.use(RESTful.plugins.acceptParser(server.acceptable));
server.use(RESTful.plugins.queryParser());
server.use(RESTful.plugins.bodyParser());

Make node.js Server

you would make node.js RESTful server that would some listen our request and response on particular port simple.We are running here node js server on used to 3001 port, you can some more change port as per your generally port availability.

/**
 * Pakainfo.com Initialize Server
 */
const server = RESTful.makeServer({
    name    : config.name,
    version : config.version,
    url : config.hostname
});
server.listen(3001, function () {
  console.log('%s listening at %s', server.name, server.url);
});

Node.js Rest Api to fetch lots of data row(records) from MySQL Database Using Restify

you would make a GET Rest Request to access lots of students data row(records)s from simple MySQL database each table.you would use MySQL SQL query to Retrive data from students table and send some json data to client simple as response each object.

//RESTful Web-Services to get lots of response
server.get('/studentss', function (req, results) {
   connection.query('select * from students', function (error, response, fields) {
	  if (error) throw error;
	  results.end(JSON.stringify(response));
	});
});

Rest Api to get single data row(records) from Mysql Database Using Node.js

you would make a GET type RESTful request to access a single students data row(records) from MySQL database table.you would use simple MySQL query to Retrive data row(records) of particular students and send json information data to client side as response per object.

//RESTful Web-Services to get a single students data
server.get('/studentss/:studid', function (req, results) {
   connection.query('select * from students where studid=?', [req.params.studid], function (error, response, fields) {
	  if (error) throw error;
	  results.end(JSON.stringify(response));
	});
});

Rest Api to Make New Record into MySQL Using Node.js and Restify

you would make a new Rest Api to make a new students data entry into MySQL database table using node.js server. We would make POST type Rest request so you would post some data JSON data to node server.

//RESTful Web-Services to make a new data row(records) into simple mysql database
server.post('/studentss', function (req, results) {
   var postData  = req.body;
   connection.query('INSERT INTO students SET ?', postData, function (error, response, fields) {
	  if (error) throw error;
	  results.end(JSON.stringify(response));
	});
});

Rest Web-Services to Update Record into simple MySQL Database Using Node JS

you would make new PUT type Restful Web-Services request using js frameworks nodejs and RESTful to update data into simple MySQL database.you need to pass students studid which would use to updated data row(records) into table.

//RESTful Web-Services to update data row(records) into mysql database table
server.put('/studentss', function (req, results) {
   connection.query('UPDATE `students` SET `students_name`=?,`students_salary`=?,`students_age`=? where `studid`=?', [req.body.students_name,req.body.students_salary, req.body.students_age, req.body.studid], function (error, response, fields) {
	  if (error) throw error;
	  results.end(JSON.stringify(response));
	});
});

Node js RESTful Web Services to Delete Record from MySQL Database

you would make new DELETE Type RESTful Api request using node js to delete students data row(records) from MySQL database table.you would pass students studid as a parameters which we want to remove from MySQL database table.

//RESTful Web-Services to delete data row(records) from simple mysql database
server.delete('/studentss/:studid', function (req, results) {
   connection.query('DELETE FROM `students` WHERE `studid`=?', [req.params.studid], function (error, response, fields) {
    if (error) throw error;
    results.end('Pakainfo.com - Record has been deleted!');
  });
});

Example

I hope you have Got What is Node JS REST API Example Using Restify and MySQL And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Stripe API Master – Download Stripe API using PHP 0

Stripe API Master - Download Stripe API using PHP

Stripe API Master – Download Stripe API using PHP

In this Post We Will Explain About is Stripe API Master – Download Stripe API using PHP With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Stripe API Master – Download Stripe API using PHPExample

In this post we will show you Best way to implement Stripe API Master – Download Stripe API using PHP, hear for Stripe API Master – Download Stripe API using PHPwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

In this Post to Learn, Balance,The balance object,The balance transaction object,Retrieve balance,Retrieve a balance transaction,List all balance history,Charges,The charge object,Create a charge,Retrieve a charge,Update a charge,Capture a charge,List all charges,Customers,The customer object,Create a customer,Retrieve a customer,Update a customer,Delete a customer,List all customers,Disputes,The dispute object,The dispute evidence object,Retrieve a dispute,Update a dispute,Close a dispute,List all disputes,Events,The event object,Retrieve an event,List all events,Types of events,File Uploads,The file upload object.

Config.php

Create.php

require_once('config.php');
$required = array('email','country','currency','ssn_last_4','personal_id_number','account_holder_name','account_holder_type','routing_number','account_number');

	// Devloped By : Pakainfo.com - Loop over field names, make sure each one exists and is not empty
	$error = false;
	foreach($required as $field) {
	  if (empty($_POST[$field])) {
		$error = true;
	  }
	}

	if ($error) {
	  echo "Some fields are required.";
	  
	} 
	else 
	{
		
				$account =\Stripe\Token::create(array(
				"bank_account" => array(
				"country" => $_POST['country'],
				"currency" => $_POST['currency'],
				"account_holder_name" => $_POST['account_holder_name'],
				"account_holder_type" => $_POST['account_holder_type'],
				"routing_number" => $_POST['routing_number'],
				"account_number" => $_POST['account_number']
			  )
			)); 
			$get_customer_information = $account->__toJSON();
			$obj = json_decode($get_customer_information, TRUE);

						if($get_customer_information)
						{
							$optional = array('business_name','line1','line2','city','postal_code','country','state','email','business_tax_id','first_name','last_name','personal_id_number','ssn_last_4','type','dob');
							$data=array();
							foreach($optional as $field) {
								if(array_key_exists($field,$_POST))
								{
									$data[$field]=$_POST[$field];
								}
								else
								{
									$data[$field]="";
								}
							}
							if($data['dob']!="")
							{
								$thedate = explode("/", $data['dob']);
							}
							else
							{
								
								 $date=date_create("00-00-1971");
								$thedate = explode("/",date_format($date,'d/m/Y'));
							}
							//print_r($data);
							//die();
							$account_data = \Stripe\Account::create(
								array(
									"country" => $data['country'],
									"email" => $data['email'],
									"managed" => true,
									"legal_entity" => array(
										'address' => array(
											'city' => $data['city'],
											'country' => $data['country'],
											"line1" => $data['line1'],
											"line2" => $data['line2'],
											"postal_code" =>$data['postal_code'],
											"state" => $data['state']
										),
										'business_name' => $data['business_name'],
										'business_tax_id' => $data['business_tax_id'],
										'dob' => array(
											'day' => $thedate[0],
											'month' => $thedate[1],
											'year' => $thedate[2]
											),
									'first_name' => $data['first_name'],
									'last_name' => $data['last_name'],
									'personal_id_number' => $data['personal_id_number'],
									'ssn_last_4' => $data['ssn_last_4'],
									'type' => $data['type']
									),
									'tos_acceptance' => array(
										'date' => time(),
										'ip' => $_SERVER['REMOTE_ADDR']
									),
									
									'external_account' =>$obj['id']
								));
								
								$customer_json_data = $account_data->__toJSON();
								$obj_data = json_decode($customer_json_data, TRUE);
								print_r($customer_json_data);
						}


	}
	if($customer_json_data)
	{
		$stripe_type="RESPONSE for create account";
		$accid=$obj_data['id'];
		$object=$obj_data['object'];
		$country=$obj_data['country'];
		$currency=$obj_data['default_currency'];
		$email=$obj_data['email'];
		$s_json=$customer_json_data;

		$sql_add_supplay=mysql_query("INSERT INTO `strip_master` (`s_id`, `stripe_type`, `accid`, `object`, `country`, `currency`, `email`,`s_json`, `s_date`)
		VALUES(NULL,'$stripe_type', '$accid', '$object', '$country', '$currency', '$email','$s_json',Now())");
	}

In this Post to Learn, Create a file upload,Retrieve a file upload,List all file uploads,Payouts,The payout object,Create a payout,Retrieve a payout,Update a payout,List all payouts,Cancel a payout,Types of payout failures,Refunds,The refund object,Create a refund,Retrieve a refund,Update a refund,List all refunds,Tokens,The token object,Bank Accounts,The bank account object,Create a bank account,Retrieve a bank account,Update a bank account,Verify a bank account,Delete a bank account,List all bank accounts,Cards,The card object,Create a card,Retrieve a card,Update a card,Delete a card,List all cards,Sources

charge.php

require_once('config.php');
$required = array('currency','amount','application_fee','number','exp_month','exp_year','cvc');
// Devloped By : Pakainfo.com - Loop over field names, make sure each one exists and is not empty
$error = false;
foreach($required as $field) {
  if (empty($_POST[$field])) {
	$error = true;
  }
}
if ($error) {
  echo "Some fields are required.";
  
}
else
{
	
	$optional = array('receipt_email','description','currency','amount','application_fee','number','exp_month','exp_year','cvc');
	$data=array();
	foreach($optional as $field) 
	{
		if(array_key_exists($field,$_POST))
		{
			$data[$field]=$_POST[$field];
		}
		else
		{
			$data[$field]="";
		}
	}


 $account = \Stripe\Token::create(array(
				  "card" => array(
					"number" => $data['number'],
					"exp_month" => $data['exp_month'],
					"exp_year" => $data['exp_year'],
					"cvc" => $data['cvc']
				  )
				));
	$get_customer_information = $account->__toJSON();
	$obj = json_decode($get_customer_information, TRUE);
	if($obj)
	{
	
		$account_data =\Stripe\Charge::create(array(
		  "amount" => $data['amount'],
		  "currency" => $data['currency'],
		  "source" => $obj['id'], 
		  "description" =>$data['description'],
		  "receipt_email" =>$data['receipt_email']
		  
		  
		 // "application_fee"=>123
		));
		$customer_json_data = $account_data->__toJSON();
		$obj_redata = json_decode($customer_json_data, TRUE);
		print_r($obj_redata);

				if($customer_json_data)
				{
					$c_type="RESPONSE for charge data";
					$chargeid=$obj_redata['id'];
					$object=$obj_redata['object'];
					$amount=$obj_redata['amount'];
					$balance_transaction=$obj_redata['balance_transaction'];
					$amount_refunded=$obj_redata['amount_refunded'];
					$currency=$obj_redata['currency'];
					$application_fee=$obj_redata['application_fee'];
					$description=$obj_redata['description'];
					$status=$obj_redata['status'];
					$s_json=$customer_json_data;

					$sql_add_refund=mysql_query("INSERT INTO `charge_mst` (`cid`,`chargeid`,`type`,`object`,`amount`,`balance_transaction`,`amount_refunded`,`currency`,`application_fee`,`description`,`json`,`status`,`c_date`)
					VALUES(NULL,'$chargeid', '$c_type','$object','$amount','$balance_transaction', '$amount_refunded','$currency','$application_fee','$description','$s_json','$status',Now())");
				}
			
		}
	}

In this Post to Learn, Update a card,Delete a card,List all cards,Recipients,The recipient object,Create a recipient,Retrieve a recipient,Update a recipient,Delete a recipient,List all recipients,Transfers,The transfer object,Create a transfer,Retrieve a transfer,Update a transfer,List all transfers,Transfer Reversals,The transfer reversal object,Create a transfer reversal,Retrieve a reversal,Update a reversal,List all reversals.

createorder.php

require_once('config.php');
$required = array('currency');

// Devloped By : Pakainfo.com - Loop over field names, make sure each one exists and is not empty
$error = false;
foreach($required as $field) {
  if (empty($_POST[$field])) {
	$error = true;
  }
}

if ($error) {
  echo "Some fields are required.";
  
}
else
{
	
	$optional = array('line1','name','type','parent','currency','city','postal_code','country','state','email');
						$data=array();
						foreach($optional as $field) {
							if(array_key_exists($field,$_POST))
							{
								$data[$field]=$_POST[$field];
							}
							else
							{
								$data[$field]="";
							}
						}
						
	$account =\Stripe\Order::create(array(
	  "items" => array(
		array(
		  "type" => "sku",
		  "parent" => $data['parent']
		)
	  ),
	  "currency" => $data['currency'],
	  "shipping" => array(
		"name" => $data['name'],
		"address" => array(
		  "line1" => $data['line1'],
		  "city" => $data['city'],
		  "country" => $data['country'],
		  "postal_code" => $data['postal_code']
		)
	  ),
	  "email" => $data['email']
	));
	$get_customer_information = $account->__toJSON();
			$obj = json_decode($get_customer_information, TRUE);
			print_r($get_customer_information);
			
		if($get_customer_information)
		{
			$stripe_type="RESPONSE for create New Order";
			$oid=$obj['id'];
			$object=$obj['object'];
			$email=$obj['email'];
			$amount=$obj['amount'];
			$currency=$obj['currency'];
			$smethod=$obj['selected_shipping_method'];
			$s_json=$get_customer_information;
			$sql_add_supplay=mysql_query("INSERT INTO `order_mst` (`oid`, `order_id`, `type`, `object`,`email`, `amount`,`currency`,`shipping_method`,`json`, `cr_date`) 
			VALUES(NULL,'$oid', '$stripe_type','$object','$email', '$amount','$currency','$smethod','$s_json',Now())");
		}
}	

createproduct.php

require_once('config.php');
$account =\Stripe\Product::create(array(
	  "name" => $_POST['name'],
	  "description" => $_POST['description'],
	  "attributes" => ["size", "gender"]
	));

	$get_customer_information = $account->__toJSON();
	$obj = json_decode($get_customer_information, TRUE);
	print_r($get_customer_information);
	if($get_customer_information)
	{
		$stripe_type="RESPONSE for create New Product";
		$proid=$obj['id'];
		$object=$obj['object'];
		$active=$obj['active'];
		$name=$obj['name'];
		$description=$obj['description'];
		$s_json=$get_customer_information;

		$sql_add_supplay=mysql_query("INSERT INTO `product_mst` (`pid`, `prod_id`, `type`, `object`, `active`, `prod_name`, `prod_desc`,`json`, `cr_date`) VALUES(NULL,'$proid', '$stripe_type','$object','$active','$name', '$description','$s_json',Now())");
	}

In this Post to Learn, The source object,Coupons,The coupon object,Create a coupon,Retrieve a coupon,Update a coupon,Delete a coupon,List all coupons,Discounts,The discount object,Delete a customer discount,Delete a subscription discount,Invoices,The invoice object,The (invoice) line item object,Create an invoice,Retrieve an invoice,Retrieve an invoice’s line items,Retrieve an upcoming invoice,Update an invoice,Pay an invoice,List all invoices,Invoice Items,The invoiceitem object,Create an invoice item,Retrieve an invoice item,Update an invoice item,Delete an invoice item,List all invoice items,Plans.

createsku.php

require_once('config.php');

$account =\Stripe\SKU::create(array(
  "product" => $_POST['productid'],
  "attributes" => array(
	"size" => "Medium",
	"gender" => "Unisex"
  ),
  "price" => $_POST['price'],
  "currency" => $_POST['currency'],
  "inventory" => array(
	"type" => "finite",
	"quantity" => $_POST['quantity']
  )
));    
$get_customer_information = $account->__toJSON();
		$obj = json_decode($get_customer_information, TRUE);
		print_r($get_customer_information);
	if($get_customer_information)
	{
		$stripe_type="RESPONSE for create New SKU";
		$proid=$obj['product'];
		$object=$obj['object'];
		$active=$obj['active'];
		$price=$obj['price'];
		$sku=$obj['id'];
		$s_json=$get_customer_information;

		$sql_add_supplay=mysql_query("INSERT INTO `product_mst` (`pid`, `prod_id`,`sku`, `type`, `object`, `active`,`price`,`json`, `cr_date`) VALUES(NULL,'$proid','$sku','$stripe_type','$object','$active','$price','$s_json',Now())");
	}

delete.php

require_once('config.php');

$account = \Stripe\Account::retrieve($_POST['account_id']);
$account->delete();

$get_customer_information = $account->__toJSON();
$obj = json_decode($get_customer_information, TRUE);

print_r($get_customer_information);

if($get_customer_information)
{
	$stripe_type="RESPONSE - for delete account";
	$accid=$obj['id'];
	$object=$obj['deleted'];
	if($object=="true")
	{
		$object_data="Account - deleted";
	}
	$s_json=$get_customer_information;
	$s_date= date('d-m-Y H:i:s');
	$sql_add_supplay=mysql_query("INSERT INTO `strip_master` (`s_id`, `stripe_type`, `accid`, `object`, `s_json`, `s_date`)
	VALUES(NULL,'$stripe_type', '$accid', '$object_data','$s_json',Now())");
} 

In this Post to Learn, The plan object,Create a plan,Retrieve a plan,Update a plan,Delete a plan,List all plans,Subscriptions,The subscription object,Create a subscription,Retrieve a subscription,Update a subscription,Cancel a subscription,List subscriptions,Subscription Items,The subscription item object,Create a subscription item,Retrieve a subscription item,Update a subscription item,Delete a subscription item,List all subscription items,Account,The account object,Create an account,Retrieve account details,Update an account,Delete an account,Reject an account,List all connected accounts,The login link object

refund.php

require_once('config.php');

$required = array('charge');

	// Devloped By : Pakainfo.com - Loop over field names, make sure each one exists and is not empty
	$error = false;
	foreach($required as $field) {
	  if (empty($_POST[$field])) {
		$error = true;
	  }
	}

	if ($error) {
	  echo "Some fields are required.";
	  
	}
	else
	{
		
		$optional = array('charge','amount','receipt_number','reason');
							$data=array();
							foreach($optional as $field) {
								if(array_key_exists($field,$_POST))
								{
									$data[$field]=$_POST[$field];
								}
								else
								{
									$data[$field]="";
								}
							}
						
		$re_data = \Stripe\Refund::create(array(
		  "charge" => $data['charge']
		  //"amount" => $data['amount']
		));

$customer_refund = $re_data->__toJSON();
$obj_redata = json_decode($customer_refund, TRUE);
print_r($obj_redata);

			if($customer_refund)
			{
				$r_type="RESPONSE for Refund data";
				$refundid=$obj_redata['id'];
				$object=$obj_redata['object'];
				$amount=$obj_redata['amount'];
				$balance_transaction=$obj_redata['balance_transaction'];
				$charge=$obj_redata['charge'];
				$currency=$obj_redata['currency'];
				$reason=$obj_redata['reason'];
				$receipt_number=$obj_redata['receipt_number'];
				$status=$obj_redata['status'];
				$s_json=$customer_refund;

				$sql_add_refund=mysql_query("INSERT INTO `refund_mst` (`rid`,`refundid`,`type`,`object`,`amount`,`balance_transaction`,`charge`,`currency`,`reason`,`receipt_number`,`json`,`status`,`r_date`)
				VALUES(NULL,'$refundid', '$r_type','$object','$amount','$balance_transaction', '$charge','$currency','$reason','$receipt_number','$s_json','$status',Now())");
			}
	}	

update.php

require_once('config.php');

 $required = array('account_id');

			// Devloped By : Pakainfo.com - Loop over field names, make sure each one exists and is not empty
			$error = false;
			foreach($required as $field) {
			  if (empty($_POST[$field])) {
				$error = true;
			  }
			}

			if ($error) {
			  echo "Account id fields are required.";
			  
			}
		
	foreach($_POST as $key=>$value)
	{
		if($key!='account_id')
		{
				$account = \Stripe\Account::retrieve($_POST['account_id']);
				$account->$key = $value;
				$account->save();	
		}
	
	}
	
$get_customer_information = $account->__toJSON();
$obj = json_decode($get_customer_information, TRUE);
print_r($get_customer_information);
if($get_customer_information)
{
	$stripe_type="RESPONSE for Update account";
	$accid=$obj['id'];
	$object=$obj['object'];
	$country=$obj['country'];
	$currency=$obj['default_currency'];
	$email=$obj['email'];
	$s_json=$get_customer_information;
	$sql_update=mysql_query("update `strip_master` SET `stripe_type`='$stripe_type', `object`='$object', `country`='$country', `currency`='$currency', `email`='$email',`s_json`='$s_json', `s_date`=Now() where `accid`='$accid'");

}

In this Post to Learn,Create a login link,Application Fee Refunds,The application fee refund object,Create an application fee refund,Retrieve an application fee refund,Update an application fee refund,List all application fee refunds,Application Fees,The application fee object,Retrieve an application fee,List all application fees,Country Specs,The country spec object,List Country Specs,Retrieve a Country Spec,External Accounts,The (account) bank account object,Create a bank account,Retrieve a bank account,Update a bank account,Delete a bank account,List all bank accounts,The (account) card object,Create a card,Retrieve a card.

Example

I hope you have Got What is Stripe API Master – Download Stripe API using PHP And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

Search Filter using Nodejs and MySQL 0

Search Filter using Nodejs and MySQL

Search Filter using Nodejs and MySQL

In this Post We Will Explain About is Search Filter using Nodejs and MySQL With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Ajax Search Box using Node and MySQL Example

In this post we will show you Best way to implement Ajax Search box using Nodejs and MySQL, hear for Search record with two fields from MYSQL table by using Node.js with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Ajax Search box using Nodejs and MySQL

we prepare a simple connection by using mysql.createConnection() method of database connect MySQL simple module.There are simple very some things that we have to data define inside our create db connection data methods like localhost host name, simple user name, set your password, and set your database name.

Database details: connect with Node.js

  • set Hostname: localhost
  • database Port number: Set 3306
  • set Username: root
  • set Password: Pakainfo.com
  • simple set Database: Live24u
  • Set Table name: users
  • Fields: user_id and name
  • Server File : Node.js

    step-1 : prepare a connection

    var mysql = require('mysql');
    

    step-2 : Database Connect MYSQL table by using Node.js

    var DB_Conn = mysql.createConnection({
      host: "localhost",
      user: "root",
      password: "[email protected]#fdfjdf",
      database: "Live24u"
    });
    

    step-3 : query() method

    DB_Conn.connect(function(db_error) {
      if (db_error) throw db_error;
      console.log("Connected!");
      var sql = "select * from users where user_id='1' and name='jaydeep'";
    

    step-4 : query() method

    DB_Conn.connect(function(db_error) {
      if (db_error) throw db_error;
      console.log("Connected!");
      var sql = "select * from users where user_id='1' and name='jaydeep'";
    //step-4
      DB_Conn.query(sql, function (db_error, result) {
        if (db_error) throw db_error;
        console.log(result);
      });
    });
    

    Discussing steps that we have followed in our server file:

    1.Require simple MySQL module.
    2.Make Connection some variable using mysql.createConnection() function.
    3.Connect by using con.connect() function.
    4.make a SELECT Simple SQL some query by using data fields set user_id and name.
    5.Execute some query string by using .query() function.
    6.Show data result.

    Connecting nodejs app to Mysql

    You are Most welcome in my you tube Channel Please subscribe my channel. and give me Feed Back.
    More Details……
    Angularjs Example

    Example

    I hope you have Got What is nodejs ajax search bar with javascript ,juquery and mysql database And how it works.I would Like to have Feed Back From My Blog(Pakainfo.com) readers.Your Valuable Feed Back,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.