Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe CLI: Trigger of "subscription.payment_succeeded" does not work #1116

Open
DenisKnecht02 opened this issue Aug 23, 2023 · 5 comments
Open
Labels
bug Something isn't working

Comments

@DenisKnecht02
Copy link

DenisKnecht02 commented Aug 23, 2023

Issue

I wanted to test a successful payment on a subscription by triggering the event via Stripe CLI. I talked to a developer in the Developer Discord. He tested it on MacOS, where it worked.
I used CLI versions v1.17.0 and v1.17.1 and API version 2023-08-16.
When editing the trigger, it shows the following fixtures etc:

{
  "_meta": {
    "template_version": 0
  },
  "fixtures": [
    {
      "name": "payment_method",
      "path": "/v1/payment_methods",
      "method": "post",
      "params": {
        "type": "card",
        "card": {
          "number": "4242424242424242",
          "exp_month": 10,
          "exp_year": 2026,
          "cvc": 314
        }
      }
    },
    {
      "name": "customer",
      "path": "/v1/customers",
      "method": "post",
      "params": {
        "name": "SubscriptionTestCustomer",
        "description": "(created by Stripe CLI)"
      }
    },
    {
      "name": "attach_payment_method",
      "path": "/v1/payment_methods/${payment_method:id}/attach",
      "method": "post",
      "params": {
        "customer": "${customer:id}"
      }
    },
    {
      "name": "default_payment_method",
      "path": "/v1/customers/${customer:id}",
      "method": "post",
      "params": {
        "invoice_settings": {
          "default_payment_method": "${payment_method:id}"
        }
      }
    },
    {
      "name": "product",
      "path": "/v1/products",
      "method": "post",
      "params": {
        "name": "SubscriptionTestProduct",
        "description": "(created by Stripe CLI)"
      }
    },
    {
      "name": "price",
      "path": "/v1/prices",
      "method": "post",
      "params": {
        "nickname": "SubscriptionTestPrice",
        "product": "${product:id}",
        "unit_amount": 2000,
        "currency": "usd",
        "recurring": {
          "interval": "month"
        }
      }
    },
    {
      "name": "subscription",
      "path": "/v1/subscriptions",
      "method": "post",
      "params": {
        "customer": "${customer:id}",
        "items": [
          {
            "price": "${price:id}"
          }
        ]
      }
    },
    {
      "name": "invoice",
      "path": "/v1/invoices/${subscription:latest_invoice}",
      "method": "get",
      "params": {}
    }
  ]
}

Expected Behavior

Successful trigger of this event.

Steps to reproduce

  1. Open terminal
  2. Type stripe login
  3. Type stripe trigger subscription.payment_succeeded

Traceback

The logs are:

Setting up fixture for: payment_method
Running fixture for: payment_method
Trigger failed: Request failed, status=402, body={
  "error": {
    "message": "Sending credit card numbers directly to the Stripe API is generally unsafe. We suggest you use test tokens that map to the test card you are using, see https://stripe.com/docs/testing. To enable raw card data APIs in test mode, see https://support.stripe.com/questions/enabling-access-to-raw-card-data-apis.",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_kmBjJE8QY2N1KV?t=1692782692",
    "type": "invalid_request_error"
  }
}

Environment

Windows 10 Home 22H2

@DenisKnecht02 DenisKnecht02 added the bug Something isn't working label Aug 23, 2023
@tucker-altir
Copy link

I'm seeing this error as well, using the same cli and api versions as @DenisKnecht02.

strangely enough, this also triggered a warning message from Stripe to our team as well:
image

@emilioiz
Copy link

emilioiz commented Sep 1, 2023

I'm seeing this error as well, using the same cli and api versions as @DenisKnecht02.

Environment
Apple M2 Max macOS Ventura 13.4.1

@K4sku
Copy link

K4sku commented Sep 6, 2023

I'm having the same issue, MacOS 11.7.1 with event subscription.payment_failed

@Kirillpt
Copy link

The same issue:

$ stripe stripe trigger subscription.payment_succeeded

Setting up fixture for: payment_method
Running fixture for: payment_method
Trigger failed: Request failed, status=402, body={
  "error": {
    "message": "Sending credit card numbers directly to the Stripe API is generally unsafe. We suggest you use test tokens that map to the test card you are using, see https://stripe.com/docs/testing. To enable raw card data APIs in test mode, see https://support.stripe.com/questions/enabling-access-to-raw-card-data-apis.",
    "request_log_url": "https://dashboard.stripe.com/test/logs/req_wWx************",
    "type": "invalid_request_error"
  }
}

stripe version 1.17.2

@Vladlysenko75
Copy link

Update Stripe version with brew install stripe/stripe-cli/stripe.

I was on 1.13.10 version and got same errors, updated to 1.19.2 and it's working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants