调用 DoReferenceTransaction 方法给出错误 [英] call to DoReferenceTransaction method giving error

查看:95
本文介绍了调用 DoReferenceTransaction 方法给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 SetExpressCheckout 之后调用 CreateBillingAgreement,两者都成功了.BILLINGAGREEMENTID 由 CreateBillingAgreement 返回.

此 BILLINGAGREEMENTID 作为 REFERENCEID 传递给 DoReferenceTransaction.

NVP 构造为:

$nvpstr = '&TOKEN=' .$令牌.'&REFERENCEID=' .$billing_agreement_id .'&PAYMENTACTION=' .$paymentType .'&AMT=' .$FinalPaymentAmt;$nvpstr .= '&CURRENCYCODE=' .$currencyCodeType .'&IPADDRESS=' .$serverName .'&L_ITEMCATEGORY0=Digital'.'&DESC='.urlencode("Test Recurring Payment( $" . $_SESSION["Payment_Amount"] . "monthly)");$nvpstr.="&L_PAYMENTREQUEST_0_ITEMCATEGORY0=数字";$nvpstr.="&L_PAYMENTREQUEST_0_QTY0=数字";$nvpstr.="&L_PAYMENTREQUEST_0_NAME0=测试名称";$nvpstr.="&L_PAYMENTREQUEST_0_AMT0=".$_SESSION["Payment_Amount"];$nvpstr.="&L_NAME0=测试名称";$nvpstr.="&L_DESC0=".urlencode("Test Recurring Payment( $" . $_SESSION["Payment_Amount"] . " Monthly)");$nvpstr.="&L_AMT0=".$_SESSION["Payment_Amount"];$nvpstr.="&L_QTY0=1";

调用 DoReferenceTransaction 方法出错:

 数组([时间戳] =>2015-11-02T10:20:06Z[相关ID] =>3e60a1baba3b3[确认] =>失败[版本] =>64[构建] =>000000[L_ERRORCODE0] =>10209[L_ERRORCODE1] =>10004[L_SHORTMESSAGE0] =>已禁用[L_SHORTMESSAGE1] =>无效数据[L_LONGMESSAGE0] =>未启用预核准付款.[L_LONGMESSAGE1] =>无法处理此交易.[L_SEVERITYCODE0] =>错误[L_SEVERITYCODE1] =>错误[交易类型] =>没有任何[付款类型] =>没有任何[订单时间] =>1970-01-01T00:00:00Z[付款状态] =>没有任何[待定原因] =>没有任何[原因代码] =>没有任何)

注意:使用沙盒帐户进行测试.

更新:

