Stripe Provider Integration

How to get started with payment provider integrations.

Stripe

Installing the integration

  • Install the Ucommerce.Payments.Stripe NuGet package.

  • Add the Stripe integration to the program.cs file to use the default Stripe implementation:

Program.cs
        services.AddUcommerce()    
            .AddBackOffice()
            .AddPayments()
            .AddStripe()
        
        app.UseUcommerce()
            .UseBackOfficeUi()
            .UsePayments()
            .UseStripe("OptionalCallbackUri");

OptionalCallbackUri is the URI where the Stripe webhook should be pointed to later. If left without a value, the default endpoint will be:{yourDomain}/Stripe/process/callback

Stripe is now available as a payment method service. It can now be selected for new and existing payment methods.

Creating a Payment Method

  • In the back office UI, navigate to Settings -> Payment Methods.

  • Click New to create a new payment method.

  • Select Stripe as the service.

Configuring Stripe

Connect the payment method to a Stripe account by filling out the Service properties section in UI.

The service properties available will vary depending on the payment service selected.

PropertyDescriptionRequired

Public Key

The account-specific public key for the Stripe account. It can be found in the Stripe Developer Dashboard.

Secret Key

The account-specific secret key for the Stripe account. It can be found in the Stripe Developer Dashboard.

Webhook Secret

The webhook-specific key. It is set up in the Stripe Developer Dashboard.

Success URL

The partial route that the user is navigated to on a successful purchase.

Cancel URL

The partial route that the user is navigated to on an unsuccessful purchase.

The keys can be found on the Stripe Developer Dashboard located here. When setting up the webhook, remember to point it to the webhook set on startup.

Once configured, the payment method can be enabled by flipping the Enabled toggle in the UI.

When testing the Stripe integration, the Stripe CLI can greatly help. If testing is done on a local machine using localhost, a tunneling service can be used as a proxy.

Last updated