Last active
December 15, 2015 10:48
-
-
Save spaomalley/5247898 to your computer and use it in GitHub Desktop.
Simple payment example that uses the 'echo' feature to return the created resource data.
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