function DoReferenceTransaction(){//格式化先前调用中存储在会话中的其他参数$token = urlencode($_SESSION['TOKEN']);$paymentType = urlencode($_SESSION['PaymentType']);$currencyCodeType = urlencode($_SESSION['currencyCodeType']);//$payerID = urlencode($_SESSION['payer_id']);$_SESSION['billing_agreement_id']$billing_agreement_id = urlencode($_SESSION['billing_agreement_id']);$FinalPaymentAmt = urlencode( $_SESSION["Payment_Amount"]);$serverName = urlencode($_SERVER['SERVER_NAME']);$nvpstr = '&TOKEN=' .$令牌.'&REFERENCEID=' .$billing_agreement_id .'&PAYMENTACTION=' .$paymentType .'&AMT=' .$FinalPaymentAmt;$nvpstr .= '&CURRENCYCODE=' .$currencyCodeType .'&IPADDRESS=' .$serverName .'&L_ITEMCATEGORY0=Digital'.'&DESC='.urlencode("Test Recurring Payment( $" . $_SESSION["Payment_Amount"] . "monthly)");$nvpstr.="&L_PAYMENTREQUEST_0_ITEMCATEGORY0=数字";$nvpstr.="&L_PAYMENTREQUEST_0_QTY0=数字";$nvpstr.="&L_PAYMENTREQUEST_0_NAME0=测试名称";$nvpstr.="&L_PAYMENTREQUEST_0_AMT0=".$_SESSION["Payment_Amount"];$nvpstr.="&L_NAME0=测试名称";$nvpstr.="&L_DESC0=".urlencode("Test Recurring Payment( $" . $_SESSION["Payment_Amount"] . " Monthly)");$nvpstr.="&L_AMT0=".$_SESSION["Payment_Amount"];$nvpstr.="&L_QTY0=1";/* 调用 PayPal 完成付款如果发生错误,显示产生的错误*/$resArray = hash_call("DoReferenceTransaction", $nvpstr);echo "

";打印_r($resArray);出口;/* 将 API 响应显示回浏览器.如果来自 PayPal 的响应成功,则显示响应参数'如果响应是错误,则使用 APIError.php 显示收到的错误.*/$ack = strtoupper($resArray["ACK"]);返回 $resArray;}

DoReferenceTransaction 的 NVP:

&TOKEN=EC-30M31870BS241854X&REFERENCEID=B-81S156104Y376273D&PAYMENTACTION=Sale&AMT=3&CURRENCYCODE=USD&CURRENCYCODE=USD&IPADDRingDess0&CURRENCYCODE=USD&IPADDRingDess0&;28+%243+monthly%29&L_PAYMENTREQUEST_0_ITEMCATEGORY0=数字&L_PAYMENTREQUEST_0_QTY0=数字&L_PAYMENTREQUEST_0_NAME0=测试名称&L_PAYMENTREQUEST_0_AMT0=3&L_PAYMENTREQUEST_0_AMT0=3&L_PAYMENTREQUEST_0_AMT0=3&L_PAYMENTREQUEST_0_AMT0=3&L_PAYMENTREQUEST_0_AMT0=3&L_PAYMENTREQUEST_0_AMT0=3&L_PAYMENTREQUEST_0_AMT0=3&L_PAYMENTREQUEST_0_AMT0=3&L_PAYMENTREQUEST_0_AMT0=3&L_PAYMENTREQUEST_0_AMT0=3&L_PAYMENTREQUEST_0_AMT0=3&L_CURING3&L_QTY0=1

解决方案

是实时 API 调用还是沙盒 API 调用?

您需要在您的 PayPal 帐户上激活 Reference Transaction 才能调用此 API.

并非所有人都可以使用参考交易 API.我建议您联系您的 PayPal 代表,让他们在您的 PayPal 帐户上激活此功能.

如果您在沙箱上执行此操作,您只需将您的沙箱帐户升级为专业帐户即可.这应该会激活沙盒帐户上的参考交易.

当然,您应该询问 PayPal 您的沙盒帐户是否启用了参考交易.

能否在您的问题中发送完整的 API 调用?

更新

我在你的代码中看到了一些奇怪的东西:

$nvpstr.="&L_PAYMENTREQUEST_0_ITEMCATEGORY0=数字";$nvpstr.="&L_PAYMENTREQUEST_0_QTY0=数字";

更改:

$nvpstr.="&L_PAYMENTREQUEST_0_ITEMCATEGORY0=物理";$nvpstr.="&L_PAYMENTREQUEST_0_QTY0=1";

更新 2

我在 API 调用中看到了一些错误:

&TOKEN=EC-30M31870BS241854X&REFERENCEID=B-81S156104Y376273D&PAYMENTACTION=销售&AMT=3&货币代码=美元&IPADDRESS=paypalrecurring.com&L_ITEMCATEGORY0=数字&DESC=测试+定期+付款%28+%243+每月%29&L_PAYMENTREQUEST_0_ITEMCATEGORY0=数字&L_PAYMENTREQUEST_0_QTY0=数字&L_PAYMENTREQUEST_0_NAME0=测试名称&L_PAYMENTREQUEST_0_AMT0=3&L_NAME0=测试名称&L_DESC0=测试+定期+付款%28+%243+每月%29&L_AMT0=3&L_QTY0=1string(606)

在 IP 地址变量中提供有效的 IP 地址.

替换

L_PAYMENTREQUEST_0_QTY0=数字&

作者:

L_PAYMENTREQUEST_0_QTY0=1&

最后一个参数有一个错误的参数替换:

L_QTY0=1string(606)

作者:

L_QTY0=1

最终将项目类别从数字更改为物理.我知道您需要特殊的权利才能使用 PayPal 制作数字商品.

L_ITEMCATEGORY0=物理&L_PAYMENTREQUEST_0_ITEMCATEGORY0=物理&

I am calling CreateBillingAgreement after SetExpressCheckout, both are successfull. BILLINGAGREEMENTID is returnd by CreateBillingAgreement.

This BILLINGAGREEMENTID is passed as REFERENCEID to DoReferenceTransaction.

NVP is constructed as :

$nvpstr = '&TOKEN=' . $token . '&REFERENCEID=' . $billing_agreement_id . '&PAYMENTACTION=' . $paymentType . '&AMT=' . $FinalPaymentAmt;
    $nvpstr .= '&CURRENCYCODE=' . $currencyCodeType . '&IPADDRESS=' . $serverName .'&L_ITEMCATEGORY0=Digital'.'&DESC='.urlencode("Test Recurring Payment( $" . $_SESSION["Payment_Amount"] . " monthly)");

    $nvpstr.="&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital";
    $nvpstr.="&L_PAYMENTREQUEST_0_QTY0=Digital";
    $nvpstr.="&L_PAYMENTREQUEST_0_NAME0=Test Name";
    $nvpstr.="&L_PAYMENTREQUEST_0_AMT0=".$_SESSION["Payment_Amount"];

    $nvpstr.="&L_NAME0=Test Name";
    $nvpstr.="&L_DESC0=".urlencode("Test Recurring Payment( $" . $_SESSION["Payment_Amount"] . " monthly)");
    $nvpstr.="&L_AMT0=".$_SESSION["Payment_Amount"];
    $nvpstr.="&L_QTY0=1";

call to DoReferenceTransaction method giving error:

  Array
(
    [TIMESTAMP] => 2015-11-02T10:20:06Z
    [CORRELATIONID] => 3e60a1baba3b3
    [ACK] => Failure
    [VERSION] => 64
    [BUILD] => 000000
    [L_ERRORCODE0] => 10209
    [L_ERRORCODE1] => 10004
    [L_SHORTMESSAGE0] => Disabled
    [L_SHORTMESSAGE1] => Invalid Data
    [L_LONGMESSAGE0] => Preapproved Payments not enabled.
    [L_LONGMESSAGE1] => This transaction cannot be processed.
    [L_SEVERITYCODE0] => Error
    [L_SEVERITYCODE1] => Error
    [TRANSACTIONTYPE] => None
    [PAYMENTTYPE] => None
    [ORDERTIME] => 1970-01-01T00:00:00Z
    [PAYMENTSTATUS] => None
    [PENDINGREASON] => None
    [REASONCODE] => None
)

Note: Using Sandbox account for testing.

UPDATE:

function DoReferenceTransaction(){

    //Format the other parameters that were stored in the session from the previous calls   
    $token = urlencode($_SESSION['TOKEN']);
    $paymentType = urlencode($_SESSION['PaymentType']);
    $currencyCodeType = urlencode($_SESSION['currencyCodeType']);
    //$payerID = urlencode($_SESSION['payer_id']);  $_SESSION['billing_agreement_id']
     $billing_agreement_id = urlencode($_SESSION['billing_agreement_id']);  

$FinalPaymentAmt = urlencode( $_SESSION["Payment_Amount"]);
    $serverName = urlencode($_SERVER['SERVER_NAME']);

    $nvpstr = '&TOKEN=' . $token . '&REFERENCEID=' . $billing_agreement_id . '&PAYMENTACTION=' . $paymentType . '&AMT=' . $FinalPaymentAmt;
    $nvpstr .= '&CURRENCYCODE=' . $currencyCodeType . '&IPADDRESS=' . $serverName .'&L_ITEMCATEGORY0=Digital'.'&DESC='.urlencode("Test Recurring Payment( $" . $_SESSION["Payment_Amount"] . " monthly)");

    $nvpstr.="&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital";
    $nvpstr.="&L_PAYMENTREQUEST_0_QTY0=Digital";
    $nvpstr.="&L_PAYMENTREQUEST_0_NAME0=Test Name";
    $nvpstr.="&L_PAYMENTREQUEST_0_AMT0=".$_SESSION["Payment_Amount"];

    $nvpstr.="&L_NAME0=Test Name";
    $nvpstr.="&L_DESC0=".urlencode("Test Recurring Payment( $" . $_SESSION["Payment_Amount"] . " monthly)");
    $nvpstr.="&L_AMT0=".$_SESSION["Payment_Amount"];
    $nvpstr.="&L_QTY0=1";



    /* Make the call to PayPal to finalize payment
      If an error occured, show the resulting errors
     */

        $resArray = hash_call("DoReferenceTransaction", $nvpstr);  
echo "<pre>";
   print_r($resArray); exit;

    /* Display the API response back to the browser.
      If the response from PayPal was a success, display the response parameters'
      If the response was an error, display the errors received using APIError.php.
     */
    $ack = strtoupper($resArray["ACK"]);

    return $resArray;
}

NVP for DoReferenceTransaction:

&TOKEN=EC-30M31870BS241854X&REFERENCEID=B-81S156104Y376273D&PAYMENTACTION=Sale&AMT=3&CURRENCYCODE=USD&IPADDRESS=paypalrecurring.com&L_ITEMCATEGORY0=Digital&DESC=Test+Recurring+Payment%28+%243+monthly%29&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital&L_PAYMENTREQUEST_0_QTY0=Digital&L_PAYMENTREQUEST_0_NAME0=Test Name&L_PAYMENTREQUEST_0_AMT0=3&L_NAME0=Test Name&L_DESC0=Test+Recurring+Payment%28+%243+monthly%29&L_AMT0=3&L_QTY0=1

解决方案

Is it a live or a sandbox API call?

You need to have Reference Transaction activated on your PayPal account to be able to call this API.

The Reference Transaction API is not available for everybody. I would advise to contact your PayPal representative to ask them to activate this on your PayPal account.

If you are doing this on the sandbox, you should simply upgrade your sandbox account to a Pro account. This should activate Reference Transaction on the sandbox account.

To be sure, you should ask PayPal if your sandbox account has Reference Transaction enabled.

Can you send the full API call in your question please?

Update

I see something strange in your code:

$nvpstr.="&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital";
$nvpstr.="&L_PAYMENTREQUEST_0_QTY0=Digital";

Change it by:

$nvpstr.="&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Physical";
$nvpstr.="&L_PAYMENTREQUEST_0_QTY0=1";

Update 2

I see few errors in the API call:

&TOKEN=EC-30M31870BS241854X&
REFERENCEID=B-81S156104Y376273D&
PAYMENTACTION=Sale&
AMT=3&
CURRENCYCODE=USD&
IPADDRESS=paypalrecurring.com&
L_ITEMCATEGORY0=Digital&
DESC=Test+Recurring+Payment%28+%243+monthly%29&
L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital&
L_PAYMENTREQUEST_0_QTY0=Digital&
L_PAYMENTREQUEST_0_NAME0=Test Name&
L_PAYMENTREQUEST_0_AMT0=3&
L_NAME0=Test Name&
L_DESC0=Test+Recurring+Payment%28+%243+monthly%29&
L_AMT0=3&
L_QTY0=1string(606) 

Provide a valid IP address in the IP address variable.

Replace

L_PAYMENTREQUEST_0_QTY0=Digital&

by:

L_PAYMENTREQUEST_0_QTY0=1&

In the last parameter there is a wrong parameter replace:

L_QTY0=1string(606) 

by:

L_QTY0=1

Eventually change the item category from Digital to Physical. I know you need special rights to do Digital Goods with PayPal.

L_ITEMCATEGORY0=Physical&
L_PAYMENTREQUEST_0_ITEMCATEGORY0=Physical&

这篇关于调用 DoReferenceTransaction 方法给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