Fireship · @fireship

Stripe Checkout Payments with Angular and Firebase - Part 1

Uploaded July 10, 2017 · Length 4:47

Stripe Checkout Payments with Angular and Firebase - Part 1

Summary

este episodio integra pagos de stripe en un proyecto de angular 4 con Firebase en el backend

  • stripe checkout
  • angular payments
  • firebase backend
  • stripe integration
  • angular 4
  • stripe payments

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    in this episode we're going to integrate

  2. 0:02

    stripe payments into an angular 4

  3. 0:04

    project with Firebase on the back end

  4. 0:07

    this is the first installment of a

  5. 0:09

    multi-part series on handling payments

  6. 0:11

    in angular in this first part you'll

  7. 0:13

    learn how to trigger the stripe checkout

  8. 0:14

    modal to collect the customer's credit

  9. 0:16

    card and then receive the payment token

  10. 0:18

    back from

  11. 0:19

    stripe before we get into the code let's

  12. 0:22

    take a look at how the whole stripe

  13. 0:23

    payment process works the user will

  14. 0:26

    enter their credit card details through

  15. 0:27

    the angular app with stripe checkout

  16. 0:30

    then stripe will respond with the

  17. 0:32

    payment token which we then want to save

  18. 0:34

    in the Firebase database this will

  19. 0:36

    automatically trigger a cloud function

  20. 0:38

    which sends the token back to stripe

  21. 0:40

    stripe will charge the card and then

  22. 0:42

    respond with the charge details Firebase

  23. 0:45

    and angular have a real-time connection

  24. 0:47

    so the user will always stay up to date

  25. 0:49

    on the status of their payment

  26. 0:50

    throughout this

  27. 0:51

    process let's start by getting the

  28. 0:53

    initial setup out of the way first

  29. 0:55

    you'll need a stripe API key which you

  30. 0:57

    can get from stripe.com then go to the

  31. 1:00

    checkout documentation and we'll be

  32. 1:02

    modifying the custom integration to work

  33. 1:04

    with

  34. 1:05

    angular in your app environment file add

  35. 1:08

    the stripe API key and make sure it's

  36. 1:11

    the test key from there we need to add

  37. 1:14

    the stripe checkout library to the

  38. 1:16

    index.html file and the final step is to

  39. 1:20

    make typescript aware of the stripe

  40. 1:22

    checkout class which you do in the

  41. 1:25

    typing. D.S

  42. 1:28

    file the next step is is to create a

  43. 1:30

    feature module to handle all of our

  44. 1:32

    payment components and services when

  45. 1:34

    you're done with this lesson your

  46. 1:36

    payment module should look something

  47. 1:37

    like

  48. 1:39

    this from there we can generate the

  49. 1:41

    service specifying the payment module

  50. 1:44

    then import angular fire database and

  51. 1:46

    angular fire off and first we'll get the

  52. 1:49

    user ID by subscribing to the angular

  53. 1:52

    fire off

  54. 1:54

    State the only other thing our service

  55. 1:56

    needs to do at this point is save the

  56. 1:58

    stripe token to the Firebase