Introduction to the Stripe CLI

Поділитися
Вставка
  • Опубліковано 16 бер 2020
  • In this edition of Stripe Developer Office Hours, follow along as CJ Avilla walks through the fundamentals of using the Stripe Command Line Interface, or simply “the CLI”. We cover getting started, using multiple API commands, how to test webhooks, and more.
    Resources
    - Full Reference: stripe.com/docs/cli
    - Download the Stripe CLI: github.com/stripe/stripe-cli
    - Using the Stripe CLI: stripe.com/docs/stripe-cli
    - jq: stedolan.github.io/jq/
    Table of contents
    01:35 - Installation
    02:32 - Getting started
    02:34 - `stripe`
    03:00 - `stripe -v`
    03:21 - `stripe status`
    03:34 - Connecting to your Stripe account
    04:42 - `stripe plans list`
    04:54 - `stripe config`
    05:26 - Connecting a second Stripe account
    07:00 - API Resource Commands
    07:15 - Create a Customer and subscribe them to a Plan
    15:07 - Pairing Stripe CLI with jq
    17:28 - Webhook Commands
    18:13 - `stripe listen`
    21:00 - `stripe trigger`
    25:36 - Forwarding events to local webhook handler
    27:40 - Resending events
    28:36 - `stripe serve`
    29:23 - `stripe samples`
    32:07 - Quick Wins ⚡️
    Presenter
    CJ Avilla, Developer Advocate @ Stripe - / cjav_dev
    Support
    If you have a question, please feel free to reach out to our support team at support.stripe.com/ or on Discord at stripe.com/go/developer-chat.
    Updates
    Sign up to stay updated with developer news: go.stripe.global/dev-digest
    Feedback
    If you have any feedback about this or other episodes, let us know: forms.gle/VjNqzRhotM2snYo88.
    #Stripe #Payments
  • Наука та технологія

