Payment Gateway Stripe Helper
PaymentGateway Stripe Helper
The ADS.PaymentGateway.Stripe library provides functionality for handling payment processing through Stripe. It includes a class for managing Stripe Checkout sessions, allowing seamless integration with the Stripe payment gateway.
Service: PaymentGatewaySession
The PaymentGatewaySession service is responsible for creating and managing Stripe Checkout sessions.
-
CreateCheckoutSession
Description
Creates a new Checkout session on Stripe. Parameters
-
request (CreateCheckoutSessionRequest): The request object containing data required to create the session.
Returns
-
Task<string>: A task that returns the Stripe session ID upon completion.
Example Usage
var request = new CreateCheckoutSessionRequest \{ SuccessUrl = "https://example.com/success", FailureUrl = "https://example.com/failure", PaymentMethodTypes = new List\<string\> { "card" \}, BillingAddressCollection = "required", AllowPromotionCodes = true, Name = "Premium Subscription", PriceDescription = "Access to all premium features", Currency = "USD", PriceAmount = 49.99M }; string sessionId = await PaymentGatewaySession.CreateCheckoutSession(request);
-
ConfigureRequest (Private Method)
Description
Configures the options for creating a new Stripe Checkout session. Parameters
-
request (CreateCheckoutSessionRequest): The request object containing details for the session.
Returns
-
SessionCreateOptions: The configured Stripe session options.
Functionality
-
Sets SuccessUrl and CancelUrl with the session ID appended as a query parameter.
-
Configures Mode as "payment".
-
Sets accepted PaymentMethodTypes.
-
Specifies whether BillingAddressCollection is required.
-
Enables the use of promotion codes if allowed.
-
Creates a single LineItem for the transaction, including product details, currency, and amount.