使用PaymentAction of Authorization无法完成交易

时间:2014-02-04 07:40:30

标签: c# asp.net authentication

问题是我无法通过授权或订单付款。 如果可以的话,请帮我解决我的问题。 这是我的代码: 有什么想法吗?

private static bool DoExpressCheckoutPaymentSandBox(string expressCheckoutToken, string expressCheckoutPayerID, string orderTotalValue, PayPalCurrency currency)
        {
            bool success = false;

            PayPalAPIHelper.PayPalSandboxWS.PaymentDetailsType paymentDetails = new PayPalSandboxWS.PaymentDetailsType();
            paymentDetails.OrderTotal = new PayPalSandboxWS.BasicAmountType();
            paymentDetails.OrderTotal.currencyID = ConvertProgramCurrencyToPayPalSandbox(currency);
            paymentDetails.OrderTotal.Value = orderTotalValue;
            paymentDetails.PaymentAction = PayPalSandboxWS.PaymentActionCodeType.Authorization;
            paymentDetails.TransactionId = paymentDetails.TransactionId;
            paymentDetails.AllowedPaymentMethod = PayPalSandboxWS.AllowedPaymentMethodType.InstantPaymentOnly;

            PayPalAPIHelper.PayPalSandboxWS.DoExpressCheckoutPaymentReq payReq = new PayPalAPIHelper.PayPalSandboxWS.DoExpressCheckoutPaymentReq()
            {
                DoExpressCheckoutPaymentRequest = new PayPalAPIHelper.PayPalSandboxWS.DoExpressCheckoutPaymentRequestType()
                {
                    Version = Version,

                    DoExpressCheckoutPaymentRequestDetails = new PayPalAPIHelper.PayPalSandboxWS.DoExpressCheckoutPaymentRequestDetailsType()
                    {
                        Token = expressCheckoutToken,

                        PaymentAction = PayPalAPIHelper.PayPalSandboxWS.PaymentActionCodeType.Authorization,
                        PaymentActionSpecified = true,
                        PayerID = expressCheckoutPayerID,
                        PaymentDetails = new PayPalAPIHelper.PayPalSandboxWS.PaymentDetailsType[] { paymentDetails },
                    }
                }
            };
            PayPalAPIHelper.PayPalSandboxWS.DoExpressCheckoutPaymentResponseType doResponse =
                BuildPayPalSandboxWebservice().DoExpressCheckoutPayment(payReq);

            HandleErrorSandbox(doResponse);
            success = true;
            return success;
        }

0 个答案:

没有答案