Last active
December 12, 2015 12:28
-
-
Save spaomalley/4771765 to your computer and use it in GitHub Desktop.
Simple Payment Example in PHP (with echo option)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" => '', | |
"avsZip" => '' | |
) | |
); | |
/* | |
* 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
excellent job, grasshoppah...