Payment 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 administration interface, 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 the Payment Method editor.

The Service Properties available will vary depending on the payment service selected.

PropertyDescriptionRequired

Public Key

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

Secret Key

The user-specific secret key for Stripe. 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 editor.

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