* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require_once './class/paypal.php'; //when needed require_once './class/httprequest.php'; //when needed //Use this form for production server //$r = new PayPal(true); //Use this form for sandbox tests $r = new PayPal(); $final = $r->doPayment(); if ($final['ACK'] == 'Success') { echo 'Succeed!'; print_r($r->getCheckoutDetails($final['TOKEN'])); /* Details example: Array ( [TOKEN] => EC-46K253307T956310E [TIMESTAMP] => 2010-12-12T09:38:01Z [CORRELATIONID] => cbf9ed77f3dbe [ACK] => Success [VERSION] => 52.0 [BUILD] => 1613703 [EMAIL] => buyer1_1292145548_per@maly.cz [PAYERID] => ZMU92MM4SPBHS [PAYERSTATUS] => verified [FIRSTNAME] => Test [LASTNAME] => User [COUNTRYCODE] => US
<?php require_once './paypal/paypal.php'; require_once './paypal/httprequest.php'; //Load PHPMailer Class require_once 'phpmailer/class.phpmailer.php'; //Use this form for production server $r = new PayPal(true); //Use this form for sandbox tests // $r = new PayPal(); $final = $r->doPayment(); if ($final['ACK'] == 'Success') { $payment = $r->getCheckoutDetails($final['TOKEN']); //If payment from PayPal is successful, send out our thankyou email $first_name = $payment['FIRSTNAME']; $last_name = $payment['LASTNAME']; $name = $first_name . ' ' . $last_name; $email = $payment['EMAIL']; $amount = $payment['CUSTOM']; $amount = explode("|", $amount, 2); $amount = $amount[0]; $date = $payment['TIMESTAMP']; $date = strtotime($date); // Build and send the email *using PHPMailer $mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPDebug = 0; $mail->SMTPAuth = true; $mail->Host = $mailConfig['host']; $mail->Port = 587; $mail->Username = $mailConfig['user'];
} } // end of the loop. ?> <?php include_once get_template_directory() . '/inc/paypal/class/paypal.php'; include_once get_template_directory() . '/inc/paypal/class/httprequest.php'; //Use this form for production server $r = new PayPal(true); //Use this form for sandbox tests //$r = new PayPal(); $final = $r->doPayment(); if ($final['ACK'] == 'Success') { //echo 'Succeed!'; $oToken = $r->getCheckoutDetails($final['TOKEN']); $txnID = $oToken['TOKEN']; $firstName = $oToken['FIRSTNAME']; $lastName = $oToken['LASTNAME']; $addressCountry = $oToken['COUNTRYCODE']; $payerEmail = $oToken['EMAIL']; $bani = explode("|", $oToken['CUSTOM']); $payment_gross = $bani[0]; $valuta = $bani[1]; $donCause = $bani[2]; $my_post = array('post_title' => $txnID, 'post_status' => 'publish', 'post_author' => 1, 'comment_status' => 'closed', 'ping_status' => 'closed', 'post_type' => 'post_pledges'); $post_id = wp_insert_post($my_post); add_post_meta($post_id, "wpl_pledge_cause", $donCause); add_post_meta($post_id, "wpl_pledge_transaction_id", $txnID); add_post_meta($post_id, "wpl_pledge_first_name", $firstName); add_post_meta($post_id, "wpl_pledge_last_name", $lastName);