Skip to content

Instantly share code, notes, and snippets.

@erikhansen
Forked from mttjohnson/braintree_settlement.sh
Created November 29, 2016 23:29
Show Gist options
  • Save erikhansen/c21643dae8ea283464b6d8d64d9af1d4 to your computer and use it in GitHub Desktop.
Save erikhansen/c21643dae8ea283464b6d8d64d9af1d4 to your computer and use it in GitHub Desktop.
Braintree manual transaction settlement
# Setup local directory with braintree example and libraries
git clone git@github.com:braintree/braintree_php_example.git
cd braintree_php_example
composer install
# Create and define configuration options
echo '
BT_ENVIRONMENT=sandbox
BT_MERCHANT_ID=xxxxxxxxxxxx
BT_PUBLIC_KEY=xxxxxxxxxxxx
BT_PRIVATE_KEY=xxxxxxxxxxxx
' > .env
# Create the testing script for settling transactions
mkdir -p utility
cd utility
echo '<?php
require_once("../includes/braintree_init.php");
$transactionId = $argv[1];
echo "sending request to settle (" . $transactionId . ")";
$transaction = Braintree_Test_Transaction::settle($transactionId);
echo print_r($transaction);
' > settle.php
# run the example code to settle a transaction manually from the command line
php settle.php xxxxxxxxxxxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment