Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在仅授权继续交易类型中设置订单发票编号和说明?_Php_Paypal_Paypal Sandbox_Authorize.net - Fatal编程技术网

Php 如何在仅授权继续交易类型中设置订单发票编号和说明?

Php 如何在仅授权继续交易类型中设置订单发票编号和说明?,php,paypal,paypal-sandbox,authorize.net,Php,Paypal,Paypal Sandbox,Authorize.net,如何在AuthorizeNet中使用Paypal express checkout更新交易类型为“authOnlyContinueTransaction”或“authCaptureContinueTransaction”的发票编号和说明。这需要在PHP中完成 我尝试了下面的代码: $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName(\

如何在AuthorizeNet中使用Paypal express checkout更新交易类型为“authOnlyContinueTransaction”或“authCaptureContinueTransaction”的发票编号和说明。这需要在PHP中完成

我尝试了下面的代码:

$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
    $merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID);
    $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY);

    // Set the transaction's refId
    $refId = 'ref' . time();

    // Set PayPal compatible merchant credentials
    $paypal_type = new AnetAPI\PayPalType();
    $paypal_type->setPayerID($payerId);

    $paypal_type->setSuccessUrl("http://www.merchanteCommerceSite.com/Success/TC25262");
    $paypal_type->setCancelUrl("http://www.merchanteCommerceSite.com/Success/TC25262");

    $payment_type = new AnetAPI\PaymentType();
    $payment_type->setPayPal($paypal_type);

    // Order info
    $order = new AnetAPI\OrderType();
    $order->setInvoiceNumber("101");
    $order->setDescription("Shirts");

    //create a transaction
    $transactionRequestType = new AnetAPI\TransactionRequestType();
    $transactionRequestType->setTransactionType("authOnlyContinueTransaction");
    $transactionRequestType->setRefTransId($transactionId);
    $transactionRequestType->setAmount(4.34);
    $transactionRequestType->setPayment($payment_type);
    $transactionRequestType->setOrder($order);

    $request = new AnetAPI\CreateTransactionRequest();
    $request->setMerchantAuthentication($merchantAuthentication);
    $request->setRefId($refId);
    $request->setTransactionRequest($transactionRequestType);

    $controller = new AnetController\CreateTransactionController($request);

    $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);

    if ($response != null) {
        if ($response->getMessages()->getResultCode() == \SampleCode\Constants::RESPONSE_OK) {
            $tresponse = $response->getTransactionResponse();

            if ($tresponse != null && $tresponse->getMessages() != null) {
                echo " Transaction Response code : " . $tresponse->getResponseCode() . "\n";
                echo "TRANS ID  : " . $tresponse->getTransId() . "\n";
                echo "Payer ID : " . $tresponse->getSecureAcceptance()->getPayerID();
                echo "Description : " . $tresponse->getMessages()[0]->getDescription() . "\n";
            } else {
                echo "Transaction Failed \n";
                if ($tresponse->getErrors() != null) {
                    echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                    echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
                }
            }
        } else {
            echo "Transaction Failed \n";
            $tresponse = $response->getTransactionResponse();
            if ($tresponse != null && $tresponse->getErrors() != null) {
                echo " Error code  : " . $tresponse->getErrors()[0]->getErrorCode() . "\n";
                echo " Error message : " . $tresponse->getErrors()[0]->getErrorText() . "\n";
            } else {
                echo " Error code  : " . $response->getMessages()->getMessage()[0]->getCode() . "\n";
                echo " Error message : " . $response->getMessages()->getMessage()[0]->getText() . "\n";
            }
        }
    } else {
        echo  "No response returned \n";
    }
无法更改订单的发票号和说明。 早些时候,使用事务类型“authOnlyTransaction”或“authCaptureTransaction”可以更新发票号和说明

如何更新交易类型为“authOnlyContinueTransaction”或“authCaptureContinueTransaction”的交易


我从

中提到,您似乎误解了流程。无法在authOnlyContinueTransaction或authCaptureContinueTransaction中传递顺序对象。流程是这样的

  • 创建事务并获取引用id
  • 通过上述方法中引用的id进行确认

  • 或者,最好使用允许您设置订单的
    createTransactionRequest

    您是否收到此代码的任何错误,如果有,请共享。没有,没有错误。返回的事务消息类型为数组(0=>net\Authorization\api\contract\v1\TransactionResponseType\MessagesType\MessageAType::uuu设置状态(数组('code'=>'1','description'=>'此事务已被批准'),),感谢支持。但是@Rajesh createTransactionRequest总是在从任何事件(如仅授权、授权和捕获、获取详细信息、仅授权继续等)发送请求时调用createTransactionResponse调用响应。表示createTransactionRequest for request和createTransactionResponse for response。我不是说expressCheckout方法,但这里的@Rajesh方法是正确的,您不能修改AuthOnly或AuthCapture交易的后续交易中的发票或说明。这是当前API中的一个限制。