本文整理汇总了PHP中Paypal::expressCheckout方法的典型用法代码示例。如果您正苦于以下问题:PHP Paypal::expressCheckout方法的具体用法?PHP Paypal::expressCheckout怎么用?PHP Paypal::expressCheckout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paypal
的用法示例。
在下文中一共展示了Paypal::expressCheckout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PayPaypal
public function PayPaypal()
{
if (!isset($this->data['type'])) {
$this->msg = Yii::t("default", "Payment type is required");
return;
}
$package_id = isset($this->data['package_id']) ? $this->data['package_id'] : '';
if ($this->data['type'] == "purchaseSMScredit") {
$paypal_con = Yii::app()->functions->getPaypalConnectionAdmin();
$paypal = new Paypal($paypal_con);
if ($res_paypal = $paypal->getExpressDetail()) {
$paypal->params['PAYERID'] = $res_paypal['PAYERID'];
$paypal->params['AMT'] = $res_paypal['AMT'];
$paypal->params['TOKEN'] = $res_paypal['TOKEN'];
$paypal->params['CURRENCYCODE'] = $res_paypal['CURRENCYCODE'];
if ($res = $paypal->expressCheckout()) {
$info = Yii::app()->functions->getSMSPackagesById($package_id);
$payment_code = Yii::app()->functions->paymentCode("paypal");
$params = array('merchant_id' => Yii::app()->functions->getMerchantID(), 'sms_package_id' => $package_id, 'payment_type' => $payment_code, 'package_price' => $res_paypal['AMT'], 'sms_limit' => $info['sms_limit'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'payment_gateway_response' => json_encode($res), 'status' => "paid");
if ($this->insertData("{{sms_package_trans}}", $params)) {
$this->details = Yii::app()->request->baseUrl . "/merchant/smsReceipt/id/" . Yii::app()->db->getLastInsertID();
$this->code = 1;
$this->msg = Yii::t("default", "Successful");
} else {
$this->msg = Yii::t("default", "ERROR: Cannot insert record.");
}
} else {
$this->msg = $paypal->getError();
}
} else {
$this->msg = $paypal->getError();
}
}
/*end purchaseSMS*/
}
示例2: paymentPaypalVerification
public function paymentPaypalVerification()
{
$raw = base64_decode(isset($this->data['raw']) ? $this->data['raw'] : '');
parse_str($raw, $raw_decode);
$price = '';
$description = '';
if (is_array($raw_decode) && count($raw_decode) >= 1) {
$price = isset($raw_decode['price']) ? $raw_decode['price'] : '';
$description = isset($raw_decode['description']) ? $raw_decode['description'] : '';
}
$paypal_con = Yii::app()->functions->getPaypalConnectionAdmin();
$paypal = new Paypal($paypal_con);
if ($res_paypal = $paypal->getExpressDetail()) {
$paypal->params['PAYERID'] = $res_paypal['PAYERID'];
$paypal->params['AMT'] = $res_paypal['AMT'];
$paypal->params['TOKEN'] = $res_paypal['TOKEN'];
$paypal->params['CURRENCYCODE'] = $res_paypal['CURRENCYCODE'];
if ($res = $paypal->expressCheckout()) {
/*now insert transaction logs*/
if ($this->data['purchase'] == "fax_package") {
$payment_code = Yii::app()->functions->paymentCode("paypal");
$FunctionsK = new FunctionsK();
$info = $FunctionsK->getFaxPackagesById($this->data['package_id']);
$params = array('merchant_id' => Yii::app()->functions->getMerchantID(), 'fax_package_id' => $this->data['package_id'], 'payment_type' => $payment_code, 'package_price' => $price, 'fax_limit' => $info['fax_limit'], 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'payment_gateway_response' => json_encode($res), 'status' => "paid");
if ($this->insertData("{{fax_package_trans}}", $params)) {
$this->details = websiteUrl() . "/merchant/faxreceipt/id/" . Yii::app()->db->getLastInsertID();
$this->code = 1;
$this->msg = Yii::t("default", "Successful");
$merchantinfo = Yii::app()->functions->getMerchantInfo();
$FunctionsK = new FunctionsK();
$FunctionsK->faxSendNotification((array) $merchantinfo[0], $this->data['package_id'], $payment_code, $price);
} else {
$this->msg = Yii::t("default", "ERROR: Cannot insert record.");
}
} else {
$this->msg = t("Uknown transaction");
}
} else {
$this->msg = $paypal->getError();
}
} else {
$this->msg = $paypal->getError();
}
}