在我的symfony2应用程序中,我使用payum paypal express checkout来执行定期付款。
我按照以下说明操作:https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
我想添加项目详细信息,但是当我提交税务信息时,我无法使其生效。我收到了payum错误:
L_SHORTMESSAGE0 => Transaction refused because of an invalid argument. See additional error messages for details.
L_LONGMESSAGE0 => The totals of the cart item amounts do not match order amounts.
我一直在玩税款,但我无法让它发挥作用。 如果我删除所有税务信息,一切都很顺利,我将重定向到paypal与适当的金额。如何配置付款以使其有效?
请参阅下面发送给paypal的详细参数:
array(14
L_PAYMENTREQUEST_0_NAME0 => Compte utilisateur
L_PAYMENTREQUEST_0_NUMBER0 => 46
L_PAYMENTREQUEST_0_DESC0 => Abonnement pour 1 Compte utilisateur(s) pour 19.00€ / mois
L_PAYMENTREQUEST_0_AMT0 => 19
L_PAYMENTREQUEST_0_TAXAMT0 => 3.8
L_PAYMENTREQUEST_0_QTY0 => 1
PAYMENTREQUEST_0_TAXAMT => 3.8
PAYMENTREQUEST_0_CURRENCYCODE => EUR
NOSHIPPING => 1
PAYMENTREQUEST_n_ITEMAMT => 22.8
PAYMENTREQUEST_0_AMT => 22.8
subscription_type => mensual
L_BILLINGTYPE0 => RecurringPayments
L_BILLINGAGREEMENTDESCRIPTION0 => Abonnement mensuel FoodMeUp
)
和一个payum回答:
array(28
L_PAYMENTREQUEST_0_NAME0 => Compte utilisateur
L_PAYMENTREQUEST_0_NUMBER0 => 46
L_PAYMENTREQUEST_0_DESC0 => Abonnement pour 1 Compte utilisateur(s) pour 19.00€ / mois
L_PAYMENTREQUEST_0_AMT0 => 19
L_PAYMENTREQUEST_0_TAXAMT0 => 3.8
L_PAYMENTREQUEST_0_QTY0 => 1
PAYMENTREQUEST_0_TAXAMT => 3.8
PAYMENTREQUEST_0_CURRENCYCODE => EUR
NOSHIPPING => 1
PAYMENTREQUEST_n_ITEMAMT => 22.8
PAYMENTREQUEST_0_AMT => 22.8
subscription_type => mensual
L_BILLINGTYPE0 => RecurringPayments
L_BILLINGAGREEMENTDESCRIPTION0 => Abonnement mensuel FoodMeUp
INVNUM => 55004be1633b4
PAYMENTREQUEST_0_PAYMENTACTION => Sale
RETURNURL => http://foodmeup.dev/app_dev.php/payment/capture/NRil21P5mhVC93qman2D_k4al_xeFd-MfnHHYyqVxYQ
CANCELURL => http://foodmeup.dev/app_dev.php/payment/capture/NRil21P5mhVC93qman2D_k4al_xeFd-MfnHHYyqVxYQ
PAYMENTREQUEST_0_NOTIFYURL => http://foodmeup.dev/app_dev.php/payment/notify/rRD65dqHU-TSgXyBdW8eJkGdMx6CiCFVOq8BZ8PTBt4
TIMESTAMP => 2015-03-11T14:06:29Z
CORRELATIONID => 193dfdd411684
ACK => Failure
VERSION => 65.1
BUILD => 15735246
L_ERRORCODE0 => 10413
L_SHORTMESSAGE0 => Transaction refused because of an invalid argument. See additional error messages for details.
L_LONGMESSAGE0 => The totals of the cart item amounts do not match order amounts.
L_SEVERITYCODE0 => Error
)
答案 0 :(得分:0)
在我的一个项目中,我使用以下代码在PayPal上发送付款请求(我使用https://github.com/paypal/merchant-sdk-php):
$paymentDetails = new EBLBaseComponents\PaymentDetailsType();
foreach ($paymentData['items'] as $key => $item) {
$itemDetails = new EBLBaseComponents\PaymentDetailsItemType();
$itemDetails->Name = $item['name'];
$itemDetails->Amount = new CoreComponentTypes\BasicAmountType($paymentData['currency'], $item['amount']);Order item price
$itemDetails->Quantity = $item['quantity'];
$itemDetails->ItemCategory = $item['category'];
if ($item['tax']) {
$itemDetails->Tax = new CoreComponentTypes\BasicAmountType($paymentData['currency'], $item['tax']); //Order item tax
}
$paymentDetails->PaymentDetailsItem[$key] = $itemDetails;
}
$paymentDetails->OrderTotal = new CoreComponentTypes\BasicAmountType($paymentData['currency'], $paymentData['total']);//Order total
$paymentDetails->PaymentAction = 'Sale';
$paymentDetails->ItemTotal = new CoreComponentTypes\BasicAmountType($paymentData['currency'], $paymentData['subtotal']); //Order subtotal
$paymentDetails->TaxTotal = new CoreComponentTypes\BasicAmountType($paymentData['currency'], $paymentData['tax']);//Order total tax
$setECReqDetails = new EBLBaseComponents\SetExpressCheckoutRequestDetailsType();
$setECReqDetails->PaymentDetails[0] = $paymentDetails;
$setECReqDetails->CancelURL = $paymentData['cancelUrl'];
$setECReqDetails->ReturnURL = $paymentData['returnUrl'];
$setECReqDetails->ReqConfirmShipping = 0;
$setECReqDetails->NoShipping = 1;
$setECReqType = new PayPalAPI\SetExpressCheckoutRequestType();
$setECReqType->SetExpressCheckoutRequestDetails = $setECReqDetails;
$setECReq = new PayPalAPI\SetExpressCheckoutReq();
$setECReq->SetExpressCheckoutRequest = $setECReqType;
try {
/** @var PayPalAPI\SetExpressCheckoutResponseType $setECResponse */
$setECResponse = $this->paypal->SetExpressCheckout(
$setECReq
);
} catch (\Exception $ex) {
$data = array('result' => 'failed');
$data['errors'] = $this->processConnectionException($ex);
return $data;
}
希望对你有所帮助。