shopifystats

Rest API

Advanced integration to secure your payments while you control the flow of the transaction.

#API </> {REST}

For a sandbox account please send a request to support@paidyet.com

Overview

To use PaidYET’s RESTful api, you will need to follow these steps:
1. Generate an API key and white-list your IP address in the PayPage -> API page
2. Get Authentication Token from our REST server
3. Use token to make calls to the endpoints.

 

Sample to get Authentication Token (cURL)

  
     $postdata =   [
        'subdomain' => '[Your Subdomain]',
        'key' => '[Your API Key]',
        'nonce'   => rand(154678, 10000000),
        'time'=>time()
    ];
    $ch = curl_init();
    $url =  "https://api.paidyet.com/v2/login";
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    try{
	    $output = curl_exec($ch);
    }
    catch(\Exception $e) {
	    throw $e;
    }
    curl_close($ch);

 

Sample to get all transactions

    $ch = curl_init();
    $url =  "https://api.paidyet.com/v2/transactions";
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER,array("Authorization: Bearer ".$token  ));
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    try{
	    $output = curl_exec($ch);
    }
    catch(\Exception $e) {
	    throw $e;
    }
    curl_close($ch);

 

Sample to get one transaction

  
  $ch = curl_init();
  $url =  "https://api.paidyet.com/v2/transaction/[TRN ID]";

  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_HTTPHEADER,array("Authorization: Bearer ".$token  ));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  try{
    $output = curl_exec($ch);
  }
  catch(\Exception $e) {
    throw $e;
  }
  curl_close($ch);

 

 

Sample run a sale transaction (Credit Card)

(this can only be done with a valid PaidYET credit card token. Can be obtained from the card on file API call)

$ch = curl_init();
  $url =  "https://api.paidyet.com/v2/runsale";
  $postdata = ['amount'=>[AMOUNT],'email'=>[email], 'token'=>[credit card token]];
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
  curl_setopt($ch, CURLOPT_HTTPHEADER,array("Authorization: Bearer ".$token  ));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  try{
    $output = curl_exec($ch);
  }
  catch(\Exception $e) {
    throw $e;
  }
  curl_close($ch);

 

Sample run a sale transaction (ACH)

(ACH must be enabled on the merchant account to run this transaction.)

  
  $ch = curl_init();
  $url =  "https://api.paidyet.com/v2/runsale";
  $postdata = ['amount'=>[AMOUNT],'email'=>[email], 
'accountholder'=>[bank account card holder name],
'account' =>[bank account number],
'routing'=>[bank account routing number]
]; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata); curl_setopt($ch, CURLOPT_HTTPHEADER,array("Authorization: Bearer ".$token )); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); try{ $output = curl_exec($ch); } catch(\Exception $e) { throw $e; } curl_close($ch);

Check test data

Routing Account Amount Response Reason
987654321 Any Any Error Invalid Routing Number
Any Any 5.99 Decline Returned check for this account
Any Any 9999.99 ManagerApproval
Note: Any other combination of 9 digit routing number and account number will return an approval

 

Sample run an Auth Only transaction

(this can only be done with a valid PaidYET credit card token. Can be obtained from the card on file API call)

  
  $ch = curl_init();
  $url =  "https://api.paidyet.com/v2/runauth";
  $postdata = ['amount'=>[AMOUNT],'email'=>[email], 'token'=>[credit card token]];
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
  curl_setopt($ch, CURLOPT_HTTPHEADER,array("Authorization: Bearer ".$token  ));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  try{
    $output = curl_exec($ch);
  }
  catch(\Exception $e) {
    throw $e;
  }
  curl_close($ch);

 

Sample capture an authorized transaction

(refnum obtained from auth only API call)

  
  $ch = curl_init();
  $url =  "https://api.paidyet.com/v2/capture";
  $postdata = ['refnum'=>[refnum]];
  curl_setopt($ch, CURLOPT_URL, $url);
  curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
  curl_setopt($ch, CURLOPT_HTTPHEADER,array("Authorization: Bearer ".$token  ));
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  try{
    $output = curl_exec($ch);
  }
  catch(\Exception $e) {
    throw $e;
  }
  curl_close($ch);

 

Sample to void a transaction

  
    $ch = curl_init();
	$url =  "https://api.paidyet.com/v2/transaction/[TRN ID]";
	$postdata = ['action'=>'void'];
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
	$headerarray[] = "Authorization: Bearer ".$token;
	curl_setopt($ch, CURLOPT_HTTPHEADER,$headerarray);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	try{
		$output = curl_exec($ch);
	}
	catch(\Exception $e) {
		throw $e;
	}
	curl_close($ch);

 

Sample to refund a transaction

  
    $ch = curl_init();
	$url =  "https://api.paidyet.com/v2/transaction/[TRN ID]";
	$postdata = ['action'=>'refund', 'amount'=>[AMOUNT]];
	curl_setopt($ch, CURLOPT_POST, true);
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_POSTFIELDS,$postdata);
	$headerarray[] = "Authorization: Bearer ".$token;
	curl_setopt($ch, CURLOPT_HTTPHEADER,$headerarray);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	try{
		$output = curl_exec($ch);
	}
	catch(\Exception $e) {
		throw $e;
	}
	curl_close($ch);