usage example


api accepts and responds a json encoded string

PHP request example (customer_registration):
<?php 			

	$url = "http://api.seqrpay.com/service/api";
		
	$data = array(
	'action'  => 'customer_registration'
	,'email' => 'name1@email'
	,'password' => '1'
	,'fname' => 'Tester'
	,'lname' => 'Tester'					
	);		
	
	$data = json_encode($data);
	$data = urlencode($data);			
	$url_en = "data=".$data;
	
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url );
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt( $ch, CURLOPT_POST, 1 );
	curl_setopt( $ch, CURLOPT_POSTFIELDS,$url_en);
	$output = curl_exec($ch);
	curl_close($ch);
				
	$response = json_decode($output);		
	
	if (count($response->error)){	
		foreach ($response->error as $err)
			echo $err->description;									
	}else{
		var_dump($response->data);
	}
		
?>		
				
example:
pre json encode request dump:
array
  'action' => string 'customer_registration' (length=21)
  'email' => string 'name1@email' (length=11)
  'password' => string '1' (length=1)
  'fname' => string 'Tester' (length=6)
  'lname' => string 'Tester' (length=6)
request dump:

{"action":"customer_registration","email":"name1@email","password":"1","fname":"Tester","lname":"Tester"}

response dump:

{"data":{"id":6},"error":[]}

post json decode response dump:
object(stdClass)[1]
  public 'data' => 
    object(stdClass)[2]
      public 'id' => int 6
  public 'error' => 
    array
      empty