protected async Task <SessionResponse> CreateHostedSession() { var shippingAddress = new SessionAddress { AddressLine1 = "Checkout.com", AddressLine2 = "90 Tottenham Court Road", City = "London", State = "ENG", Country = CountryCode.GB, Zip = "W1T 4TJ" }; var sessionRequest = new SessionRequest { Source = new SessionCardSource { ExpiryMonth = 1, ExpiryYear = 2030, Number = "4485040371536584" }, Amount = 100L, Currency = Currency.USD, ProcessingChannelId = "pc_5jp2az55l3cuths25t5p3xhwru", AuthenticationType = AuthenticationType.Regular, AuthenticationCategory = Category.Payment, ChallengeIndicator = ChallengeIndicatorType.NoPreference, Reference = "ORD-5023-4E89", TransactionType = TransactionType.GoodsService, ShippingAddress = shippingAddress, Completion = new HostedCompletionInfo { FailureUrl = "https://example.com/sessions/fail", SuccessUrl = "https://example.com/sessions/success", } }; return(await Retriable( async() => await DefaultApi.SessionsClient().RequestSession(sessionRequest, CancellationToken.None), HasSessionAccepted)); }
protected async Task <SessionResponse> CreateNonHostedSession(ChannelData channelData, Category authenticationCategory, ChallengeIndicatorType challengeIndicator, TransactionType transactionType) { var billingAddress = new SessionAddress { AddressLine1 = "CheckoutSdk.com", AddressLine2 = "90 Tottenham Court Road", City = "London", State = "ENG", Country = CountryCode.GB }; var source = new SessionCardSource { Number = TestCardSource.Visa.Number, ExpiryMonth = TestCardSource.Visa.ExpiryMonth, ExpiryYear = TestCardSource.Visa.ExpiryYear, Name = "John Doe", Email = GenerateRandomEmail(), BillingAddress = billingAddress, HomePhone = GetPhone(), MobilePhone = GetPhone(), WorkPhone = GetPhone() }; var shippingAddress = new SessionAddress { AddressLine1 = "Checkout.com", AddressLine2 = "ABC building", AddressLine3 = "14 Wells Mews", City = "London", State = "ENG", Zip = "W1T 4TJ", Country = CountryCode.GB }; var sessionRequest = new SessionRequest { Source = source, Amount = 6540L, Currency = Currency.USD, ProcessingChannelId = "pc_5jp2az55l3cuths25t5p3xhwru", Marketplace = new SessionMarketplaceData { SubEntityId = "ent_ocw5i74vowfg2edpy66izhts2u" }, AuthenticationCategory = authenticationCategory, ChallengeIndicator = challengeIndicator, BillingDescriptor = new SessionsBillingDescriptor { Name = "SUPERHEROES.COM" }, Reference = "ORD-5023-4E89", TransactionType = transactionType, ShippingAddress = shippingAddress, Completion = new NonHostedCompletionInfo { CallbackUrl = "https://merchant.com/callback" }, ChannelData = channelData }; return(await Retriable( async() => await DefaultApi.SessionsClient().RequestSession(sessionRequest, CancellationToken.None), HasSessionCreated)); }