public static Tmsv2customersEmbeddedDefaultPaymentInstrument Run() { string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; string bankAccountType = "savings"; Tmsv2customersEmbeddedDefaultPaymentInstrumentBankAccount bankAccount = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBankAccount( Type: bankAccountType ); string buyerInformationCompanyTaxID = "12345"; string buyerInformationCurrency = "USD"; DateTime buyerInformationDateOfBirth = Convert.ToDateTime("2000-12-13"); List <Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationPersonalIdentification> buyerInformationPersonalIdentification = new List <Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationPersonalIdentification>(); string buyerInformationPersonalIdentificationId1 = "57684432111321"; string buyerInformationPersonalIdentificationType1 = "driver license"; string buyerInformationPersonalIdentificationIssuedByAdministrativeArea1 = "CA"; Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationIssuedBy buyerInformationPersonalIdentificationIssuedBy1 = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationIssuedBy( AdministrativeArea: buyerInformationPersonalIdentificationIssuedByAdministrativeArea1 ); buyerInformationPersonalIdentification.Add(new Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformationPersonalIdentification( Id: buyerInformationPersonalIdentificationId1, Type: buyerInformationPersonalIdentificationType1, IssuedBy: buyerInformationPersonalIdentificationIssuedBy1 )); Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformation buyerInformation = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBuyerInformation( CompanyTaxID: buyerInformationCompanyTaxID, Currency: buyerInformationCurrency, DateOfBirth: buyerInformationDateOfBirth, PersonalIdentification: buyerInformationPersonalIdentification ); string billToFirstName = "John"; string billToLastName = "Doe"; string billToCompany = "CyberSource"; string billToAddress1 = "1 Market St"; string billToLocality = "San Francisco"; string billToAdministrativeArea = "CA"; string billToPostalCode = "94105"; string billToCountry = "US"; string billToEmail = "*****@*****.**"; string billToPhoneNumber = "4158880000"; Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo billTo = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo( FirstName: billToFirstName, LastName: billToLastName, Company: billToCompany, Address1: billToAddress1, Locality: billToLocality, AdministrativeArea: billToAdministrativeArea, PostalCode: billToPostalCode, Country: billToCountry, Email: billToEmail, PhoneNumber: billToPhoneNumber ); string processingInformationBankTransferOptionsSeCCode = "WEB"; Tmsv2customersEmbeddedDefaultPaymentInstrumentProcessingInformationBankTransferOptions processingInformationBankTransferOptions = new Tmsv2customersEmbeddedDefaultPaymentInstrumentProcessingInformationBankTransferOptions( SECCode: processingInformationBankTransferOptionsSeCCode ); Tmsv2customersEmbeddedDefaultPaymentInstrumentProcessingInformation processingInformation = new Tmsv2customersEmbeddedDefaultPaymentInstrumentProcessingInformation( BankTransferOptions: processingInformationBankTransferOptions ); string instrumentIdentifierId = "A7A91A2CA872B272E05340588D0A0699"; Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier instrumentIdentifier = new Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier( Id: instrumentIdentifierId ); var requestObj = new PostCustomerPaymentInstrumentRequest( BankAccount: bankAccount, BuyerInformation: buyerInformation, BillTo: billTo, ProcessingInformation: processingInformation, InstrumentIdentifier: instrumentIdentifier ); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new CustomerPaymentInstrumentApi(clientConfig); Tmsv2customersEmbeddedDefaultPaymentInstrument result = apiInstance.PostCustomerPaymentInstrument(customerTokenId, requestObj); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); return(null); } }
public static Tmsv2customersEmbeddedDefaultPaymentInstrument Run() { string customerTokenId = "AB695DA801DD1BB6E05341588E0A3BDC"; string cardExpirationMonth = "12"; string cardExpirationYear = "2031"; string cardType = "001"; Tmsv2customersEmbeddedDefaultPaymentInstrumentCard card = new Tmsv2customersEmbeddedDefaultPaymentInstrumentCard( ExpirationMonth: cardExpirationMonth, ExpirationYear: cardExpirationYear, Type: cardType ); string billToFirstName = "John"; string billToLastName = "Doe"; string billToCompany = "CyberSource"; string billToAddress1 = "1 Market St"; string billToLocality = "San Francisco"; string billToAdministrativeArea = "CA"; string billToPostalCode = "94105"; string billToCountry = "US"; string billToEmail = "*****@*****.**"; string billToPhoneNumber = "4158880000"; Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo billTo = new Tmsv2customersEmbeddedDefaultPaymentInstrumentBillTo( FirstName: billToFirstName, LastName: billToLastName, Company: billToCompany, Address1: billToAddress1, Locality: billToLocality, AdministrativeArea: billToAdministrativeArea, PostalCode: billToPostalCode, Country: billToCountry, Email: billToEmail, PhoneNumber: billToPhoneNumber ); string instrumentIdentifierId = "7010000000016241111"; Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier instrumentIdentifier = new Tmsv2customersEmbeddedDefaultPaymentInstrumentInstrumentIdentifier( Id: instrumentIdentifierId ); var requestObj = new PostCustomerPaymentInstrumentRequest( Card: card, BillTo: billTo, InstrumentIdentifier: instrumentIdentifier ); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new CustomerPaymentInstrumentApi(clientConfig); Tmsv2customersEmbeddedDefaultPaymentInstrument result = apiInstance.PostCustomerPaymentInstrument(customerTokenId, requestObj); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); return(null); } }