在搜索了很多文章之后,我找不到我的问题的解决方案。
我已经在网站上集成了ApplePay按钮,并在沙盒模式下成功完成了交易。我正在使用authorize.net php SDK生成请求。当我转为居住时,问题开始了。来自authorize.net的消息是“ 处理付款数据时出错。解密数据中缺少必填字段 ”
这是我所做的:
- 使用真实的authorize.net帐户中的一张更改了付款处理证书
- 将我用来处理authorize.net付款的凭据更改为我获得付款流程证书的真实账户
- 使用带有真实信用卡的实时Apple设备。
- 我正在使用First data Nashville处理器作为支持ApplePay的CC处理器
请注意,如果我切换回沙盒模式,则事务将顺利通过。
该请求和失败的响应如下:
请求:
{
"createTransactionRequest":{
"merchantAuthentication":{
"name":"xxxxxxxxx",
"transactionKey":"xxxxxxxxxxx"
},
"clientId":"sdk-php-2.0.0",
"refId":"ref1575669789",
"transactionRequest":{
"transactionType":"authOnlyTransaction",
"amount":"14.08",
"payment":{
"opaqueData":{
"dataDescriptor":"COMMON.APPLE.INAPP.PAYMENT",
"dataValue":"eyJ2ZXJzaW9u...Q1OSJ9fQ=="
}
},
"order":{
"invoiceNumber":"63059-191206",
"description":"xxxxxxxxx, xxxxxxxxxxxx v9.0.12 (Order# 63059-191206)"
},
"customer":{
"type":"individual",
"email":""
},
"billTo":{
"firstName":"xxxxxxx",
"lastName":"xxxxxxx",
"address":"xxxx San Remo Cir ",
"city":"Vista",
"state":"CA",
"zip":"92084",
"country":"US"
},
"retail":{
"marketType":0,
"deviceType":8
},
"transactionSettings":{
"setting":[
{
"settingName":"duplicateWindow",
"settingValue":"60"
}
]
}
}
}
}
响应:
{
"transactionResponse":{
"responseCode":"3",
"authCode":"",
"avsResultCode":"P",
"cvvResultCode":"",
"cavvResultCode":"",
"transId":"0",
"refTransID":"",
"transHash":"",
"testRequest":"0",
"accountNumber":"",
"accountType":"",
"errors":[
{
"errorCode":"153",
"errorText":"There was an error processing the payment data. Required fields are missing from decrypted data."
}
],
"transHashSha2":"",
"SupplementalDataQualificationIndicator":0
},
"refId":"ref1575669789",
"messages":{
"resultCode":"Error",
"message":[
{
"code":"E00027",
"text":"The transaction was unsuccessful."
}
]
}
}
我想念什么?
编辑:
这是关于从ApplePay发送opaqueData的代码
$transactionMode = $cc_authorize_mode == $this->MODE_TEST ? \net\authorize\api\constants\ANetEnvironment::SANDBOX : \net\authorize\api\constants\ANetEnvironment::PRODUCTION;
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName($cc_authorize_loginid);
$merchantAuthentication->setTransactionKey($cc_authorize_txnkey);
// Set the transaction's refId
$refId = 'ref' . time();
$phoneNumber = ! empty($co_b_phone) ? $co_b_phone : $co_phone;
$customerEmail = ! empty($co_b_email) ? $co_b_email : $co_email;
$ip = lloader()->getUtilByName('ip')->getClientIp();
// Create order information
$order = new AnetAPI\OrderType();
$order->setInvoiceNumber($order_number);
$order->setDescription($this->getOrderPostedByMessage($id_order, $order_number));
// Set the customer's Bill To address
$customerAddress = new AnetAPI\CustomerAddressType();
$customerAddress->setFirstName($co_ccholder_firstname);
$customerAddress->setLastName($co_ccholder_lastname);
if (! empty($co_b_company)) { $customerAddress->setCompany($co_b_company); }
$customerAddress->setAddress($co_b_address." ".$co_b_address2);
$customerAddress->setCity($co_b_city);
$bState = f_isUSState($co_b_state) ? $STATES_XX[$co_b_state] : $STATES[$co_b_state];
$customerAddress->setState($bState);
$customerAddress->setZip($co_b_zip);
$customerAddress->setCountry($countriesISO2[$co_country]);
$customerAddress->setPhoneNumber($phoneNumber);
$customerAddress->setEmail($customerEmail);
// Set the customer's identifying information
$customerData = new AnetAPI\CustomerDataType();
$customerData->setType("individual");
if ( ! empty($member_row['id'])) { $customerData->setId($member_row['id']); }
$customerData->setEmail($customerEmail);
// Add values for transaction settings
$duplicateWindowSetting = new AnetAPI\SettingType();
$duplicateWindowSetting->setSettingName("duplicateWindow");
$duplicateWindowSetting->setSettingValue("60");
// Create a TransactionRequestType object and add the previous objects to it
$transactionRequestType = new AnetAPI\TransactionRequestType();
$transactionRequestType->setCustomerIP($ip);
$transactionRequestType->setTransactionType($this->api_trtype_map[$transactionType]);
if (empty($this->applePayPaymentData)) {
// Normal CC request
// Create the payment data for a credit card
...
} else {
$retail = new AnetAPI\TransRetailInfoType();
$retail->setMarketType('0');
$retail->setDeviceType('8');
$transactionRequestType->setRetail($retail);
// Apple Pay Token Request
$op = new AnetAPI\OpaqueDataType();
$op->setDataDescriptor("COMMON.APPLE.INAPP.PAYMENT");
$paymentToken = base64_encode($this->applePayPaymentData);
$op->setDataValue($paymentToken);
$payment = new AnetAPI\PaymentType();
$payment->setOpaqueData($op);
}
$transactionRequestType->setAmount($grandTotal);
$transactionRequestType->setOrder($order);
$transactionRequestType->setPayment($payment);
$transactionRequestType->setBillTo($customerAddress);
$transactionRequestType->setCustomer($customerData);
$transactionRequestType->addToTransactionSettings($duplicateWindowSetting);
// Assemble the complete transaction request
$request = new AnetAPI\CreateTransactionRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setRefId($refId);
$request->setTransactionRequest($transactionRequestType);
// Create the controller and get the response
$controller = new AnetController\CreateTransactionController($request);
$response = $controller->executeWithApiResponse($transactionMode);
if ($response != null) {
if ($response->getMessages()->getResultCode() == "Ok") {
...
if ($tresponse != null && $tresponse->getMessages() != null) {
...
return true;
} else {
if ($tresponse->getErrors() != null) {
...
}
}
...
}
...
}
编辑2:
我在请求中添加了电子邮件,电话和IP地址,结果相同。修改后的请求如下:
{
"createTransactionRequest":{
"merchantAuthentication":{
"name":"**********",
"transactionKey":"***************"
},
"clientId":"sdk-php-2.0.0",
"refId":"ref1576180306",
"transactionRequest":{
"transactionType":"authOnlyTransaction",
"amount":"14.08",
"payment":{
"opaqueData":{
"dataDescriptor":"COMMON.APPLE.INAPP.PAYMENT",
"dataValue":"eyJ2ZXJzaW9uIj...DFiZiJ9fQ=="
}
},
"order":{
"invoiceNumber":"63117-191212",
"description":"******************* v9.0.12 (Order# 63117-191212)"
},
"customer":{
"type":"individual",
"email":"*********@gmail.com"
},
"billTo":{
"firstName":"Gabe",
"lastName":"Garcia",
"address":"********* Cir ",
"city":"Vista",
"state":"CA",
"zip":"92084",
"country":"US",
"phoneNumber":"**************",
"email":"**********@gmail.com"
},
"customerIP":"************",
"retail":{
"marketType":"0",
"deviceType":"8"
},
"transactionSettings":{
"setting":[
{
"settingName":"duplicateWindow",
"settingValue":"60"
}
]
}
}
}
}
1
试图重新生成证书?
—
Mully
是的,我数十次重新生成了付款处理证书,甚至在Apple帐户中重新创建了商家身份。
—
bksi
transactionRequest->客户->电子邮件为空,可能需要设置,是否可以在请求时设置?
—
Jannes Botis
您可以发布与设置“ opaqueData”字段相关的代码吗?它应该是从ApplePay钱包收到的base64编码令牌。
—
DinushaNT
@Roadowl是怎么回事。我编辑了帖子。请注意,相同的代码在沙盒模式下有效。该请求也会生成,并且可以看到。我认为它的产生方式并不多。
—
bksi