管理panal中的点击“付款”按钮从公司的paypal帐户到使用PHP中的自适应付款的客户的付款帐户付款

时间:2017-10-12 05:25:00

标签: php paypal paypal-sandbox paypal-adaptive-payments

我想通过管理panal从公司的paypal帐户点击“付款”按钮转账/付款到使用PHP中的自适应付款的客户的付款帐户。

我为此尝试了很多,但每次都失败了。请帮忙..

我也遵循这个

How to transfer money from one PayPal account to another PayPal account?

注意: - 我在localhost上运行并使用付费沙盒帐户

我目前使用下面的代码并使用sdk adaptivepayments-sdk-php

我的configration.php文件是

<?php

class Configuration {

    public static function getConfig() {
        $config = array(
            "mode" => "sandbox"
        );
        return $config;
    }

    public static function getAcctAndConfig() {
        $config = array(
            // Signature Credential
            "acct1.UserName" => "*************.************.com",
            "acct1.Password" => "**********************",
            "acct1.Signature" => "***************************************",
            "acct1.AppId" => "APP-**********************"
        );

        return array_merge($config, self::getConfig());
        ;
    }
}

我的process.php文件的cose是

<?php

session_start();
require_once('../PPBootStrap.php');
require_once('../Common/Constants.php');
define("DEFAULT_SELECT", "- Select -");
$returnUrl = "http://localhost/paypal/adaptive/parallel/success.php";
$cancelUrl = "http://localhost/paypal/adaptive/parallel/index.php";
$memo = "Adaptive Payment";
$actionType = "PAY";
$currencyCode = "USD";
$senderEmail ="info@birddog.com";

$receiverEmail = array("manojrana@gmail.com");
$receiverAmount = array("300.00");
$primaryReceiver = array("false");
$_SESSION['facilty_provider'] = array("AirGo Airline's Test Store");

if (isset($receiverEmail)) {
    $receiver = array();
    for ($i = 0; $i < count($receiverEmail); $i++) {
        $receiver[$i] = new Receiver();

        $receiver[$i]->email = $receiverEmail[$i];

        $receiver[$i]->amount = $receiverAmount[$i];
        $receiver[$i]->primary = $primaryReceiver[$i];
    }
    $receiverList = new ReceiverList($receiver);
}

$payRequest = new PayRequest(new RequestEnvelope("en_US"), $actionType, $cancelUrl, $currencyCode, $receiverList, $returnUrl);
// Add optional params

if ($memo != "") {
    $payRequest->memo = $memo;
}


$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());

try {
    **$response = $service->Pay($payRequest);**
    $ack = strtoupper($response->responseEnvelope->ack);
    if ($ack == "SUCCESS") {
        $_SESSION['pay_key'] = $payKey = $response->payKey;
        $payKey = $response->payKey;
        $payPalURL = PAYPAL_REDIRECT_URL . '_ap-payment&paykey=' . $payKey;
        header('Location: ' . $payPalURL);
    }
} catch (Exception $ex) {
    require_once '../Common/Error.php';
    exit;
}

我输出了空白屏幕,因为当我尝试打印时,$response = $service->Pay($payRequest);返回如下

PayResponse Object
(
    [responseEnvelope] => ResponseEnvelope Object
        (
            [timestamp] => 2017-10-11T22:20:35.114-07:00
            [ack] => Failure
            [correlationId] => aebfb26213bbe
            [build] => 39000598
        )

    [payKey] => 
    [paymentExecStatus] => 
    [payErrorList] => 
    [paymentInfoList] => 
    [sender] => 
    [defaultFundingPlan] => 
    [warningDataList] => 
    [error] => Array
        (
            [0] => ErrorData Object
                (
                    [errorId] => 520003
                    [domain] => PLATFORM
                    [subdomain] => Application
                    [severity] => Error
                    [category] => Application
                    [message] => Authentication failed. API credentials are incorrect.
                    [exceptionId] => 
                    [parameter] => 
                )

        )

)

请帮帮我

0 个答案:

没有答案