2016-11-11 2 views
0

zu autorisieren, zu erfassen und ungültig zu machen. Für Kunden mit bestehender Zahlungsprofil-ID (gespeicherte Kreditkarte) verwenden wir "createCustomerProfileTransactionController" wie folgt zur Autorisierung.Authorized.net - Can createTransactionRequest kann verwendet werden, um eine Transaktion für bestehende Zahlungsprofil-ID

Und für Kunden ohne bestehende Zahlung Profil ID wir verwenden "createTransactionRequest" wie folgt für die Autorisierung.

public createTransactionResponse AuthorizeOneTimePayment(Card cardInfo, decimal amount) 
     { 
      createTransactionResponse response = null; 
      ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = environment; 

      //define the merchant information (authentication/transaction id) 
      ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType() 
      { 
       name = apiLoginID, 
       ItemElementName = ItemChoiceType.transactionKey, 
       Item = apiTransactionKey, 
      }; 

      var creditCard = new creditCardType 
      { 
       cardNumber = cardInfo.CardNumber,// "4111111111111111", 
       expirationDate = cardInfo.ExpirationDate// "0718" 
       //cardCode=cardInfo.VerificationCode 
      }; 

      //standard api call to retrieve response 
      var paymentType = new paymentType { Item = creditCard }; 

      string firstName = string.Empty; 
      string lastName = string.Empty; 

      if (!string.IsNullOrWhiteSpace(cardInfo.BillingName)) 
      { 
       string[] name = GetBillName(cardInfo.BillingName); 
       firstName = name[0]; 
       lastName = name[1]; 
      } 

      var transactionRequest = new transactionRequestType 
      { 
       transactionType = transactionTypeEnum.authOnlyTransaction.ToString(), // authorize only 
       amount = amount, 
       payment = paymentType, 
       billTo = new customerAddressType 
       { 
        firstName = firstName, 
        lastName = lastName, 
        address = cardInfo.BillingAddress, 
        city = cardInfo.BillingCity, 
        state = cardInfo.BillingState, 
        zip = cardInfo.BillingZipCode 
       } 
      }; 

      var request = new createTransactionRequest { transactionRequest = transactionRequest }; 

      // instantiate the controller that will call the service 
      var controller = new createTransactionController(request); 
      controller.Execute(); 

      // get the response from the service (errors contained if any) 
      response = controller.GetApiResponse(); 

      return response; 

     } 

Und die gleiche Technik für die Erfassung und eine Transaktion ungültig.

Meine Frage ist, können wir "createTransactionRequest" für alle Transaktionen wie autorisieren, erfassen und stornieren eine Transaktion für beide Kunden mit Zahlungsprofil-ID und einmal Kunde.

Ich könnte jeden Hinweis in authorize.net on line Dokumentation finden. Bitte leiten Sie uns, wie das geht.

Antwort

1

Ja, Sie können createTransactionRequest für Auth/Capture, Auth Only, Prior Auth und Capture, Void und Refund verwenden, indem Sie transactionRequestType und paymentType ändern.

+0

Danke, kann es für bestehende Zahlung Profil-ID verwendet werden, wie? –

Verwandte Themen