Example #1
0
/**
 * Trigger preapproved payment charge
 *
 * @since 1.6
 * @return void
 */
function edds_process_preapproved_charge()
{
    if (empty($_GET['nonce'])) {
        return;
    }
    if (!wp_verify_nonce($_GET['nonce'], 'edds-process-preapproval')) {
        return;
    }
    $payment_id = absint($_GET['payment_id']);
    $charge = edds_charge_preapproved($payment_id);
    if ($charge) {
        wp_redirect(add_query_arg(array('edd-message' => 'preapproval-charged'), admin_url('edit.php?post_type=download&page=edd-payment-history')));
        exit;
    } else {
        wp_redirect(add_query_arg(array('edd-message' => 'preapproval-failed'), admin_url('edit.php?post_type=download&page=edd-payment-history')));
        exit;
    }
}
/**
 * Process preapproved payments
 *
 * @since Astoundify Crowdfunding 1.1
 *
 * @return void
 */
function atcf_collect_funds_stripe($charged, $payment, $campaign)
{
    return edds_charge_preapproved($payment);
}