我正在ASP.NET项目中实现Paypal Express结账功能,该功能需要授权,然后取消或捕获授权金额。我使用的是他们版本=104.0的API。
就我对整个过程的理解而言,我做的每件事都是正确的:
>
我在付款详细信息中调用ActionType设置为“authorize”的SetExpressCheckout方法
SetExpressCheckoutRequestDetailsType reqDetails = new SetExpressCheckoutRequestDetailsType();
reqDetails.ReturnURL = "http://some.url";
reqDetails.CancelURL = "http://some.url";
reqDetails.NoShipping = "1";
reqDetails.OrderDescription = "You're about to buy items for " + payment.Amount.ToString("F");
reqDetails.cpplogoimage = "http://some.ulr/image.jpb";
reqDetails.PaymentDetails = new PaymentDetailsType[1];
reqDetails.PaymentDetails[0] = new PaymentDetailsType();
reqDetails.PaymentDetails[0].PaymentDetailsItem = new PaymentDetailsItemType[cart.LineItems.Count];
int i = 0;
foreach (LineItemModel li in cart.LineItems)
{
PaymentDetailsItemType item = new PaymentDetailsItemType();
item.Amount = new BasicAmountType();
item.Amount.Value = li.TotalIncludingShipping.ToString("F");
item.Amount.currencyID = CurrencyCodeType.AUD;
item.Name = li.ProductItem.DisplayName;
item.Number = li.ProductItem.SKU;
item.Quantity = li.Quantity.ToString();
item.Description = "";
reqDetails.PaymentDetails[0].PaymentDetailsItem.SetValue(item, i);
i++;
}
reqDetails.OrderTotal = new BasicAmountType()
{
currencyID = CurrencyCodeType.AUD,
Value = payment.Amount.ToString("F")
};
reqDetails.PaymentDetails[0].PaymentAction = PaymentActionCodeType.Authorization;
reqDetails.PaymentDetails[0].PaymentActionSpecified = true;
SetExpressCheckoutReq req = new SetExpressCheckoutReq()
{
SetExpressCheckoutRequest = new SetExpressCheckoutRequestType()
{
Version = "104.0",
SetExpressCheckoutRequestDetails = reqDetails
}
};
然后我打电话给DoExprescheckout。这是请求的代码
DoExpressCheckoutPaymentReq payReq = new DoExpressCheckoutPaymentReq()
{
DoExpressCheckoutPaymentRequest = new DoExpressCheckoutPaymentRequestType()
{
Version = ConfigurationManager.AppSettings["PaypalAPIVersion"],
DoExpressCheckoutPaymentRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType()
{
Token = token,
PayerID = payerID,
PaymentDetails = new PaymentDetailsType[1]
}
}
};
payReq.DoExpressCheckoutPaymentRequest.DoExpressCheckoutPaymentRequestDetails.PaymentAction = PaymentActionCodeType.Authorization;
payReq.DoExpressCheckoutPaymentRequest.DoExpressCheckoutPaymentRequestDetails.PaymentActionSpecified = true;
payReq.DoExpressCheckoutPaymentRequest.DoExpressCheckoutPaymentRequestDetails.PaymentDetails[0] = new PaymentDetailsType();
payReq.DoExpressCheckoutPaymentRequest.DoExpressCheckoutPaymentRequestDetails.PaymentDetails[0].PaymentAction = PaymentActionCodeType.Authorization;
payReq.DoExpressCheckoutPaymentRequest.DoExpressCheckoutPaymentRequestDetails.PaymentDetails[0].PaymentActionSpecified = true;
payReq.DoExpressCheckoutPaymentRequest.DoExpressCheckoutPaymentRequestDetails.PaymentDetails[0].OrderTotal = new BasicAmountType();
payReq.DoExpressCheckoutPaymentRequest.DoExpressCheckoutPaymentRequestDetails.PaymentDetails[0].OrderTotal.currencyID = CurrencyCodeType.AUD;
payReq.DoExpressCheckoutPaymentRequest.DoExpressCheckoutPaymentRequestDetails.PaymentDetails[0].OrderTotal.Value = total.ToString("F");
此请求也返回“成功”。我保存响应的DoExprescheckOutPaymentResponseDetails.PaymentInfo[0].TransactionId以备将来使用
但是当我使用前面响应中的事务ID运行DoAuthorize时,我得到的是“failure”。下面是请求代码:
DoAuthorizationReq authReq = new DoAuthorizationReq()
{
DoAuthorizationRequest = new DoAuthorizationRequestType()
{
Version = "104.0",
TransactionID = doCheckoutTransactionId
}
};
authReq.DoAuthorizationRequest.Amount = new BasicAmountType();
authReq.DoAuthorizationRequest.Amount.currencyID = CurrencyCodeType.AUD;
authReq.DoAuthorizationRequest.Amount.Value = total.ToString("F");
响应显示“Failure”,错误数组包含1个ErrorCode=10609的项,消息为“无效事务ID”
你有什么想法为什么会这样吗?
多谢!
要在授权后捕获资金,您需要运行DoCapture,而不是doauthorization。
问题内容: 我正在尝试使用Spring @Transactional批注,但是在调用 findAll 方法时出现问题,并且出现以下错误: 人DAO: 这是我的: 我尝试删除此行,但是又出现了一个错误,为什么这行不通? 问题答案: 您必须显式声明对事务管理器注释的支持 添加到您的配置中: tx是xmlns:tx =“ http://www.springframework.org/schema/tx”
我想从我客户的PayPal帐户提取交易数据。他给了我API用户名、p/w和签名。此外,我们还在developer上创建了一个实时“应用程序”。贝宝。现在我有了一个客户ID和秘密。 我有asp.net/c#RestAPiSample代码。我应该调用哪个(REST或SOAP)API来获取“销售”数据(即,从他的客户到他的贝宝账户的付款?基本上,我试图使用销售数据创建一些额外的报告。 谢谢。
我正在使用贝宝保险库服务,从存储的信用卡转移金额到贝宝pro帐户。 下面是我跟踪的文档链接:https://developer.paypal.com/docs/integration/direct/rest-vault-overview。 成功整合后,我已经检查它是收取5.9%的交易费,而我听说贝宝收费只有2.9%的情况下,一个专业帐户。 请确认从信用卡向贝宝帐户转账的贝宝保险库服务的费用。如有任
null 我有一个orders控制器,当我单击“Buy”按钮时,控制器将用户重定向到。在我的例子中,这意味着用户被重定向到: 然后,在沙盒贝宝商店,我成功地登录与买家的帐户,并点击继续按钮,代表付款。我成功地重定向回我的success_url,并收到一些看起来像是成功的参数: 好的,所以很酷,交易完成了,但当我登录沙箱贝宝网站与买方或卖方的登录细节,没有交易列出。当我登录到我的主要贝宝开发者帐户时
我和贝宝做了一个整合。我正在为Java使用REST API。目前,我有一个问题与未决付款。当我查找支付(https://api.paypal.com/v1/payments/payment/{paymentId})到沙箱环境来检查支付状态时,响应是不同的。当我以卖方身份批准付款时,付款处于状态 已核准 已完成的示例Respose: 同样,当我拒绝交易时,Sanbox也起作用。一旦付款状态失败,销售
我发现Paypal API引用事务已被弃用https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/ 它会将您重定向到https://developer.paypal.com/docs/integration/direct/express-checkout/integra