Created
May 28, 2015 16:16
-
-
Save bradberger/9d0d2873ba39236b301e to your computer and use it in GitHub Desktop.
Capture Invoice Payment Gist
This file contains 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
// Make sure user has card on file. | |
if (empty($user['cclastfour'])) { | |
$config['vars']['nocard'] = true; | |
$config['vars']['error'] = 'You do not have any payment methods on file'; | |
return $config; | |
} | |
$payment = localAPI('capturepayment', ['invoiceid' => $invoice_id], 'admin'); | |
if ($payment['result'] === 'success') { | |
$config['vars']['payment']['success'] = sprintf('Payment succeeded'); | |
} else { | |
$config['vars']['payment']['error'] = sprintf('Payment failed: %s', $payment['message']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment