在ios中使用授权的.net支付网关

时间:2012-07-26 13:47:30

标签: iphone objective-c

我正在使用ios中的授权.net payement网关 在以下方法

 (void) createTransaction {
    AuthNet *an = [AuthNet getInstance];

    [an setDelegate:self];

    CreditCardType *creditCardType = [CreditCardType creditCardType];
    creditCardType.cardNumber = @"4111111111111111";
    NSLog(@"babul cardNumber is %@",creditCardType.cardNumber);
    creditCardType.cardCode = @"100";
    NSLog(@"babul cardCode is %@",creditCardType.cardCode);
    creditCardType.expirationDate = @"1212";
    NSLog(@"babul expirationDate is %@",creditCardType.expirationDate);
    PaymentType *paymentType = [PaymentType paymentType];
    paymentType.creditCard = creditCardType;

    ExtendedAmountType *extendedAmountTypeTax = [ExtendedAmountType extendedAmountType];
    extendedAmountTypeTax.amount = @"0";
    extendedAmountTypeTax.name = @"Tax";

    ExtendedAmountType *extendedAmountTypeShipping = [ExtendedAmountType extendedAmountType];
    extendedAmountTypeShipping.amount = @"0";
    extendedAmountTypeShipping.name = @"Shipping";

    LineItemType *lineItem = [LineItemType lineItem];
    lineItem.itemName = @"Soda";
    lineItem.itemDescription = @"Soda";
    lineItem.itemQuantity = @"1";
    lineItem.itemPrice = @"1.00";
    lineItem.itemID = @"1";

    TransactionRequestType *requestType = [TransactionRequestType transactionRequest];
    requestType.lineItems = [NSArray arrayWithObject:lineItem];
    requestType.amount = @"1.00";
    requestType.payment = paymentType;
    requestType.tax = extendedAmountTypeTax;  
    requestType.shipping = extendedAmountTypeShipping;

   CreateTransactionRequest *request = [CreateTransactionRequest createTransactionRequest];
    request.transactionRequest = requestType;
    request.transactionType = AUTH_ONLY;
    request.anetApiRequest.merchantAuthentication.mobileDeviceId =
    [[[UIDevice currentDevice] uniqueGlobalDeviceIdentifier]
     stringByReplacingOccurrencesOfString:@"-" withString:@"_"];
    request.anetApiRequest.merchantAuthentication.sessionToken = sessionToken;
    [an purchaseWithRequest:request];
}

我收到的回复是

创建交易响应 2012-07-26 19:14:00.131授权[2355:207]错误E00003命名空间'AnetApi / xml / v1 / schema / AnetApiSchema.xsd'中的元素'merchantAuthentication'具有无效的子元素'mobileDeviceId'命名空间'AnetApi / xml / v1 / schema / AnetApiSchema.xsd'。期望的可能元素列表:命名空间'AnetApi / xml / v1 / schema / AnetApiSchema.xsd'中的'name,transactionKey,sessionToken,password'。 命名空间警告:xmlns:URI AnetApi / xml / v1 / schema / AnetApiSchema.xsd不是绝对的 ttp://www.w3.org/2001/XMLSchema“xmlns =”AnetApi / xml / v1 / schema / AnetApiSchema.xsd“                                                                                ^ 2012-07-26 19:14:00.131授权[2355:207]错误=(null) 2012-07-26 19:14:00.247授权[2355:207] babul输出为Message.code = E00003 Message.text =命名空间'AnetApi / xml / v1 / schema / AnetApiSchema.xsd'中的元素'merchantAuthentication'在命名空间'AnetApi / xml / v1 / schema / AnetApiSchema.xsd'中具有无效的子元素'mobileDeviceId'。期望的可能元素列表:命名空间'AnetApi / xml / v1 / schema / AnetApiSchema.xsd'中的'name,transactionKey,sessionToken,password'。

是否有上述问题的替代方案以及如何将交易存储在授权的.net中 (我创建了我的测试帐户,我正在提供这些凭据,我批准了我的设备,但后来我收到了上述错误)

提前致谢

1 个答案:

答案 0 :(得分:1)

我认为您需要购买应用,因为Apple不会通过任何网络服务或API批准申请付款。