简体   繁体   English

并行贝宝付款不起作用

[英]Parallel paypal Payment Not Working

I am working in project In that I need to integrate Adaptive payment gateway. 我在项目中工作,因为我需要集成自适应支付网关。 I referred code from here , it looks simple and easy but once I downloaded and run the code its not working 我从这里引用代码,它看起来很简单,但是一旦我下载并运行代码,它就无法正常工作

The problem I found is.. In the process page the variable $ack is returning failure 我发现的问题是..在进程页面中,变量$ack返回失败

How can I resolve this problem 我该如何解决这个问题

Here is the sample code 这是示例代码

Process.php Process.php

<?php
    session_start();
    require_once('../PPBootStrap.php');
    require_once('../Common/Constants.php');
    define("DEFAULT_SELECT", "- Select -");
    $returnUrl = "http://www.formget.com/tutorial/paypal-adaptive-    payment/parallel/success.php";
    $cancelUrl = "http://www.formget.com/tutorial/paypal-adaptive-    payment/parallel/index.php";
    $memo = "Adaptive Payment";
    $actionType = "PAY";
    $currencyCode = "USD";

    if ($_POST['booking'] == 'f') {
        $receiverEmail = array("airline@outlook.com");
        $receiverAmount = array("300.00");
        $primaryReceiver = array("false");
        $_SESSION['facilty_provider'] = array("AirGo Airline's Test Store");
    } elseif ($_POST['booking'] == 'h') {
        $receiverEmail = array("hotel@outlook.com");
        $receiverAmount = array("200.00");
        $primaryReceiver = array("false");
        $_SESSION['facilty_provider'] = array("Hotel TheCompany's Test Store");
    } elseif ($_POST['booking'] == 'c') {
        $receiverEmail = array("car-merchants@outlook.com");
        $receiverAmount = array("100.00");
        $primaryReceiver = array("false");
        $_SESSION['facilty_provider'] = array("MyCar Car Company's Test Store");
    } elseif ($_POST['booking'] == 'fh') {
        $receiverEmail = array("airline@outlook.com", "hotel@outlook.com");
        $receiverAmount = array("300.00", "200.00");
        $primaryReceiver = array("false", "false");
        $_SESSION['facilty_provider'] = array("AirGo Airline's Test Store", "Hotel     TheCompany's Test Store");
    } elseif ($_POST['booking'] == 'fc') {
        $receiverEmail = array("airline@outlook.com", "car-merchants@outlook.com");
        $receiverAmount = array("300.00", "100.00");
        $primaryReceiver = array("false", "false");
        $_SESSION['facilty_provider'] = array("AirGo Airline's Test Store", "MyCar     Car Company's Test Store");
    } elseif ($_POST['booking'] == 'hc') {
        $receiverEmail = array("hotel@outlook.com", "car-merchants@outlook.com");
        $receiverAmount = array("200.00", "100.00");
        $primaryReceiver = array("false", "false");
        $_SESSION['facilty_provider'] = array("Hotel TheCompany's Test Store",     "MyCar Car Company's Test Store");
    } elseif ($_POST['booking'] == 'fhc') {
        $receiverEmail = array("airline@outlook.com", "hotel@outlook.com", "car-merchants@outlook.com");
        $receiverAmount = array("295.00", "195.00", "95.00");
        $primaryReceiver = array("false", "false", "false");
        $_SESSION['facilty_provider'] = array("AirGo Airline's Test Store", "Hotel     TheCompany's Test Store", "MyCar Car Company's Test Store");
    } else {
        $receiverEmail = array("airline@outlook.com");
        $receiverAmount = array("300.00");
        $primaryReceiver = array("false");
        $_SESSION['facilty_provider'] = array("AirGo Airline's Test Store");
    }
    if (isset($receiverEmail)) {
        $receiver = array();
        /*
         * A receiver's email address
        */
        for ($i = 0; $i < count($receiverEmail); $i++) {
        $receiver[$i] = new Receiver();
        $receiver[$i]->email = $receiverEmail[$i];
        /*
        * Amount to be credited to the receiver's account
        */
        $receiver[$i]->amount = $receiverAmount[$i];
        /*
        * Set to true to indicate a chained payment; only one receiver can be a     primary receiver. Omit this field, or set it to false for simple and parallel     payments.
        */
        $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;
}
/*
* ## Creating service wrapper object
Creating service wrapper object to make API call and loading
Configuration::getAcctAndConfig() returns array that contains credential and     config parameters
*/


$service = new AdaptivePaymentsService(Configuration::getAcctAndConfig());
try {
    /* wrap API method calls on the service object with a try catch */
    $response = $service->Pay($payRequest);
    echo $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;
}

I have found the problems here, the issue was in you configuration file. 我在这里找到了问题,问题出在您的配置文件中。 There is a variable of acct1.AppId. 有一个acct1.AppId变量。 By default, the creator of this sample code has comment it so you are sending a request without including the App ID. 默认情况下,此示例代码的创建者对其进行了注释,因此您在发送请求时未包含App ID。 To solve this, you should uncomment it. 要解决此问题,您应该取消注释。 Try to run again after that. 然后尝试再次运行。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM