Skip to content

Instantly share code, notes, and snippets.

@spaomalley
Created November 26, 2013 17:57
Show Gist options
  • Save spaomalley/7662914 to your computer and use it in GitHub Desktop.
Save spaomalley/7662914 to your computer and use it in GitHub Desktop.
Basic payment example using PHP
<?php
require 'ConfigFactory.php';
require 'OAuthRequest.php';
$c = new Creds();
$creds = $c->creds();
$links = $c->links();
$accessTokenData = getAccessToken($links, $creds);
$info = array(
"merchantId" => $c->merchantId(),
"tenderType" => "Card",
"amount" => '',
"cardAccount" => array(
"number" => '',
"expiryMonth" => '',
"expiryYear" => '',
"CVV" => '',
"avZip" => ''
)
);
/*
* Without including the echo=true query parameter, you're returned the Id of the payment in the Location Header
* Including it, it is returned with the response. Uncomment the below associative array to see affect on response.
*/
// $queryParams=array(
// "echo"=>"true"
// );
$postPayment = new OAuthRequest($links['payment'],$creds, $accessTokenData, $queryParams);
$postPayment->createHeader($info);
echo $postPayment->sendRequest($info);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment