public static PtsV2PaymentsPost201Response Run() { string clientReferenceInformationCode = "TC50171_3"; Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( Code: clientReferenceInformationCode ); string paymentInformationInstrumentIdentifierId = "7010000000016241111"; Ptsv2paymentsPaymentInformationInstrumentIdentifier paymentInformationInstrumentIdentifier = new Ptsv2paymentsPaymentInformationInstrumentIdentifier( Id: paymentInformationInstrumentIdentifierId ); Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( InstrumentIdentifier: paymentInformationInstrumentIdentifier ); string orderInformationAmountDetailsTotalAmount = "102.21"; string orderInformationAmountDetailsCurrency = "USD"; Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( TotalAmount: orderInformationAmountDetailsTotalAmount, Currency: orderInformationAmountDetailsCurrency ); Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( AmountDetails: orderInformationAmountDetails ); string tokenInformationNetworkTokenOption = "ignore"; Ptsv2paymentsTokenInformation tokenInformation = new Ptsv2paymentsTokenInformation( NetworkTokenOption: tokenInformationNetworkTokenOption ); var requestObj = new CreatePaymentRequest( ClientReferenceInformation: clientReferenceInformation, PaymentInformation: paymentInformation, OrderInformation: orderInformation, TokenInformation: tokenInformation ); 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); } }
public static PtsV2PaymentsPost201Response Run() { string clientReferenceInformationCode = "TC50171_3"; Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( Code: clientReferenceInformationCode ); List <string> processingInformationActionList = new List <string>(); processingInformationActionList.Add("TOKEN_CREATE"); List <string> processingInformationActionTokenTypes = new List <string>(); processingInformationActionTokenTypes.Add("paymentInstrument"); processingInformationActionTokenTypes.Add("shippingAddress"); bool processingInformationCapture = false; Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( ActionList: processingInformationActionList, ActionTokenTypes: processingInformationActionTokenTypes, Capture: processingInformationCapture ); string paymentInformationCardNumber = "4111111111111111"; string paymentInformationCardExpirationMonth = "12"; string paymentInformationCardExpirationYear = "2031"; string paymentInformationCardSecurityCode = "123"; Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard( Number: paymentInformationCardNumber, ExpirationMonth: paymentInformationCardExpirationMonth, ExpirationYear: paymentInformationCardExpirationYear, SecurityCode: paymentInformationCardSecurityCode ); string paymentInformationCustomerId = "AB695DA801DD1BB6E05341588E0A3BDC"; Ptsv2paymentsPaymentInformationCustomer paymentInformationCustomer = new Ptsv2paymentsPaymentInformationCustomer( Id: paymentInformationCustomerId ); Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( Card: paymentInformationCard, Customer: paymentInformationCustomer ); 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 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, Locality: orderInformationBillToLocality, AdministrativeArea: orderInformationBillToAdministrativeArea, PostalCode: orderInformationBillToPostalCode, Country: orderInformationBillToCountry, Email: orderInformationBillToEmail, PhoneNumber: orderInformationBillToPhoneNumber ); string orderInformationShipToFirstName = "John"; string orderInformationShipToLastName = "Doe"; string orderInformationShipToAddress1 = "1 Market St"; string orderInformationShipToLocality = "san francisco"; string orderInformationShipToAdministrativeArea = "CA"; string orderInformationShipToPostalCode = "94105"; string orderInformationShipToCountry = "US"; Ptsv2paymentsOrderInformationShipTo orderInformationShipTo = new Ptsv2paymentsOrderInformationShipTo( FirstName: orderInformationShipToFirstName, LastName: orderInformationShipToLastName, Address1: orderInformationShipToAddress1, Locality: orderInformationShipToLocality, AdministrativeArea: orderInformationShipToAdministrativeArea, PostalCode: orderInformationShipToPostalCode, Country: orderInformationShipToCountry ); Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( AmountDetails: orderInformationAmountDetails, BillTo: orderInformationBillTo, ShipTo: orderInformationShipTo ); bool tokenInformationPaymentInstrument_default = true; Ptsv2paymentsTokenInformationPaymentInstrument tokenInformationPaymentInstrument = new Ptsv2paymentsTokenInformationPaymentInstrument( _Default: tokenInformationPaymentInstrument_default ); bool tokenInformationShippingAddress_default = true; Ptsv2paymentsTokenInformationShippingAddress tokenInformationShippingAddress = new Ptsv2paymentsTokenInformationShippingAddress( _Default: tokenInformationShippingAddress_default ); Ptsv2paymentsTokenInformation tokenInformation = new Ptsv2paymentsTokenInformation( PaymentInstrument: tokenInformationPaymentInstrument, ShippingAddress: tokenInformationShippingAddress ); var requestObj = new CreatePaymentRequest( ClientReferenceInformation: clientReferenceInformation, ProcessingInformation: processingInformation, PaymentInformation: paymentInformation, OrderInformation: orderInformation, TokenInformation: tokenInformation ); 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); } }
public static PtsV2PaymentsPost201Response Run() { string clientReferenceInformationCode = "TC50171_3"; Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( Code: clientReferenceInformationCode ); string orderInformationAmountDetailsTotalAmount = "102.21"; string orderInformationAmountDetailsCurrency = "USD"; Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( TotalAmount: orderInformationAmountDetailsTotalAmount, Currency: orderInformationAmountDetailsCurrency ); string orderInformationBillToFirstName = "RTS"; string orderInformationBillToLastName = "VDP"; string orderInformationBillToAddress1 = "201 S. Division St."; string orderInformationBillToLocality = "Ann Arbor"; string orderInformationBillToAdministrativeArea = "MI"; string orderInformationBillToPostalCode = "48104-2201"; string orderInformationBillToCountry = "US"; string orderInformationBillToDistrict = "MI"; string orderInformationBillToBuildingNumber = "123"; string orderInformationBillToEmail = "*****@*****.**"; string orderInformationBillToPhoneNumber = "999999999"; Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo( FirstName: orderInformationBillToFirstName, LastName: orderInformationBillToLastName, Address1: orderInformationBillToAddress1, Locality: orderInformationBillToLocality, AdministrativeArea: orderInformationBillToAdministrativeArea, PostalCode: orderInformationBillToPostalCode, Country: orderInformationBillToCountry, District: orderInformationBillToDistrict, BuildingNumber: orderInformationBillToBuildingNumber, Email: orderInformationBillToEmail, PhoneNumber: orderInformationBillToPhoneNumber ); Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( AmountDetails: orderInformationAmountDetails, BillTo: orderInformationBillTo ); string tokenInformationTransientTokenJwt = "eyJraWQiOiIwN0JwSE9abkhJM3c3UVAycmhNZkhuWE9XQlhwa1ZHTiIsImFsZyI6IlJTMjU2In0.eyJkYXRhIjp7ImV4cGlyYXRpb25ZZWFyIjoiMjAyMCIsIm51bWJlciI6IjQxMTExMVhYWFhYWDExMTEiLCJleHBpcmF0aW9uTW9udGgiOiIxMCIsInR5cGUiOiIwMDEifSwiaXNzIjoiRmxleC8wNyIsImV4cCI6MTU5MTc0NjAyNCwidHlwZSI6Im1mLTAuMTEuMCIsImlhdCI6MTU5MTc0NTEyNCwianRpIjoiMUMzWjdUTkpaVjI4OVM5MTdQM0JHSFM1T0ZQNFNBRERCUUtKMFFKMzMzOEhRR0MwWTg0QjVFRTAxREU4NEZDQiJ9.cfwzUMJf115K2T9-wE_A_k2jZptXlovls8-fKY0muO8YzGatE5fu9r6aC4q7n0YOvEU6G7XdH4ASG32mWnYu-kKlqN4IY_cquRJeUvV89ZPZ5WTttyrgVH17LSTE2EvwMawKNYnjh0lJwqYJ51cLnJiVlyqTdEAv3DJ3vInXP1YeQjLX5_vF-OWEuZfJxahHfUdsjeGhGaaOGVMUZJSkzpTu9zDLTvpb1px3WGGPu8FcHoxrcCGGpcKk456AZgYMBSHNjr-pPkRr3Dnd7XgNF6shfzIPbcXeWDYPTpS4PNY8ZsWKx8nFQIeROMWCSxIZOmu3Wt71KN9iK6DfOPro7w"; Ptsv2paymentsTokenInformation tokenInformation = new Ptsv2paymentsTokenInformation( TransientTokenJwt: tokenInformationTransientTokenJwt ); var requestObj = new CreatePaymentRequest( ClientReferenceInformation: clientReferenceInformation, OrderInformation: orderInformation, TokenInformation: tokenInformation ); 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); } }
public static PtsV2PaymentsPost201Response Run() { string clientReferenceInformationCode = "TC50171_3"; Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( Code: clientReferenceInformationCode ); List <string> processingInformationActionList = new List <string>(); processingInformationActionList.Add("TOKEN_CREATE"); List <string> processingInformationActionTokenTypes = new List <string>(); processingInformationActionTokenTypes.Add("customer"); processingInformationActionTokenTypes.Add("paymentInstrument"); processingInformationActionTokenTypes.Add("shippingAddress"); bool processingInformationCapture = false; Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( ActionList: processingInformationActionList, ActionTokenTypes: processingInformationActionTokenTypes, Capture: processingInformationCapture ); 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 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, Locality: orderInformationBillToLocality, AdministrativeArea: orderInformationBillToAdministrativeArea, PostalCode: orderInformationBillToPostalCode, Country: orderInformationBillToCountry, Email: orderInformationBillToEmail, PhoneNumber: orderInformationBillToPhoneNumber ); string orderInformationShipToFirstName = "John"; string orderInformationShipToLastName = "Doe"; string orderInformationShipToAddress1 = "1 Market St"; string orderInformationShipToLocality = "san francisco"; string orderInformationShipToAdministrativeArea = "CA"; string orderInformationShipToPostalCode = "94105"; string orderInformationShipToCountry = "US"; Ptsv2paymentsOrderInformationShipTo orderInformationShipTo = new Ptsv2paymentsOrderInformationShipTo( FirstName: orderInformationShipToFirstName, LastName: orderInformationShipToLastName, Address1: orderInformationShipToAddress1, Locality: orderInformationShipToLocality, AdministrativeArea: orderInformationShipToAdministrativeArea, PostalCode: orderInformationShipToPostalCode, Country: orderInformationShipToCountry ); Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( AmountDetails: orderInformationAmountDetails, BillTo: orderInformationBillTo, ShipTo: orderInformationShipTo ); string tokenInformationTransientTokenJwt = "eyJraWQiOiIwOHAwWWVyTTBJSnpvYlpMMENyalVsRnQ4QXlIdXc4TSIsImFsZyI6IlJTMjU2In0.eyJkYXRhIjp7ImV4cGlyYXRpb25ZZWFyIjoiMjAyMyIsIm51bWJlciI6IjQxMTExMVhYWFhYWDExMTEiLCJleHBpcmF0aW9uTW9udGgiOiIwNyIsInR5cGUiOiIwMDEifSwiaXNzIjoiRmxleC8wOCIsImV4cCI6MTU5OTU2MDU3OSwidHlwZSI6Im1mLTAuMTEuMCIsImlhdCI6MTU5OTU1OTY3OSwianRpIjoiMUUyWjRMNjYxMENPSExHUUIxMlBXQk5OUjE1WFUwU1ROTTQ5UlA5WlJaUEtBVE1NOVo5UzVGNTc1QjgzNEFDOCJ9.Va9-Rf3nBtxHXVvb1M-mQqzOa86Uj5wY3qejFmYmMiSjMOSF_DpNepjOYat-8WqdacmhUemtwQfOtDEVDpd6X3YpBNydZ4dzVt3baq2Z1KAH1lEJxyvAyHX77tnO-wzfZrQm-HH-qtrGmt6ZvuNknvYPxwPcqnOryGaIQE70znBK6GVf3vgdE0xedxAQWl97ZfpZKafVjCvtGIMuJ0QdtrqM0OmtkoDKrqmXGzKlfSbpEep_yaDdpRkX_NdOgiVomRb3P6nqkT1OO0Czzu4HyxaMfVyCgGUAHd_SjXrwqM2vuchE4Scg1DicjWAJxXb_tZoAuUU0EN8HwVnrHiFAiQ"; Ptsv2paymentsTokenInformation tokenInformation = new Ptsv2paymentsTokenInformation( TransientTokenJwt: tokenInformationTransientTokenJwt ); var requestObj = new CreatePaymentRequest( ClientReferenceInformation: clientReferenceInformation, ProcessingInformation: processingInformation, OrderInformation: orderInformation, TokenInformation: tokenInformation ); 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); } }
public ActionResult Receipt() { dynamic flexObj = Request.Params["flexResponse"]; /** * Processing Authorization Request * Code developed from CyberSource Rest Samples csharp * https://github.com/CyberSource/cybersource-rest-samples-csharp */ var processingInformationObj = new Ptsv2paymentsProcessingInformation() { CommerceIndicator = "internet" }; var clientReferenceInformationObj = new Ptsv2paymentsClientReferenceInformation { Code = "test_payment" }; var orderInformationObj = new Ptsv2paymentsOrderInformation(); var billToObj = new Ptsv2paymentsOrderInformationBillTo { Country = "US", FirstName = "John", LastName = "Doe", Address1 = "1 Market St", PostalCode = "94105", Locality = "San Francisco", AdministrativeArea = "CA", Email = "*****@*****.**" }; orderInformationObj.BillTo = billToObj; var amountDetailsObj = new Ptsv2paymentsOrderInformationAmountDetails { TotalAmount = "102.21", Currency = "USD" }; orderInformationObj.AmountDetails = amountDetailsObj; // Passing Transient token var transientTokenObj = new Ptsv2paymentsTokenInformation { TransientTokenJwt = flexObj }; var requestObj = new CreatePaymentRequest { ProcessingInformation = processingInformationObj, ClientReferenceInformation = clientReferenceInformationObj, OrderInformation = orderInformationObj, TokenInformation = transientTokenObj }; try { var configDictionary = new Configuration().GetConfiguration(); var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); var apiInstance = new PaymentsApi(clientConfig); var result = apiInstance.CreatePayment(requestObj); Console.WriteLine(result); //Making response pretty & passing to page ViewBag.paymentResponse = result; } catch (Exception e) { Console.WriteLine("Exception on calling the API: " + e.Message); return(null); } return(View()); }