PayPal确认了哪种付款方式?

3

更新 2:

我目前拥有的代码如下:

paypalplatform.php:

https://www.paypal-labs.com/integrationwizard/adaptive/code2.php

basic_payment.php:(以下链接中第4b个脚本)

https://www.paypal-labs.com/integrationwizard/adaptive/paymenttypes.php

ipn.php:(IPN监听器)

https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNImplementation

如果上面第二个链接中的框为空,请单击“重新开始”并点击下一步,直到您到达第4步,或单击此处:https://www.paypal-labs.com/integrationwizard/adaptive/main.php

更新 1:

我认为这是启动付款的代码,我需要在这里指定一个自定义值吗?如果需要,怎么做?

<?php
//-------------------------------------------------
// When you integrate this code
// look for TODO as an indication
// that you may need to provide a value or take action
// before executing this code
//-------------------------------------------------

require_once ("paypalplatform.php");


// ==================================
// PayPal Platform Basic Payment Module
// ==================================

// Request specific required fields         
$actionType         = "PAY";
$cancelUrl          = "some url here";  // TODO - If you are not executing the Pay call for a preapproval,
                                //        then you must set a valid cancelUrl for the web approval flow
                                //        that immediately follows this Pay call
$returnUrl          = "some url here";  // TODO - If you are not executing the Pay call for a preapproval,
                                //        then you must set a valid returnUrl for the web approval flow
                                //        that immediately follows this Pay call
$currencyCode           = "USD";

// A basic payment has 1 receiver
// TODO - specify the receiver email
$receiverEmailArray     = array(
                    'receivers email here'
                );

// TODO - specify the receiver amount as the amount of money, for example, '5' or '5.55'
$receiverAmountArray        = array(
                    'receivers amount here'
                );

// for basic payment, no primary indicators are needed, so set empty array
$receiverPrimaryArray       = array();

// TODO - Set invoiceId to uniquely identify the transaction associated with the receiver
//        You can set this to the same value as trackingId if you wish
$receiverInvoiceIdArray     = array(
                    '1234abc'
                );

// Request specific optional or conditionally required fields
// Provide a value for each field that you want to include in the request, if left as an empty string the field will not be passed in the request
$senderEmail                = "";       // TODO - If you are executing the Pay call against a preapprovalKey, you should set senderEmail
                            //        It is not required if the web approval flow immediately follows this Pay call
$feesPayer              = "";
$ipnNotificationUrl         = "some url here";
$memo                   = "";       // maxlength is 1000 characters
$pin                    = "";       // TODO - If you are executing the Pay call against an existing preapproval
                            //        the requires a pin, then you must set this
$preapprovalKey             = "";       // TODO - If you are executing the Pay call against an existing preapproval, set the preapprovalKey here
$reverseAllParallelPaymentsOnError  = "";       // Do not specify for basic payment
$trackingId                     = generateTrackingID(); // generateTrackingID function is found in paypalplatform.php

//-------------------------------------------------
// Make the Pay API call
//
// The CallPay function is defined in the paypalplatform.php file,
// which is included at the top of this file.
//-------------------------------------------------
$resArray = CallPay ($actionType, $cancelUrl, $returnUrl, $currencyCode, $receiverEmailArray,
                        $receiverAmountArray, $receiverPrimaryArray, $receiverInvoiceIdArray,
                        $feesPayer, $ipnNotificationUrl, $memo, $pin, $preapprovalKey,
                        $reverseAllParallelPaymentsOnError, $senderEmail, $trackingId
);

$ack = strtoupper($resArray["responseEnvelope.ack"]);
if($ack=="SUCCESS")
{
    if ("" == $preapprovalKey)
    {
        // redirect for web approval flow
        $cmd = "cmd=_ap-payment&paykey=" . urldecode($resArray["payKey"]);
        RedirectToPayPal ( $cmd );
    }
    else
    {
        // payKey is the key that you can use to identify the payment resulting from the Pay call
        $payKey = urldecode($resArray["payKey"]);
        // paymentExecStatus is the status of the payment
        $paymentExecStatus = urldecode($resArray["paymentExecStatus"]);
    }
} 
else  
{
    //Display a user friendly Error on the page using any of the following error information returned by PayPal
    //TODO - There can be more than 1 error, so check for "error(1).errorId", then "error(2).errorId", and so on until you find no more errors.
    $ErrorCode = urldecode($resArray["error(0).errorId"]);
    $ErrorMsg = urldecode($resArray["error(0).message"]);
    $ErrorDomain = urldecode($resArray["error(0).domain"]);
    $ErrorSeverity = urldecode($resArray["error(0).severity"]);
    $ErrorCategory = urldecode($resArray["error(0).category"]);

    echo "Preapproval API call failed. ";
    echo "Detailed Error Message: " . $ErrorMsg;
    echo "Error Code: " . $ErrorCode;
    echo "Error Severity: " . $ErrorSeverity;
    echo "Error Domain: " . $ErrorDomain;
    echo "Error Category: " . $ErrorCategory;
}

