<commit_before>Title: Stripe API with ASP.NET Core - Part 1 Setup and Configuration
Lead: Integrating Stripe with ASP.NET Core to provide secure invoicing and subscription processing
Published: 3/20/2019 11:00
Tags:
    - ASP.NET Core 2.2
    - Stripe
    - Stripe.net
    - Payment
---

In this blog post I want to show how I integrated [Stripe](https://stripe.com), a very popular and well known payment gateway, into an ASP.NET Core MVC Application. The application that I have built offers three subscription plans: Basic, Professional and Enterprise. Depending on the subscription plan selected at sign up, the user will get billed automatically every month, as long as they have an active account. This is the first part that will show how I setup Stripe and how to interact with the API.

- Part 1: Setup and Configuration - This blog post
- Part 2: Subscribe to a subscription - Work in progress
- Part 3: Stripe WebHooks - Work in progress

## Stripe

Stripe is very popular not only because of their well documented APIs, simple and straight forward approach for developers, but also because of their clear [pricing model](https://stripe.com/de/pricing).

> We have to watch out here: we are working with very sensitive data (Credit card numbers and other personal information), to be allowed to receive and store that data on my server, I would need to be [PCI Compliant](https://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Security_Standard). But this is not an easy task for small companies or a single person. Most payment gateways offer a solution for this: As an application developer you display the order details to the customer and if they agree to purchase, they get redirected to a page hosted by the payment gateway. After the purchase is complete the customer gets redirected back.

Stripe offers multiple ways on handling credit card and user information. The one I will take a look at is using their JavaScript API. By using this API we can send the credit card information directly to the Stripe's servers, and we will only receive a token. That we can then use in our backend to make the purchase. With this in place we will not need to be PCI Compliant because we are only working with that special token from Stripe.

## Setup Stripe

First we need to create a Stripe Account. Go to [https://stripe.com](https://stripe.com) and register for a new account.

All we need from the Dashboard is the `SecretKey` and the `PublishableKey`, copy them for later. You can also create a custom restricted key for your application. Just make sure to select the proper permissions that are required. If not the API will reject the calls.<commit_msg>Stripe (#52)<commit_after>Title: Stripe API with ASP.NET Core - Part 1 Setup and Configuration
Lead: Integrating Stripe with ASP.NET Core to provide secure invoicing and subscription processing
Published: 3/21/2019 16:15
Tags:
    - ASP.NET Core 2.2
    - Stripe
    - Stripe.net
    - Payment
---

In this blog post I want to show how I integrated [Stripe](https://stripe.com), a very popular and well known payment gateway, into an ASP.NET Core MVC Application. The application that I have built offers three subscription plans: Basic, Professional and Enterprise. Depending on the subscription plan selected at sign up, the user will get billed automatically every month, as long as they have an active account. This is the first part that will show how I setup Stripe and how to interact with the API.

- Part 1: Setup and Configuration - This blog post
- Part 2: Subscription handling - Work in progress
- Part 3: WebHooks - Work in progress

## Stripe

Stripe is very popular not only because of their well documented APIs, simple and straight forward approach for developers, but also because of their clear [pricing model](https://stripe.com/de/pricing).

> We have to watch out here: we are working with very sensitive data (Credit card numbers and other personal information), to be allowed to receive and store that data on my server, I would need to be [PCI Compliant](https://en.wikipedia.org/wiki/Payment_Card_Industry_Data_Security_Standard). But this is not an easy task for small companies or a single person. Most payment gateways offer a solution for this: As an application developer you display the order details to the customer and if they agree to purchase, they get redirected to a page hosted by the payment gateway. After the purchase is complete the customer gets redirected back.

Stripe offers multiple ways on handling credit card and user information. The one I will take a look at is using their JavaScript API. By using this API we can send the credit card information directly to the Stripe's servers, and we will only receive a token. That we can then use in our backend to make the purchase. With this in place we will not need to be PCI Compliant because we are only working with that special token provided by Stripe.

## Setup Stripe

First we need to create a Stripe Account. Go to [https://stripe.com](https://stripe.com) and register for a new account.

All we need from the Dashboard is the `SecretKey` and the `PublishableKey`, copy them for later. You can also create a custom restricted key for your application. Just make sure to select the proper permissions that are required. If not the API will reject the calls.
{'fraction_non_alphanumeric': 0.04594037127320458, 'fraction_numerical': 0.006750421901368836, 'mean_word_length': 4.148648648648648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3012313', 'n_tokens_mistral': 1343, 'n_tokens_neox': 1258, 'n_words': 832}