-1

在我的 symfony2 应用程序中,我使用 payum paypal express checkout 来执行定期付款。

我在这里遵循说明:https ://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/

我想添加项目详细信息,但在输入税务信息时无法正常工作。我收到付款错误:

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.

我一直在玩弄税收数额,但我无法让它发挥作用。如果我删除所有税务信息,一切都会好起来的,我会被重定向到正确金额的贝宝。如何配置我的付款以使其正常工作?

请参阅下面发送到贝宝的详细参数:

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
)
4

1 回答 1

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;
    }

希望对您有所帮助。

于 2015-03-11T16:43:36.193 回答