Skip to content
Permalink
Browse files

Fixed transaction and error output (#119)

  • Loading branch information...
bwisem authored and StephenJosey committed Jan 28, 2019
1 parent da72c5a commit 9221a467dd7c022547b9a06e0f58f6698c963c26
@@ -31,16 +31,15 @@ router.post('/process-payment', function(req,res,next){
idempotency_key: idempotency_key
};
transactions_api.charge(config.squareLocationId, request_body).then(function(data) {
console.log(util.inspect(data, false, null));
var json= JSON.stringify(data);
res.render('process-payment', {
'title': 'Payment Successful',
'result': "Payment Successful (see console for transaction output)"
'result': json
});
}, function(error) {
console.log(util.inspect(error.status, false, null));
res.render('process-payment', {
'title': 'Payment Failure',
'result': "Payment Failed (see console for error output)"
'result': error.response.text
});
});

@@ -1,6 +1,6 @@
{
"require": {
"square/connect": "^2.20",
"vlucas/phpdotenv": "*"
"vlucas/phpdotenv": "^3.1"
}
}
@@ -1,7 +1,7 @@
<?php
require 'vendor/autoload.php';
// dotenv is used to read from the '.env' file created for credentials
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv = Dotenv\Dotenv::create(__DIR__);
$dotenv->load();
?>
<html>
@@ -5,7 +5,7 @@
require 'vendor/autoload.php';
// dotenv is used to read from the '.env' file created for credentials
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv = Dotenv\Dotenv::create(__DIR__);
$dotenv->load();
# Replace these values. You probably want to start with your Sandbox credentials

0 comments on commit 9221a46

Please sign in to comment.
You can’t perform that action at this time.