public static PtsV2PaymentsPost201Response Run() { SampleCode.TimeoutVoidTransactionId = NumericUtility.LongRandom(1000, 1000000000 + 1); string clientReferenceInformationCode = "TC50171_3"; string clientReferenceInformationTransactionId = SampleCode.TimeoutVoidTransactionId; Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( Code: clientReferenceInformationCode, TransactionId: clientReferenceInformationTransactionId ); bool processingInformationCapture = true; string processingInformationCommerceIndicator = "internet"; Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( Capture: processingInformationCapture, CommerceIndicator: processingInformationCommerceIndicator ); string paymentInformationCardNumber = "4111111111111111"; string paymentInformationCardExpirationMonth = "12"; string paymentInformationCardExpirationYear = "2031"; string paymentInformationCardSecurityCode = "123"; Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard( Number: paymentInformationCardNumber, ExpirationMonth: paymentInformationCardExpirationMonth, ExpirationYear: paymentInformationCardExpirationYear, SecurityCode: paymentInformationCardSecurityCode ); Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( Card: paymentInformationCard ); string orderInformationAmountDetailsTotalAmount = "102.21"; string orderInformationAmountDetailsCurrency = "USD"; Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( TotalAmount: orderInformationAmountDetailsTotalAmount, Currency: orderInformationAmountDetailsCurrency ); string orderInformationBillToFirstName = "John"; string orderInformationBillToLastName = "Doe"; string orderInformationBillToAddress1 = "1 Market St"; string orderInformationBillToAddress2 = "Address 2"; string orderInformationBillToLocality = "san francisco"; string orderInformationBillToAdministrativeArea = "CA"; string orderInformationBillToPostalCode = "94105"; string orderInformationBillToCountry = "US"; string orderInformationBillToEmail = "*****@*****.**"; string orderInformationBillToPhoneNumber = "4158880000"; Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo( FirstName: orderInformationBillToFirstName, LastName: orderInformationBillToLastName, Address1: orderInformationBillToAddress1, Address2: orderInformationBillToAddress2, Locality: orderInformationBillToLocality, AdministrativeArea: orderInformationBillToAdministrativeArea, PostalCode: orderInformationBillToPostalCode, Country: orderInformationBillToCountry, Email: orderInformationBillToEmail, PhoneNumber: orderInformationBillToPhoneNumber ); Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( AmountDetails: orderInformationAmountDetails, BillTo: orderInformationBillTo ); var requestObj = new CreatePaymentRequest( ClientReferenceInformation: clientReferenceInformation, ProcessingInformation: processingInformation, PaymentInformation: paymentInformation, OrderInformation: orderInformation ); try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new PaymentsApi(clientConfig); PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj); Console.WriteLine(result); return(result); } catch (Exception e) { Console.WriteLine("Exception on calling the API : " + e.Message); return(null); } }