?>

原始问题:

我有一些来自Paypal的脚本,允许用户从我的网站进行付款。

在第一步中,当他们使用基本付款脚本发送付款时,我会收到以下值:

Array ( 
[responseEnvelope.timestamp] => 2011-04-08T01:34:03.578-07:00 
[responseEnvelope.ack] => Success 
[responseEnvelope.correlationId] => a2de97aaf57f0 
[responseEnvelope.build] => 1822511 
[payKey] => AP-8AW04791DK417062F 
[paymentExecStatus] => CREATED ) 

当通过Paypal的IPN系统确认付款后,我会收到以下返回值:

test_ipn = 1
payment_type = instant
payment_date = 01:11:38 Apr 08, 2011 PDT
payment_status = Completed
address_status = confirmed
payer_status = verified
first_name = John
last_name = Smith
payer_email = buyer@paypalsandbox.com
payer_id = TESTBUYERID01
address_name = John Smith
address_country = United States
address_country_code = US
address_zip = 95131
address_state = CA
address_city = San Jose
address_street = 123, any street
business = seller@paypalsandbox.com
receiver_email = seller@paypalsandbox.com
receiver_id = TESTSELLERID1
residence_country = US
item_name = something
item_number = AK-1234
quantity = 1
shipping = 3.04
tax = 2.02
mc_currency = USD
mc_fee = 0.44
mc_gross = 12.34
mc_gross_1 = 9.34
txn_type = web_accept
txn_id = 3848811
notify_version = 2.1
custom = xyz123
charset = windows-1252
verify_sign = AWPjjtnKgiQkL5dH.EojlIO6uUy9AijwJCRexi2IglsAajCxoIkbVEq-

我无法看到任何值,让我能够建立连接,从而更新正确的数据库记录,以表明付款已成功完成。


在这个调用中,Paypal返回给我“内部服务器错误。请检查服务器日志以获取详细信息”的错误。我不知道问题出在哪里。我已经检查了服务器日志,但是没有找到关于这个错误的任何信息。有什么建议吗? - gautamlakum
1个回答

1

txn_id = 3848811 是来自Paypal的交易ID。如果您希望Paypal返回对您系统中某个标识符(例如您的付款标识符)的引用,您可以使用“custom”字段,该字段将在您最初的请求中发送。

如果您使用NVP,则应为PAYMENTREQUEST_n_CUSTOM,不清楚SOAP接口的情况。


你会重定向客户,对吗?交易 ID 只有在客户完成付款时才会生成,这意味着你只能在返回请求(即成功 URL)或通过 IPN 中捕获它。因此,你应该发送一个自定义字段来识别购物车与实际付款的关系。 - jishi
是的,这将以某种方式放在CallPay()函数中,您需要检查文档。 - jishi
我没有设置那个,我使用沙盒中的IPN模拟器生成了那个IPN通知,它连接到我的ipn.php文件,从中检查了所有发布的值,其中一个是custom = xyz123的值。不知道如何实际设置该值,以便IPN可以将其返回。从上面的基本模块中,我能够链接到最接近的东西是invoiceid吗? - oshirowanen
很抱歉,如果不知道paypalplatform.php的作用,就无法确定。他们有两个主要的API,NVP和SOAP,而你使用的文件必须基于其中之一。你应该考虑使用他们真正的SDK,而不是那个示例文件。https://www.x.com/community/ppx/sdks - jishi
如果您无法触发真实的IPN,则无法知道返回了什么。根据文档; trackingIdxs:string(可选)您指定以跟踪付款的唯一ID。 注意:您负责确保ID是唯一的。 - jishi
显示剩余5条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接