【发布时间】:2015-10-15 02:22:51
【问题描述】:
我目前正在使用一家名为 eWAY 的公司的信用卡 SDK 编写一个 iOS 应用程序。
我试图让它在沙盒测试环境中工作,但我一直收到 null 错误。
NSLog 输出(“EWAY ERROR”是我的 NSLog 消息的一部分)
2015-10-15 12:25:40.127 EwayTest[1351:37919] EWAY ERROR: <null> ()
我确实使用网页上的示例:https://www.eway.com.au/developers/sdk/ios
网关: 我正在使用 URL:https://api.sandbox.ewaypayments.com/ 指定的网关。
我的代码:
- (IBAction)btnPress:(id)sender
{
Transaction *transaction = [[Transaction alloc] init];
Customer *customerObj = [[Customer alloc] init];
customerObj.Reference = @"A12345";
customerObj.Title = @"Mr.";
customerObj.FirstName = @"Nico";
customerObj.LastName = @"Vulture";
customerObj.CompanyName = @"All Web Pty Ltd";
customerObj.JobDescription = @"Developer";
customerObj.Phone = @"09 889 0986";
customerObj.Mobile = @"09 889 0986";
Address *customerAddress = [[Address alloc] init];
customerAddress.Street1 = @"Level 5";
customerAddress.Street2 = @"369 Queen Street";
customerAddress.City = @"Sydney";
customerAddress.State = @"NSW";
customerAddress.PostalCode = @"2010";
customerAddress.Country = @"au";
customerObj.Address = customerAddress;
CardDetails *cardDetails = [[CardDetails alloc] init];
cardDetails.Name = @"Nico Vulture";
cardDetails.Number = @"378282246310005";
cardDetails.ExpiryMonth = @"10";
cardDetails.ExpiryYear = @"19";
cardDetails.CVN = @"836";
customerObj.CardDetails = cardDetails;
transaction.Customer = customerObj;
//payment
Payment *payment = [[Payment alloc] init];
payment.Payment = 100;
payment.InvoiceNumber = @"Inv 21540";
payment.InvoiceDescription = @"Individual Invoice Description";
payment.InvoiceReference = @"513456";
payment.CurrencyCode = @"AUD";
transaction.Payment = payment;
//Make payment
[RapidAPI submitPayment:transaction completed:^(SubmitPaymentResponse *submitPaymentResponse) {
if(submitPaymentResponse.Status == Accepted)
{
NSLog(@"EWAY: Accepted");
}
else if (submitPaymentResponse.Status == Success)
{
// The API Call completed successfully.
NSLog(@"EWAY: Success");
}
else if(submitPaymentResponse.Status == Error)
{
// An error occurred with the API Call.
[RapidAPI userMessage:submitPaymentResponse.Errors Language:@"EN" completed:^(UserMessageResponse *userMessageResponse) {
NSString *msg = [NSString stringWithFormat:@"%@ \n %@",userMessageResponse.Errors, userMessageResponse.Messages];
NSLog(@"EWAY ERROR: %@",msg);
}];
}
}];
}
然而,我注意到当我更改网关 (URL) https://api.ewaypayments.com/DirectPayment.json 时,我收到以下错误输出:
EWAY ERROR: S9990
(null)
这在网站上表示“库没有初始化端点,或者没有初始化到 URL”错误。
我一直在联系公司,一定是我这里做错了。有没有人有这方面的经验并且可以提供一些关于我缺少什么的见解?
【问题讨论】:
-
我遇到了同样的问题,我只是将沙盒 api 更改为 live (production) api 它解决了我的问题。
标签: ios objective-c payment-gateway payment