From d0690a3b5a3420b74924afe3ba6b4d76633b88cc Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Mon, 26 Feb 2024 15:15:43 -0600 Subject: [PATCH] Add Check Connected Stripe Account Name as a Unix TIL --- README.md | 3 ++- unix/check-connected-stripe-account-name.md | 30 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 unix/check-connected-stripe-account-name.md diff --git a/README.md b/README.md index dd3d878..c2940ea 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1380 TILs and counting..._ +_1381 TILs and counting..._ --- @@ -1295,6 +1295,7 @@ _1380 TILs and counting..._ - [Cat Files With Color Using Bat](unix/cat-files-with-color-using-bat.md) - [Change Default Shell For A User](unix/change-default-shell-for-a-user.md) - [Change To That New Directory](unix/change-to-that-new-directory.md) +- [Check Connected Stripe Account Name](unix/check-connected-stripe-account-name.md) - [Check If A Port Is In Use](unix/check-if-a-port-is-in-use.md) - [Check If Command Is Executable Before Using](unix/check-if-command-is-executable-before-using.md) - [Check SSH Key Fingerprints Of Known Hosts](unix/check-ssh-key-fingerprints-of-known-hosts.md) diff --git a/unix/check-connected-stripe-account-name.md b/unix/check-connected-stripe-account-name.md new file mode 100644 index 0000000..9de781b --- /dev/null +++ b/unix/check-connected-stripe-account-name.md @@ -0,0 +1,30 @@ +# Check Connected Stripe Account Name + +With the Stripe CLI, you can be connected one specific account at a time. When +you run `stripe login`, the browser window where you authenticate will have you +select the account that you want to connect to. This is important because it +impacts test keys, webhooks, where you are sending events, etc. + +To check which account you are connected to, you can look in the Stripe config +file for the `display_name`. This is located at `~/.config/stripe/config.toml`. +You can have the Stripe CLI spit out the contents of that file with: + +```bash +$ stripe config --list +color = '' +[default] +account_id = 'acct_123abc' +device_name = 'My-MacBook-Pro.local' +display_name = 'Internet Business' +... +``` + +Let's take this a step further. Here is a one-liner scripted version to check +this value using `grep`, `awk`, and `xargs`: + +```bash +$ stripe config --list | grep '^display_name' | awk -F'=' '{print $2}' | xargs +Internet Business +``` + +The `awk` command is tailored toward parsing a value from a `toml` file.