Cloud

Stripe

What is Stripe?


Stripe CLI

  1. Install the Stripe CLI
brew install stripe/stripe-cli/stripe
  1. Log in to the CLI

Log in and authenticate your Stripe user account to generate a set of restricted keys.

stripe login

Press Enter on your keyboard to complete the authentication process in your browser.

Your pairing code is: enjoy-enough-outwit-win
This pairing code verifies your authentication with Stripe.
Press Enter to open the browser or visit https://dashboard.stripe.com/stripecli/confirm_auth?t=THQdJfL3x12udFkNorJL8OF1iFlN8Az1 (^C to quit)

Optionally, if you don’t want to use a browser, use the --interactive flag to authenticate with an existing API secret key or restricted key. This is helpful when authenticating to the CLI without a browser, such as in a CI/CD pipeline.

stripe login --interactive

You can also use the --api-key flag to specify your API secret key inline each time you send a request.

stripe login --api-key sk_test_51SyUG5FKc7ywNC01ZDLZIDtrgu3pBXZ7yECfXNYrUIeYplbUoUU1I4RLs9b0Sl...4bVESaDq5v00ZiOqH8Zb

API Keys


Webhook

  1. Create a Stripe webhook endpoint Point it to: https://your-domain.com/api/stripe/webhook

Events:

  • checkout.session.completed
  • customer.subscription.created
  • customer.subscription.updated
  • customer.subscription.deleted
  • invoice.paid
  • invoice.payment_failed

If testing locally, update your Stripe CLI command:

stripe listen --forward-to http://localhost:3000/api/stripe/webhook

After that, run a test checkout.


Test Credit Card

卡类型卡号安全码 (CVV)有效期
Visa4242424242424242任意 3 位数任意未来的日期
Visa(借记卡)4000056655665556任意 3 位数任意未来的日期
Mastercard5555555555554444任意 3 位数任意未来的日期
Mastercard(以 2 开头)2223003122003222任意 3 位数任意未来的日期
Mastercard(借记卡)5200828282828210任意 3 位数任意未来的日期
Mastercard(预付卡)5105105105105100任意 3 位数任意未来的日期
American Express378282246310005任意 4 位数任意未来的日期
American Express371449635398431任意 4 位数任意未来的日期
Discover6011111111111117任意 3 位数任意未来的日期
Discover6011000990139424任意 3 位数任意未来的日期
Discover(借记卡)6011981111111113任意 3 位数任意未来的日期
Diners Club3056930009020004任意 3 位数任意未来的日期
Diners Club(14 位卡号)36227206271667任意 3 位数任意未来的日期
BCcard 和 DinaCard6555900000604105任意 3 位数任意未来的日期
JCB3566002020360505任意 3 位数任意未来的日期
银联6200000000000005任意 3 位数任意未来的日期
银联(借记卡)6200000000000047任意 3 位数任意未来的日期
银联(19 位卡号)6205500000000000004任意 3 位数任意未来的日期
Previous
Fusion 360 Assembly