贝宝订阅

时间:2012-01-31 06:48:47

标签: php paypal-subscriptions

在我的网站中,我想整合一种paypal订阅方法,我希望每天,每周或每月将特定金额从用户的paypal帐户转移到管理员的PayPal帐户,具体取决于选择。为此,我使用以下代码:

$obj=new paypal_recurring;

$obj->environment = 'sandbox';  // or 'beta-sandbox' or 'live'
$obj->paymentType = urlencode('Authorization');             // or 'Sale' or 'Order'

// Set request-specific fields.
$obj->startDate = urlencode("2011-9-6T0:0:0");
$obj->billingPeriod = urlencode("Month");               // or "Day", "Week", "SemiMonth", "Year"
$obj->billingFreq = urlencode("4");                     // combination of this and billingPeriod must be at most a year
$obj->paymentAmount = urlencode('10');
$obj->currencyID = urlencode('USD');                            // or other currency code ('GBP', 'EUR', 'JPY', 'CAD', 'AUD')

/* PAYPAL API  DETAILS */
$obj->API_UserName = urlencode('sdfsdfsdfbiz_api1.website.us');
$obj->API_Password = urlencode('543564353');
$obj->API_Signature = urlencode('sdfsdfsdf ');
$obj->API_Endpoint = "https://api-3t.paypal.com/nvp";

/*SET SUCCESS AND FAIL URL*/
$obj->returnURL = urlencode("http://www.mysite.com/index.php?task=getExpressCheckout");
$obj->cancelURL = urlencode('http://www.mysite.comindex.php?task=error');


$task="setExpressCheckout"; //set initial task as Express Checkout

switch($task)
{
    case "setExpressCheckout":
    $obj->setExpressCheckout();
    exit;
    case "getExpressCheckout":
    $obj->getExpressCheckout();
    exit;
    case "error":
    echo "setExpress checkout failed";
    exit;
}

但在此代码中,我如何添加管理员的paypal电子邮件ID,以便我可以将资金转移到该帐户?

1 个答案:

答案 0 :(得分:1)

您需要使用paypal创建一个帐户,注册API密钥,然后这笔钱将转到您的帐户。您无法将其转移到任意帐户。