КОМЕНТАРІ • 90

  • @LazyDali
    @LazyDali 2 роки тому +3

    That CLI is so useful. Awesome! And clearly explained. Thanks!

  • @oasis142
    @oasis142 Рік тому +1

    Excellent, simple, to the point. Thanks stripe devs!

    • @StripeDev
      @StripeDev  Рік тому

      Thanks for watching, we really appreciate your feedback!

  • @JakeJJKs
    @JakeJJKs 3 роки тому +14

    I'm a software engineer putting my entrepreneurial spirit to the test, and I have honestly no clue how I would go about it without stripe.

  • @futuregootecks
    @futuregootecks Рік тому +1

    Holy smokes this was super helpful!!! Fledgling dev here, but there was so much useful insight in here that I would have missed if I was only reading the docs. Totally building my first stripe app with the cli now!

    • @StripeDev
      @StripeDev  Рік тому

      Thank you for the feedback, glad you found it helpful!

  • @petebytes5010
    @petebytes5010 3 роки тому +2

    Wish all API's I work with had this capability - makes things so much easier!!!

  • @jvcss
    @jvcss Рік тому

    I just have to thank for this platform to exist

  • @danielazori5455
    @danielazori5455 2 роки тому

    Thank You!💞💖All the Best , Daniela Zori !💞💖

  • @mackymccormack8446
    @mackymccormack8446 Рік тому

    Great tool, nicely explained, thank you

  • @Fh_Ndiritu
    @Fh_Ndiritu Рік тому

    Awesome intro. Thank you!

  • @kirikiki7100
    @kirikiki7100 4 роки тому +2

    Very good, thanks!

  • @francoisrafaralahy2786
    @francoisrafaralahy2786 10 місяців тому

    Nice great explanation ! thanks for this job

  • @ChrisTian-ox5nr
    @ChrisTian-ox5nr 2 роки тому +1

    This is great! THank you!

  • @jaysee3611
    @jaysee3611 4 роки тому +1

    Hey can you show us how we can change the statement descriptor using this with connected stripe accounts?

  • @hbela1000
    @hbela1000 Рік тому

    This tuto is an abs. must to have.thx.

  • @user-xs9si3qb2t
    @user-xs9si3qb2t 2 місяці тому

    27:50 特にここからとても参考になりました。これでピンポイントでデバッグできます!

  • @KeithBlack01
    @KeithBlack01 2 роки тому

    Do you have to use this for adding lookup codes against live products? - I see you can add lookup codes when testing straight from stripe control panel but not for live products - am I missing something?
    Also can't seem to copy & paste into this CLI - that would be useful given the length of items names being generated.
    Thanks

  • @AlexGower
    @AlexGower 6 місяців тому

    Thank you for doing the lords work

  • @Neonb88
    @Neonb88 Рік тому

    UA-cam should recommend this to me in the future; it will help with future TraderEx work

  • @jansgreen4650
    @jansgreen4650 3 роки тому

    I have a problems with my app, the test returns

  • @mehedihasanmim529
    @mehedihasanmim529 Рік тому

    Made my day!

  • @bhagyathakur2016
    @bhagyathakur2016 3 роки тому +1

    Hey Stripe ! How to pass discription of service in payment intent API

  • @anthonya9907
    @anthonya9907 3 роки тому +2

    Complete novice here, but this is such a great guide for anyone getting involved with Stripe! I'm having difficulty with the building a csv list from stripe. Everything works well, until I try to do this. I'm using the following prompt:
    stripe customers list | jq '.data[] | [.id,.name,.email] | @csv'
    and I get an error stating that
    '[.id' is not recognized as an internal or external command,
    operable program or batch file.
    Am I doing something wrong?

  • @Maxpl01t
    @Maxpl01t Рік тому

    Hiya mate, I've been trying to configure stripe autocompletion on my zsh shell terminal on macOS with no luck, could you please provide instructions?

  • @zenzen7091
    @zenzen7091 2 роки тому

    Hey there :)
    Nice demo, everything is working as expected on my side.
    I do have a question though ^^
    I'm trying to use CLI commands within my end-to-end tests, and would like to automatically create an account with details_submitted set to true, so that the user I'll link afterwards is all ready. Is there a way to do so ?
    Thanks a lot !

    • @StripeDev
      @StripeDev  2 роки тому

      Hey there! For Connect account, we would recommend using "stripe accounts create" with parameters from this Doc: stripe.com/docs/connect/testing.

  • @Neonb88
    @Neonb88 Рік тому

    Best stuff (useful to actually processing a payment) is near the end of the video. You can always skip to "quick wins" and then go back through and actually memorize the commands
    Personal To-dos for future me:
    1. Subscription / recurring payments
    2. How much can I customize the Stripe UIs based on their given stuff? (vs. ReactJS, )
    3.

  • @Vincetroid
    @Vincetroid 4 місяці тому

    what do you do when you get 504 instead of 200?

  • @logemann74
    @logemann74 3 місяці тому

    this resend feature on event level is awesome. Havent found that out so far....

  • @jackhepple1049
    @jackhepple1049 2 роки тому

    can a cardholder hold more than 1 virtual card, also is there any way to create a loop for example for 15 cards rather than having to type out the command each time? (not much cli experience)

    • @StripeDev
      @StripeDev  2 роки тому

      Hey Jack-great questions! A cardholder can definitely be assigned more than one virtual card. What exactly do you mean about the loop though? Are you wanting to create one that would assign 15 cards to the same cardholder? If so, it should be possible to contain the card.create request inside a loop to do that.

  • @raygan3
    @raygan3 2 роки тому

    If we toggle stripe test mode in the dashboard it turns off production mode? Or I can work with both production and test environments at same time?

    • @StripeDev
      @StripeDev  2 роки тому +1

      Hey Szymon - you can only work in either live mode or test mode at one time. If you're having issues using Stripe CLI, please don't hesitate to ask us any questions. Thanks.

  • @raygan3
    @raygan3 2 роки тому

    is it ever possible to receive duplicate webhook requests from stripe for the same event? Should we save event id in the database and check if it was processed before?

    • @StripeDev
      @StripeDev  2 роки тому

      Hi Szymon-you might want to check our our Best Practices documentation, it may help answer these questions for you: stripe.com/docs/webhooks/best-practices.

  • @user-ug1ci9le8m
    @user-ug1ci9le8m 11 місяців тому

    Thanks for the video. How did you make the "movies" plan though?

    • @StripeDev
      @StripeDev  11 місяців тому

      Hi Michael-you can now model subscriptions more flexibly using the Prices API. It replaces the Plans API and is backwards compatible to simplify your migration: stripe.com/docs/api/prices.
      Here's more info about building a subscription integration: stripe.com/docs/billing/subscriptions/build-subscriptions.
      If you still need help, please post your question on the Stripe Developer Discord channel: stripe.com/go/developer-chat.
      Or send us an email, here: support.stripe.com/.

  • @Cransridge2288
    @Cransridge2288 Рік тому

    great video thanks, FYI the -j has now been replaced with: --format JSON

  • @midnightcoder2189
    @midnightcoder2189 Рік тому

    Is there a way to quickly add new products and make them live using Stripe CLI? I can create new product but they end up in test mode and the only option I have in Dashboard is to "Copy to live mode". Would be nice if that is available in CLI too

    • @StripeDev
      @StripeDev  Рік тому

      Hi there! By default the CLI uses testmode, but there is a --live flag that they can use for livemode: stripe.com/docs/cli/post#post-live

  • @ronrivero1039
    @ronrivero1039 Рік тому

    why do you use "payment-method" when in Stripe it is "payment_method"? I am confused which one to follow now?

  • @shifrin7499
    @shifrin7499 Рік тому

    Well - but HOW do you trigger event for specific customer id? otherwise you can't really test any of the webhook!

    • @StripeDev
      @StripeDev  Рік тому

      Hey Vlad-what type of Event are you trying to trigger exactly? Please feel free to check out the related documentation in the mean time: stripe.com/docs/cli/trigger.

  • @gerrigg
    @gerrigg Рік тому

    hello. thanks for this. question: when triggering say an invoice.payment_failed event, how can I specify the customer? --help doesn't show flags to support this. thank you

    • @StripeDev
      @StripeDev  Рік тому

      Hey there! When using Stripe trigger, it uses a "fixture" which is a list of API requests we'll run to cause the events for you. This specific event is defined here: github.com/stripe/stripe-cli/blob/master/pkg/fixtures/triggers/invoice.payment_failed.json.
      In this case, it sounds like you want to override the customer, which the fixture is creating first. We suggest explicitly using a feature that lets you override this parameter with the one you want-this is documented here: stripe.com/docs/cli/fixtures#fixtures-override.
      What the fixture does is create an InvoiceItem and then creates an Invoice-you'll want to override the customer on both so the call would look like this: stripe trigger invoice.payment_failed --skip customer --override "invoiceitem:customer=cus_ABC" --override "invoice:customer=cus_ABC"

    • @gerrigg
      @gerrigg Рік тому

      @@StripeDev Awesome! Thanks so much. I'll give that a try!

    • @gerrigg
      @gerrigg Рік тому

      @@StripeDev Hmmm, running that fixture seems to simply create an invoice successfully, not a failed payment. ??? Thanks. Also, I thought a while back, in Test Mode, in our Stripe Dashboard/UI we could send events manually? That seemed much easier IMHO :)

  • @thedigitalceo
    @thedigitalceo 2 роки тому +1

    I haven’t seen any technology have such an in depth CLI it’s great but just wondering is there any other benefit to using the CLI besides for testing local environments?

    • @StripeDev
      @StripeDev  2 роки тому +1

      Thanks a lot, we're glad you're enjoying it! Here are some benefits you can take note of. For local environment testings, you can:
      Make API requests [0][1].
      Tail logs [2].
      Listen and trigger webhook events [3], this is useful if you would like to get real time updates and trigger respective actions in your systems [4].
      The Stripe CLI also allows you to:
      Check Stripe’s status [5].
      Open the relative Stripe documentation or Dashboard in your browser [6].
      Copy Stripe’s sample projects to your local environment [7].
      Provide feedback for Stripe [8].
      The Stripe CLI can also be run within a container with the use of Docker [9].
      [0] stripe.com/docs/stripe-cli/test
      [1] stripe.com/docs/cli/resources
      [2] stripe.com/docs/cli/logs/tail
      [3] stripe.com/docs/stripe-cli/webhooks
      [4] stripe.com/docs/webhooks
      [5] stripe.com/docs/cli/status
      [6] stripe.com/docs/cli/open
      [7] stripe.com/docs/cli/samples/create
      [8] stripe.com/docs/cli/feedback
      [9] stripe.com/docs/cli/docker

    • @thedigitalceo
      @thedigitalceo 2 роки тому

      @@StripeDev got it. That’s pretty amazing. I don’t think we’ve ever seen these use cases but I can see this as being helpful! It’s been instrumental for us for testing our apps locally. I’m glad to see Stripe extending all these resources for developers

    • @StripeDev
      @StripeDev  2 роки тому +1

      That makes us happy to hear! Feel free to reach out if you have any other questions.

  • @laygir
    @laygir Рік тому

    Hey, got a question, when I trigger an event through cli I see failing events/requets on my Stripe dashboard for the registered webhook endpoint. Am I supposed to disable registered webhook endpoint everytime I want to test things locally? Or is there a configuration somewhere to prevent registered endpoint from receiving events when trigger is coming from cli?

    • @StripeDev
      @StripeDev  Рік тому

      Hey there-are you able to share the error messaging you're seeing?

    • @laygir
      @laygir Рік тому

      @@StripeDev I posted a detailed reply here but now I do not see it, not sure what's wrong with UA-cam :/

    • @StripeDev
      @StripeDev  Рік тому +1

      We'd be happy to help-feel free to reach out to us at heretohelp@stripe.com with details!

  • @ravindranathmopparthy8116
    @ravindranathmopparthy8116 Рік тому +1

    stripe status doesn't work for version 1.16.0. "Unknown command "status" for "stripe".

  • @carlweis
    @carlweis Рік тому

    Great. Video! Thank you!
    What camera do you use to record these videos!

    • @StripeDev
      @StripeDev  Рік тому

      CJ uses a Sony a6400-here's a list of the gear and software he uses/recommends: www.cjav.dev/uses. Hope this helps!

  • @StripeDev
    @StripeDev  Рік тому

    Hello Ravindranath-can you tell us a bit more about what's happening? Are you referring to the part of the video starting at 03:21?
    We also encourage you to post your questions to our Stripe Developer Discord channel as well: discord.com/invite/RuJnSBXrQn.

  • @almidoro
    @almidoro 2 роки тому

    How can we test in CLI a especific object, for example, a update on subscription (sub...) that has been failed the payment? I triggered the event but CLI creates a new subscription for the test.

    • @StripeDev
      @StripeDev  2 роки тому

      Hi André-can you explain a bit more about the issue you're running into with the failed payment and the subscription?

    • @almidoro
      @almidoro 2 роки тому

      Hello. I have developed in my plataform some subscripitons plans and assigned then for the customers. Now I need to set the updates trough webhooks of thes subscripitions. For example, when a recurring payment failed for some problem with card. I’d like to test these situations but I didn’t undestand if is possible using the CLI

    • @StripeDev
      @StripeDev  2 роки тому +2

      Got it, thanks for explaining, André! If you're looking to test a bit with subscriptions and learn to manage payment failures with the CLI, check out this doc: stripe.com/docs/billing/subscriptions/fixed-price#what-you%E2%80%99ll-build.
      We also have a bunch of resources around testing Billing: stripe.com/docs/billing/testing.

    • @almidoro
      @almidoro 2 роки тому +1

      @@StripeDev thank you. I’ll study it.

  • @coachingreflexivo
    @coachingreflexivo 4 роки тому +4

    Literally thought CLI was short for "client" as in server/client. Lol.

  • @i2mastering943
    @i2mastering943 5 місяців тому

    Maybe it would be good to tell people they have to install homebrew for the brew command to actually work. It's actually funny how that important part is just simply skipped over.

  • @alpachino468
    @alpachino468 8 місяців тому

    Can I create Stripe keys using Microsoft Paint?

    • @StripeDev
      @StripeDev  8 місяців тому

      No. Stripe keys are generated through Stripe's website or API, and they require specific cryptographic algorithms to ensure their security.

    • @alpachino468
      @alpachino468 8 місяців тому

      @@StripeDev Thanks but it was a very silly question, I must admit. Ok so I do need some real help though. On a charity website I maintain, I allow donations to be accepted, where donors can input an amount of their choice. All works fine and payment gets accepted. What I also try to do is append the ID of the donation campaign within the session's and price's metadata, with the intention of performing a lookup of all payments and then filtering by the campaign'd ID in order to collate all payments for a particular campaign so that I can present to users how much we have raised. Any way to do this? Am I even making sense?

    • @StripeDev
      @StripeDev  8 місяців тому +1

      Yes, your ask does make sense. So, when a payment is made, you can include additional information such as the donation campaign ID in the metadata of the payment. Here's an example of how you can achieve this using Stripe's API:
      1. When creating a payment, include the campaign ID in the metadata parameter:
      "import stripe
      stripe.api_key = 'YOUR_STRIPE_SECRET_KEY'
      payment_intent = stripe.PaymentIntent.create(
      amount=1000,
      currency='usd',
      metadata={
      'campaign_id': 'YOUR_CAMPAIGN_ID',
      },
      )"
      2. When retrieving payments, you can filter them based on the campaign ID:
      "import stripe
      stripe.api_key = 'YOUR_STRIPE_SECRET_KEY'
      # Retrieve all payments
      payments = stripe.PaymentIntent.list()
      # Filter payments based on campaign ID
      campaign_payments = [payment for payment in payments if payment.metadata.get('campaign_id') == 'YOUR_CAMPAIGN_ID']"
      You can then use the `campaign_payments´ list to perform any analysis or calculations to determine how much you have raised for a particular campaign. Note that you will need to replace `YOUR_STRIPE_SECRET_KEY´ with your actual Stripe secret key and `YOUR_CAMPAIGN_ID´ with the relevant IDs for each campaign on your website.

  • @thibao8726
    @thibao8726 3 роки тому

    how to install tripe CLI ?

    • @cjav_dev
      @cjav_dev 3 роки тому +1

      Hey Thi, there's a step by step guide for installing the Stripe CLI here: stripe.com/docs/stripe-cli.

    • @thibao8726
      @thibao8726 3 роки тому

      @@cjav_dev i have install it, but i want ask you i want save to database card id and customer id , when i save 2 card and 1 customer, how do i do ?

  • @jdotsystem
    @jdotsystem Рік тому

    Actually, I became sleepy after started this movie viewing
    I would like to know overview about your product

  • @tddtv
    @tddtv Рік тому

    Only problem with this is that if you don't know the object structure of the various params in your head, you have to go figure that out because this doesn't intellisense for you. All easy AFTER you get to know the objects you need to use and object structs

  • @JeanAlesiagain3
    @JeanAlesiagain3 3 роки тому +3

    Which video is the actual basic tutorial that teaches you what you don't even know you don't know?

    • @jarodmorris611
      @jarodmorris611 3 роки тому +1

      Sorry, there's a conspiracy in the stripe world to never tell you. You have to magically pass the test to even begin to realize you don't know what you don't know. Until then you're SOL.

  • @jarodmorris611
    @jarodmorris611 3 роки тому

    I have CentOS 7 and a Virtual Private Server. I rarely find anyone that shows how to use one of those. It's always a local machine. I get it, that people's setup could be vastly different, but isn't that true about local machines too and yet people constantly show their local machine and installation, config, etc. I used wget to grab the repository for stripe-cli, unzipped it, then was instructed to run the executable. Only there IS NO EXECUTABLE. It's a file with title 'stripe'. NO EXTENSION AT ALL. It's horribly frustrating to have 99 options and videos act like there is only 1 possibility. It's like going into a bar and saying, "I'd like a beer." uh, which beer? There are only a few thousand in the world to choose from.

    • @jarodmorris611
      @jarodmorris611 3 роки тому

      UPDATE: For anyone reading this that is also frustrated.... you have to run ./stripe login {secret_key_here} and then it should do what you want it to do

    • @jarodmorris611
      @jarodmorris611 3 роки тому

      I've used the --interactive flag and been able to provide the secret key manually (don't get even a single digit wrong!) and then it asks me to provide a device-name and I do and then it says it's configured. Then if I go to ./stripe login, it does the "Waiting for confirmation" and hangs there. NO ONE has a tutorial for CentOS stripe-cli, etc. It should not be so hard to give Stripe money from my sales.

  • @sillypablo3495
    @sillypablo3495 Рік тому

    This isnt working

    • @StripeDev
      @StripeDev  Рік тому

      Hi Pablo-sorry to hear you're having issues. If you get back to us with where you're seeing an error, we might be able to help further. Alternatively, you can find support through our developer discord community here: discord.com/invite/stripe

  • @hemanth6951
    @hemanth6951 3 роки тому

    8hrs I used stripe cli 25gb data gone 😁

  • @gunrunjk
    @gunrunjk Рік тому

    it gets error $_SERVER['HTTP_STRIPE_SIGNATURE'].
    how can I fix it ?, this is coming from stripe dashboard logs.
    Fatal error: Uncaught Error: Class "Stripe\Webhook" not found in C:\xampp\htdocs\index.php:16

    • @StripeDev
      @StripeDev  Рік тому

      Hi Junki. It looks like an SDK installation problem. Your code is unable to include Stripe SDK. We recommend going through the installation guide: github.com/stripe/stripe-php#requirements and using either Composer (recommended) or the manual installation.

  • @learninggcn1113
    @learninggcn1113 5 місяців тому

    Wow,Now version 1.19.2 have canceled the status sub-command
    The result is :
    stripe status
    Unknown command "status" for "stripe".
    See "stripe --help" for a list of available commands.