$p['password'] = $modx->getOption('subscribeme.paypal.api_password'); $p['signature'] = $modx->getOption('subscribeme.paypal.api_signature'); } else { /* We're using the sandbox */ $paypal = new phpPayPal(true); $p['username'] = $modx->getOption('subscribeme.paypal.sandbox_username'); $p['password'] = $modx->getOption('subscribeme.paypal.sandbox_password'); $p['signature'] = $modx->getOption('subscribeme.paypal.sandbox_signature'); } $paypal->API_USERNAME = $p['username']; $paypal->API_PASSWORD = $p['password']; $paypal->API_SIGNATURE = $p['signature']; $paypal->profile_id = $ppid; $paypal->version = '57.0'; //$modx->log(MODX_LEVEL_ERROR,$paypal->generateNVPString('GetRecurringPaymentsProfileDetails')); $paypal->get_recurring_payments_profile_details(); //return $modx->error->failure(print_r($paypal->Response,true)); if (strtolower($paypal->Response['STATUS']) != 'active' || strtolower($paypal->Response['STATUS']) != 'active') { return $modx->error->failure($modx->lexicon('sm.error.cancelsubscription.notactive', array('status' => $paypal->Response['STATUS']))); } $paypal->profile_id = $ppid; $paypal->version = '57.0'; $paypal->action = 'Cancel'; $paypal->note = $modx->lexicon('sm.notification.admincancelledsubscription'); //$modx->log(MODX_LEVEL_ERROR,$paypal->generateNVPString('ManageRecurringPaymentsProfileStatus')); $paypal->manage_recurring_payments_profile_status(); //return $modx->error->failure(print_r($paypal->Response,true)); if (strtolower($paypal->Response['ACK']) == 'success') { $sub->set('active', false); if (!$sub->save()) { return $modx->error->failure($modx->lexicon('sm.error.sendmailfailed'));