问题描述
因此,我已将服务引用添加到我的项目中,该引用为
https://secure.paygate.co.za/payhost/process.trans?wsdl
My PaygateRef是Web服务引用名称(命名空间)
PaygateRef.SinglePaymentRequest1 PaygatePayment = new PaygateRef.SinglePaymentRequest1();
PaygateRef.CardPaymentRequestType Request = new PaygateRef.CardPaymentRequestType();
Request.Account = new PaygateRef.PayGateAccountType();
Request.Account.PayGateId = "000000000"; //my PaygateID
Request.Account.Password = "mypassword"; //my Encryption key
Request.Customer = new PaygateRef.PersonType();
Request.Customer.Title = "Mr";
Request.Customer.FirstName = "Rich";
Request.Customer.LastName = "Buyer";
Request.Customer.Mobile = new string[]{"0830000001"}; //My cell number
Request.CardIssueNumber = "500000000000008";//card number
Request.CardIssueDate = "012020";//january 2020
Request.CVV = "001";// card ccv
Request.Order = new PaygateRef.OrderType();
Request.Order.MerchantOrderId = "115422488465";//a random test orderID
Request.Order.Currency = PaygateRef.CurrencyType.ZAR;
Request.Order.Amount = 100; //R1
PaygatePayment.SinglePaymentRequest = new PaygateRef.SinglePaymentRequest();
PaygatePayment.SinglePaymentRequest.Item = Request;
PaygateRef.PayHOST myPaygateinterface = new PaygateRef.PayHOSTClient();
myPaygateinterface.SinglePayment(PaygatePayment);
我收到的错误是
Validation error
我使用在其他站点上工作的多个卡进行了测试
而这个账号是在之前用PHP编写的网站上使用的,它在那里工作。根据我的理解,Paygate端的一切设置都是正确的
我为什么收到此错误以及如何解决它?
编辑 我确实试过
Request.ItemsElementName = new PaygateRef.ItemsChoiceType[]
{
PaygateRef.ItemsChoiceType.CardExpiryDate,
PaygateRef.ItemsChoiceType.CardNumber
};
Request.Items = new string[] { "012020", "500000000000008" };
推荐答案
我能够通过更改卡详细信息的顺序来解决我的问题。在您的例子中,您已经将cardexpirydate放在了cardnumber之上。我颠倒了顺序,也确保了CVV是在卡片详细信息之后出现的。这将是您的代码。
Request.ItemsElementName = new PaygateRef.ItemsChoiceType[]
{
PaygateRef.ItemsChoiceType.CardNumber,
PaygateRef.ItemsChoiceType.CardExpiryDate
};
Request.Items = new string[] { "500000000000008", "012020" };
Request.CVV = "001";// card ccv
希望它能有所帮助!
我也没有使用cardissuedate或cardissuennumber,因为它们是可选的,我不需要。
此外,您还可以检查您获得的异常的详细信息节点。在详细信息节点中,将明确定义错误原因。