Created
November 26, 2013 17:57
-
-
Save spaomalley/7662914 to your computer and use it in GitHub Desktop.
Basic payment example using PHP
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" => '', | |
"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