loading...

. . . . . .

Let’s make something together

KAISPE has been providing solutions and services to customers using Microsoft Dynamics, Azure, Power platform, Oracle NetSuite, mobile and web app development.

    • US OFFICE
    • +1 315 791 4472
    • KAISPE LLC
      590 Madison Avenue 21st Floor Manhattan, NY 10022 USA.

 

  • PAKISTAN OFFICE
  • +92 213 432 6085
  • M/S KAISPE
    Suite#213 Sumya Business Avenue MACHS Karachi, Pakistan.

Boosting Efficiency with Third-Party Integration: How to Integrate Stripe Payment Gateway with Business Central

  • February 20, 2023
  • 918 Views

Integrating third-party solutions into your business processes can greatly enhance your overall efficiency and productivity. In this blog post, we’ll show you how to integrate the Stripe payment gateway with Business Central. Whether you’re a tech-savvy developer or a business owner looking for a simpler payment process, we’ll guide you through the integration process step by step.


Creating a Stripe Account and Testing the Checkout Functionality

To start accepting payments through Stripe, the first thing we need to do is create a Stripe account. We can do this by visiting the Stripe website and following the registration process. Once we have our account set up, we can access our API keys, which we’ll need to integrate Stripe with our Business Central application.

Next, we want to make sure everything is working properly by testing the checkout functionality using a tool called Postman. Postman lets us test REST APIs, including the Stripe API. We’ll send all the required parameters to the Stripe API and check the response to make sure everything is working as expected. This step is important because it helps us catch any issues early on and ensures that the checkout process is working smoothly.

When we test the checkout functionality, we’ll receive a checkout URL in response. We can use this URL to check the parameters that were passed in Postman. Later in development, we’ll use the redirect URL that we receive in response to complete the integration.

To complete the checkout process, we’ll need to enter card details, such as card information, name, email, and so on. During development, we can use Stripe’s test card details to make things easier. Once we add the payment information, we can proceed to make the payment and we’ll be redirected to the success URL.


Creating Test Pages and Tables in Business Central

Now that we’ve tested the Stripe checkout, we can move on to creating the test pages and tables in Business Central. This will allow us to simulate a real transaction and make sure our integration with Stripe is working properly.

To begin, we’ll create a table called “PaymentGatewayTestTable.” This table should include important fields such as the CancelURL, SuccessURL, Line Amount, Item Name, Quantity, Currency, Payment Mode, and Payment Method. These fields will allow us to track and manage the transaction data within Business Central.

Next, we’ll create a list page to display the transaction data. This page includes the fields Product Name and Quantity.

Finally, we’ll create a card page to link to our list page. This page should include the same fields as the list page and will allow us to edit and update individual transactions. With these pages in place, we’ll be able to test our Stripe integration in a real-world scenario and make sure everything is working as intended.


Creating an Action Button and Codeunit to Handle Payment Requests and Responses

After setting up the necessary pages and tables, we need to create an action button and codeunit to handle payment requests and responses from the Stripe API.

To begin, we create an action button and pass the current record to our payment gateway codeunit. This codeunit contains the necessary methods to communicate with the Stripe API when the action is triggered.

Within the codeunit, we define the StripeAPI() method to take the parameters from the current record and encode them into a URL using the Type Helper codeunit. We authenticate using our API key (secret key) and use the POST method to send the request to the Stripe API, with the response being saved in a variable for later use.

The checkout URL is extracted from the response, and the user is then redirected to the checkout page to complete the payment process.

Once the codeunit and action method are set up, we can build and test our project.

Starting from the list page, we can create a new record to pay and move on to the card page to add all the necessary parameters and checkout, where we can see the checkout button.

Clicking on the checkout button redirects us to the Stripe checkout URL. In test mode, we can use the provided test card details to complete the payment.

We have now successfully integrated Stripe checkout functionality into our application. This is just the test page and record. We can set it up as the default payment gateway for our sales/purchase invoices, and other business central transactions.

If you have any other questions or concerns, please don’t hesitate to let me know. Your feedback is always valuable to us, so if you have any suggestions, feel free to leave a comment below.

And if you need any further assistance, feel free to Contact us or email us at [email protected].

Thank you for reading!

Best regards, Govinda Kumar