Integrate Stripe using the Anrok API


The core functions of Anrok are to calculate sales tax or VAT, track tax exposure, and remit taxes in registered jurisdictions. Anrok is designed to plug into a variety of billing systems, including Stripe. While Anrok’s out-of-the-box Stripe integration will cover a majority of the most common use cases, there are a few features that are only available when supplementing the Anrok Stripe integration with the Anrok API.



Overview of the Anrok platform

Anrok is a platform that supports software companies with end-to-end sales tax compliance, VAT, and comparable international taxes. To minimize your company’s out-of-pocket tax expenses and enable complete tax reporting and filing, Anrok needs to integrate with your billing system to enable three core pieces of functionality:

  • Calculating tax on transactions — so tax amounts can be shown to customers prior to being charged.
  • Collecting tax from customers — when invoicing or charging a payment method on file in your billing system.
  • Recording transactions in Anrok — to monitor tax thresholds and automate return filing to help you maintain tax compliance.

When we reference transactions throughout this article, we’re referring to invoices and credit notes (which should accompany refunds). Note that for sales tax compliance, invoicing rather than receiving payment is the trigger for tax liability.

The following transaction-level data and Anrok account-level configurations are particularly relevant for tax calculation:

Stripe transaction-level data important for tax calculation

  • Customer addresses — Anrok is designed to be flexible around address requirements, but at minimum, we typically need the country and either zip code or city/state of the customer to complete tax calculation. When addresses are stored in the billing system, we’ll look at various sources, including the billing and shipping address on invoices, addresses on the customer record, and even the zip code associated with credit card payments, to try to determine the appropriate taxable jurisdiction(s). See Address information required for transactions.
  • Line-item details — Transaction tax rates can vary by line item based on the products being sold. When calculating tax, Anrok expects line item details, including quantity, amount, and product purchased, to be present. Any product IDs will need to be configured in Anrok ahead of time so that the appropriate tax configuration can be applied. See Set up your product IDs.
  • VAT IDs — If your company sells to businesses in the EU, UK, Canada, or other countries outside the U.S., your customers may have VAT IDs that affect the amount of tax that you should collect on their transactions. Anrok validates VAT IDs and calculates tax accordingly based on the validity of the numbers provided. In Stripe, VAT IDs can be added as a Tax ID on the customer profile and will then be applied to all of the customer's transactions. See Add VAT IDs to your customer profiles in Stripe.
  • Exemption status — If your company works with customers that are tax-exempt (e.g. non-profit organizations, public schools, religious organizations, resellers, etc.), an indication of tax-exempt status should be provided to Anrok prior to invoicing the customer. This can be done by uploading a Certificate to Anrok that matches the customer’s profile in your billing system. See Add a sales tax exemption certificate.

Anrok account-level configurations important for tax calculation

  • Product IDs — During integration set-up, you’ll configure your billing system product codes to align with Anrok’s tax categories. This determines the taxability and rates applied to invoices, including those products. See Set up your product IDs.
  • Registrations — In the Anrok platform, you can indicate where you’re currently collecting and remitting tax and elect to register and enable new jurisdictions. Anrok will only calculate tax amounts for transactions associated with jurisdictions where you’re set up to collect and remit tax. See Register in a jurisdiction.



Integration functionality

Anrok has integrations with many common billing systems that are designed to provide core components of the functionality described above. For Stripe, Anrok’s integrations provide a variety of essential features required for invoicing and creating credit notes.

However, due to limitations in the Stripe platform, there are a few features that require companies to integrate with our API in addition to utilizing our “out-of-the-box” integration functionality, namely: 

CleanShot 2024-01-24 at 13.44.43@2x.png


Optional API development

The development work for integrating Stripe using the Anrok API is optional, and your company can achieve full compliance in most cases without these additional features. The side effect is that some portion of tax owed may go uncollected from customers and must be paid out-of-pocket. The volume of your transactions affected by this scenario will be determined by:

  1. Whether you offer customers free trials.
  2. Your number of remitting jurisdictions.
  3. The portion of revenue that these invoices represent.

Operational alternatives, such as applying price changes at the end of the billing cycle, can also help minimize uncollected tax without requiring development work. Additionally, some customers may see a change in the amount paid between their first purchase and subsequent charges.

If you've decided to move forward with implementing the Anrok API, we recommend the following modification to your Stripe integration:

Recommended back-end modifications to your Stripe integration

  • Use the /createEphemeral endpoint to calculate tax as the customer enters their address, VAT ID, & exemption information in the checkout flow, recalculating as relevant.
  • If using Stripe Checkout, collect the customer’s address prior to instantiating the Checkout session and create a customer in Stripe with the address provided (This will prevent the user from having to provide their address twice.) Calculate tax as described above, then pass the tax amount as a line item when creating the Checkout session. Alternatively, switching to a more modular checkout flow will provide more flexibility by enabling the Anrok API to be called at the appropriate times.
  • Specify the first invoice’s tax using the “add_invoice_items” parameter when creating subscriptions in Stripe. (If the subscription includes a free trial, no modification is needed.)
  • Include tax when updating subscriptions in Stripe if charging the customer immediately. (No modification is needed if the change takes effect at the end of the billing cycle rather than through a pro-rated charge.)
  • Ensure all invoices use defined Stripe products rather than generating one-off product IDs. Otherwise, a default product will need to be set up in Anrok.

Recommended front-end modifications to your Stripe integration

  • Require the user to input their country and zip code, at minimum. The more address information you collect, the more accurate and robust your tax calculations will be.
  • Surface error messages if tax calculation fails, especially due to invalid user input.
  • Offer the user the ability to input a VAT ID and/or indicate that they are tax exempt (e.g. by uploading a Certificate and inputting the relevant details).



Planning your API implementation

All Anrok customers get access to our Onboarding, Support, & Tax teams to assist you in getting compliant with sales tax/VAT and in transitioning to the Anrok platform. Customers on Anrok's Core and Growth plans will also have access to technical support and consultations with our Solutions Engineering team throughout the implementation process, as well as testing recommendations, launch planning, and ongoing support for our API.

These additional resources can provide guidance for implementing the Anrok API:

Can't find what you're looking for?

Submit a request to our customer care team!