2017-01-06 45 views
1

我在我的應用程序中實現了Authorize.Net付款方式。它工作正常支付已成功完成,但我無法將用戶的詳細信息發送給付款服務器。 成功郵件交易後,我得到展示了創建交易客戶的賬單信息在Authorize.Net中沒有顯示

- (void) createTransaction 
{ 
    AuthNet *an = [AuthNet authNetWithEnvironment:ENV_TEST];//[AuthNet getInstance]; 

    [an setDelegate:self]; 

    CreditCardType *creditCardType = [CreditCardType creditCardType]; 
    creditCardType.cardNumber = @"4111111111111111"; 
    creditCardType.cardCode = CvvNumberTxt.text;//@"100"; 
    creditCardType.expirationDate = ExpiryDateTxt.text; //@"1218"; 



    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"; 


    CustomerDataType *c = [CustomerDataType customerDataType]; 
    c.type = @"Artist"; 
    c.email = @"[email protected]"; 


    CustomerAddressType *customerAddressType = [CustomerAddressType customerAddressType]; 
    customerAddressType.firstName = @"Abc"; 
    customerAddressType.lastName = @"Xyz"; 
    customerAddressType.country = @"India"; 
    customerAddressType.state = @"Delhi"; 
    customerAddressType.city = @"New Delhi"; 
    customerAddressType.phoneNumber = @"9999999999"; 


    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 = [NSMutableArray arrayWithObject:lineItem]; 
    requestType.amount = amountTxt.text; //@"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] identifierForVendor] UUIDString]; 


    request.anetApiRequest.merchantAuthentication.sessionToken = sessionToken; 
    [an purchaseWithRequest:request]; 

} 
+0

HI @Abhi我想在我的應用程序中使用authorise.net,但沒有獲取目標c中的代碼,請幫助 – Jason

+0

我遇到了與PHP API相同的問題。我找不到任何答案。 –

回答

1

我認爲你需要一個行添加到您的TransactionRequest號召下或接近零值

==== CUSTOMER BILLING INFORMATION === 
Customer ID : 
First Name : 
Last Name : 
Company : 
Address : 
City : 
State/Province : 
Zip/Postal Code : 
Country : 
Phone : 
Fax : 
E-Mail : 

我用下面的代碼requestType.shipping = extendedAmountTypeShipping;行:

requestType.billing = CustomerAddressType; 

我不是一個目標C程序員,我不熟悉他們的iOS API,但我忽略了與PHP API這同樣的事情。仔細檢查該requestType.billing的文檔。我只是猜對了!

相關問題