Stripe has many third party integrations, many of which can be seen on their Apps and Extensions page. Each time a payment is made within Stripe, it has a reference to the app that created it. For example, payments created by Astral Pay contain a unique reference pointing to the Astral Pay app.
Whilst building Astral Pay, we understood that some users may simply need a means of bringing payments into Business Central, and do not necessarily need an app that can create the payments. For this reason, we added some ‘Premium’ functionality that can bring payments in from other applications.
Astral Pay is notified of payments via the webhooks which come in to Astral Pay as ‘Notifications’. These notifications simply tell Astral Pay that an Object Type and Object ID has been created or amended. Astral Pay then makes a webservice call to the Stripe api to get the data, and the data returned (if it is a payment_intent or a charge) will specify the Application ID that created it.
Astral Pay keeps a log of all of the Application IDs that have been used on your Merchant Account, and if a new ID is found, a message will appear in the Business Central notification toolbar.
Figure 1 | Business Central Notification
If you have purchased a ‘Premium’ licence of Astral Pay, you can configure the ‘Stripe Partner Application’ to create customers and payments within Business Central.
An example of an Application is the Stripe Portal itself. Any payments that are created directly in the Stripe Portal have an unspecified Application ID. Therefore, you can configure Astral Pay to bring in payments created within the portal to Business Central.
To start, after seeing the ‘A new Stripe Partner Application has been recognised…..’ notification open the ‘Stripe Partner Application’ page, either by clicking the ‘Open Stripe Partner Application Page’ link in the notification, or by selecting the ‘Stripe Partner Applications’ action from the Role Centre.
Figure 2 | Role Center - Stripe Partner Applications
If a third-party application has been recognised and you want to enable it for integration, it will appear in the list.
Figure 3 | Stripe Partner Applications
Click the ‘Edit List’ action and specify the following fields:
You must set the other fields prior to enabling this field. Placing a tick in this field will mean that Astral Pay will try to bring Stripe ‘Charges’ in to the system. It will create a ‘Payment Batch’ and a ‘Payment Entry’ and will also create a ‘Transaction’ and attempt to post it. Depending on the configuration of the other fields, it may create a new customer.
Place a tick in this field if you want to use a single Business Central Customer to record the payment to. It possibly makes less sense to use this for the ‘Stripe Portal’, but perhaps if the Partner App was a website then you may want to record the payments to a Generic Customer called ‘WEBSHOP’.
If you have enabled ‘Use Generic Customer’, you must define the customer here. As discussed in an example above, this is where you would enter ‘WEBSHOP’.
If you do not want to use a Generic Customer for charges created by this Stripe Partner Application, it will create a new Business Central customer for you. It will generate a Customer No. based on the ‘No. Series’ specified. Configuring and using a ‘No. Series’ is standard functionality in Business Central, and so we will not discuss any further how this functionality works.
If ‘Use Generic Customer’ is not enabled, a new customer will be created. This field specifies the template that will be used to create the customer.
If the Stripe Partner Application uses the Metadata area to store a reference to the customer, this field points to the ‘Key’ name that the application uses to store the reference. For example, if the Partner Application is a webshop that integrates to Stripe, when creating customers it may use the Metadata as follows:
In this example, we would enter ‘webshop_cust_ID’ in to the ‘Stripe Customer Metadata Tag’ field. Astral Pay will then search the Customer Metadata area for the key called ‘webshop_cust_ID’, retrieve the value ‘WSCUS_001’ from the key and will map the Stripe customer ‘cus_JXlmoaVka5kHjV’ to the Business Central customer with a No. of WSCUS_001. Note that this integration expects that the Business Central Customer already exists in Business Central, perhaps being created by the webshop using the Business Central api.
As mentioned above, ‘Astral Pay’ will receive notifications about all payments in the Stripe Merchant Account that it is connected to and will log the Stripe Partner Applications used on the account. As integration is not enabled, it will then flag the Notification with a processing error.
Figure 5 | Notification Error
Ticking the ‘Set Notification Errors to Processed’ field will not raise the error, and the Notifications received about charges created by this Stripe Partner Application will be marked as processed, not requiring further action.
Should the Stripe Partner Application generate ‘charges’ in multiple currencies, it could be, for example, that you want to use a different ‘Generic Customer’ for each currency. For this reason, selecting ‘Currency’ from the ‘Stripe Partner Application’ page will allow you to configure the integration on a per currency basis
Figure 6 | Stripe Partner Application Page
Figure 7 | Stripe Partner Application Per Currency
Note that if you configure the integration on a per currency basis, and the ‘charge’ being processed uses the currency, it will only use the values from the fields specified against the currency. For example, if you do not place a value in the ‘Stripe Customer Metadata Tag’ field against the currency, it will NOT try to use the value specified from the non-currency specific setup.