问题是我无法通过授权或订单付款。 如果可以的话,请帮我解决我的问题。 这是我的代码: 有什么想法吗?
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;
}