Как установить номер счета-фактуры заказа и описание в auth Only Continue Transaction type?
Как обновить номер счета и описание с помощью Paypal express checkout в AuthorizeNet, с типом транзакции " authOnlyContinueTransaction "или"authCaptureContinueTransaction". Нужно это сделать на PHP.
Я попробовал код ниже:
$merchantAuthentication = new AnetAPIMerchantAuthenticationType();
$merchantAuthentication->setName(SampleCodeConstants::MERCHANT_LOGIN_ID);
$merchantAuthentication->setTransactionKey(SampleCodeConstants::MERCHANT_TRANSACTION_KEY);
// Set the transaction's refId
$refId = 'ref' . time();
// Set PayPal compatible merchant credentials
$paypal_type = new AnetAPIPayPalType();
$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 AnetAPIPaymentType();
$payment_type->setPayPal($paypal_type);
// Order info
$order = new AnetAPIOrderType();
$order->setInvoiceNumber("101");
$order->setDescription("Shirts");
//create a transaction
$transactionRequestType = new AnetAPITransactionRequestType();
$transactionRequestType->setTransactionType("authOnlyContinueTransaction");
$transactionRequestType->setRefTransId($transactionId);
$transactionRequestType->setAmount(4.34);
$transactionRequestType->setPayment($payment_type);
$transactionRequestType->setOrder($order);
$request = new AnetAPICreateTransactionRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setRefId($refId);
$request->setTransactionRequest($transactionRequestType);
$controller = new AnetControllerCreateTransactionController($request);
$response = $controller->executeWithApiResponse(netauthorizeapiconstantsANetEnvironment::SANDBOX);
if ($response != null) {
if ($response->getMessages()->getResultCode() == SampleCodeConstants::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"?
Я сослался на https://developer.authorize.net/api/reference/index.html#PayPal-express-checkout
1 ответ:
Вы, кажется, неправильно поняли поток. Невозможно передать Порядок Объект authOnlyContinueTransaction и authCaptureContinueTransaction. Поток вот такой.
- создайте транзакцию и получите идентификатор ссылки
- передайте указанный идентификатор в вышеуказанных методах, чтобы подтвердить его
Или, лучше использовать
createTransactionRequest
, что позволит вам установить порядок.