我正在尝试通过软件集成获得成功付款后回复,但没有得到任何响应;
Error: Error: 7000:Invalid XML.
以下是成功函数:
public function successAction()
{
$configkey = 'my_key';
$SofortLib_Notification = new Notification();
$TestNotification = $SofortLib_Notification->getNotification(file_get_contents('php://input'));
echo $SofortLib_Notification->getTransactionId();
echo '<br />';
echo $SofortLib_Notification->getTime();
echo '<br />';
$SofortLibTransactionData = new TransactionData($configkey);
$SofortLibTransactionData->addTransaction($TestNotification);
$SofortLibTransactionData->setApiVersion('2.0');
$SofortLibTransactionData->setTime('2012-11-14T18:00+02:00', '2012-12-13T00:00+02:00');
$SofortLibTransactionData->setNumber(5, 1);
$SofortLibTransactionData->sendRequest();
echo '<pre>'; print_r($SofortLibTransactionData);
//exit();
$output = array();
$methods = array(
'getAmount' => '',
'getAmountRefunded' => '',
'getCount' => '',
'getPaymentMethod' => '',
'getConsumerProtection' => '',
'getStatus' => '',
'getStatusReason' => '',
'getStatusModifiedTime' => '',
'getLanguageCode' => '',
'getCurrency' => '',
'getTransaction' => '',
'getSenderAccountNumber' => '',
'getSenderBankCode' => '',
'getSenderCountryCode' => '',
'getSenderBankName' => '',
'getSenderBic' => '',
'getSenderIban' => '',
);
foreach($methods as $method => $params) {
if(count($params) == 2) {
$output[] = $method . ': ' . $SofortLibTransactionData->$method($params[0], $params[1]);
} else if($params !== '') {
$output[] = $method . ': ' . $SofortLibTransactionData->$method($params);
} else {
$output[] = $method . ': ' . $SofortLibTransactionData->$method();
}
}
if($SofortLibTransactionData->isError()) {
echo $SofortLibTransactionData->getError();
} else {
echo implode('<br />', $output);
}
// $sofortTans = new TransactionData;
// echo '<pre>';print_r($sofortTans);
// $viewModel = new ViewModel(array('status' => $sofortTans));
// $viewModel->setTemplate('layout/pay_done');
// return $viewModel;
}
这里我的控制器中的Action方法发送请求你能指导我如何获得响应吗?
$configkey = 'my_config_key';
$Sofortueberweisung = new SofortUeberWeisung($configkey);
$Sofortueberweisung->setAmount($request->getPost('grandtotal_price'));
$Sofortueberweisung->setCurrencyCode('EUR');
$Sofortueberweisung->setReason('Single Coupon Order', 'Voucher Codes');
$Sofortueberweisung->setSuccessUrl('http://localhost:8088/payment/success', false);
$Sofortueberweisung->setCustomerprotection(true);
$Sofortueberweisung->sendRequest();
if($Sofortueberweisung->isError()) {
// SOFORT-API didn't accept the data
echo $Sofortueberweisung->getError();
} else {
// get unique transaction-ID useful for check payment status
$transactionId = $Sofortueberweisung->getTransactionId();
// buyer must be redirected to $paymentUrl else payment cannot be successfully completed!
$paymentUrl = $Sofortueberweisung->getPaymentUrl();
$this->redirect()->toUrl($paymentUrl);
//header('Location: '.$paymentUrl);
}
我正在使用此API库,Sofort API Library
答案 0 :(得分:0)
使用?transId=-TRANSACTION-
添加参数success_url
,然后您就能从响应中获取参数!
$transNumber = $this->getRequest()->getQuery('transId');
$fields = $sofortObj->getTransactionData($transNumber);
您在$fields