Stripe to MemberPress Webhook Error: Invalid encoding: ISO-8859-1, 500 Error

549 Views Asked by At

Payments are processing in Stripe, but the webhook back to MemberPress that lets it know that the subscription renewed are failing. Webhooks look to be identical, and not in Test mode. Just not getting a lot of info back on the error.

Should I set up listeners?

{
  "id": "evt_1Kvpj1KsZRmhnThq31q4z2z5",
  "object": "event",
  "api_version": "2019-09-09",
  "created": 1651699631,
  "data": {
    "object": {
      "id": "in_1KowZdKsZRmhnThqHCHU9Ogc",
      "object": "invoice",
      "account_country": "US",
      "account_name": "xxx",
      "account_tax_ids": null,
      "amount_due": 2000,
      "amount_paid": 0,
      "amount_remaining": 2000,
      "application": "ca_Frz23gAnQWismBJBCaDbG8q329v7pYgP",
      "application_fee_amount": null,
      "attempt_count": 4,
      "attempted": true,
      "auto_advance": true,
      "automatic_tax": {
        "enabled": false,
        "status": null
      },
      "billing_reason": "subscription_cycle",
      "charge": "ch_3KoxXVKsZRmhnThq1BpxfrRH",
      "collection_method": "charge_automatically",
      "created": 1650057661,
      "currency": "usd",
      "custom_fields": null,
      "customer": "cus_JJF66CIpIHgY71",
      "customer_address": null,
      "customer_email": "xxx",
      "customer_name": "xxx",
      "customer_phone": null,
      "customer_shipping": null,
      "customer_tax_exempt": "none",
      "customer_tax_ids": [
      ],
      "default_payment_method": null,
      "default_source": null,
      "default_tax_rates": [
      ],
      "description": null,
      "discount": null,
      "discounts": [
      ],
      "due_date": null,
      "ending_balance": 0,
      "footer": null,
      "hosted_invoice_url": "xxx",
      "invoice_pdf": "xxx",
      "last_finalization_error": null,
      "lines": {
        "object": "list",
        "data": [
          {
            "id": "sli_1098abKsZRmhnThqaebb3d27",
            "object": "line_item",
            "amount": 2000,
            "currency": "usd",
            "description": "1 × Annual Membership (at $20.00 / year)",
            "discount_amounts": [
            ],
            "discountable": true,
            "discounts": [
            ],
            "livemode": true,
            "metadata": {
              "platform": "MemberPress Connect xxx",
              "transaction_id": "127",
              "site_url": "xxx",
              "ip_address": "xxx"
            },
            "period": {
              "end": 1681593637,
              "start": 1650057637
            },
            "plan": {
              "id": "plan_I8rke8iYhwpjp0",
              "object": "plan",
              "active": true,
              "aggregate_usage": null,
              "amount": 2000,
              "amount_decimal": "2000",
              "billing_scheme": "per_unit",
              "created": 1601828701,
              "currency": "usd",
              "interval": "year",
              "interval_count": 1,
              "livemode": true,
              "metadata": {
              },
              "nickname": null,
              "product": "prod_I8rkHCACiVHgM3",
              "tiers_mode": null,
              "transform_usage": null,
              "trial_period_days": null,
              "usage_type": "licensed",
              "tiers": null
            },
            "price": {
              "id": "plan_I8rke8iYhwpjp0",
              "object": "price",
              "active": true,
              "billing_scheme": "per_unit",
              "created": 1601828701,
              "currency": "usd",
              "livemode": true,
              "lookup_key": null,
              "metadata": {
              },
              "nickname": null,
              "product": "prod_I8rkHCACiVHgM3",
              "recurring": {
                "aggregate_usage": null,
                "interval": "year",
                "interval_count": 1,
                "trial_period_days": null,
                "usage_type": "licensed"
              },
              "tax_behavior": "unspecified",
              "tiers_mode": null,
              "transform_quantity": null,
              "type": "recurring",
              "unit_amount": 2000,
              "unit_amount_decimal": "2000"
            },
            "proration": false,
            "proration_details": {
              "credited_items": null
            },
            "quantity": 1,
            "subscription": "sub_JJF69Ko1VVf8uw",
            "subscription_item": "si_JJF6gp8KXzNplv",
            "tax_amounts": [
            ],
            "tax_rates": [
            ],
            "type": "subscription",
            "unique_id": "il_1KowZdKsZRmhnThqPr3xCYcs"
          }
        ],
        "has_more": false,
        "total_count": 1,
        "url": "/v1/invoices/in_1KowZdKsZRmhnThqHCHU9Ogc/lines"
      },
      "livemode": true,
      "metadata": {
      },
      "next_payment_attempt": 1651875994,
      "number": "5CB6E2A9-0002",
      "on_behalf_of": null,
      "paid": false,
      "paid_out_of_band": false,
      "payment_intent": "pi_3KoxXVKsZRmhnThq1Y9GWeY3",
      "payment_settings": {
        "payment_method_options": null,
        "payment_method_types": null
      },
      "period_end": 1650057637,
      "period_start": 1618521637,
      "post_payment_credit_notes_amount": 0,
      "pre_payment_credit_notes_amount": 0,
      "quote": null,
      "receipt_number": null,
      "starting_balance": 0,
      "statement_descriptor": null,
      "status": "open",
      "status_transitions": {
        "finalized_at": 1650061373,
        "marked_uncollectible_at": null,
        "paid_at": null,
        "voided_at": null
      },
      "subscription": "sub_JJF69Ko1VVf8uw",
      "subtotal": 2000,
      "tax": null,
      "test_clock": null,
      "total": 2000,
      "total_discount_amounts": [
      ],
      "total_tax_amounts": [
      ],
      "transfer_data": null,
      "webhooks_delivered_at": 1650057661,
      "billing": "charge_automatically",
      "tax_percent": null
    }
  },
  "livemode": true,
  "pending_webhooks": 1,
  "request": {
    "id": null,
    "idempotency_key": null
  },
  "type": "invoice.payment_failed"
}
1

There are 1 best solutions below

0
On

That "Invalid encoding: ISO-8859-1" error is sort of a red herring, it basically means Stripe was not able to read the response body the server sent back to it(as the server is probably returning something unparsable in that character set due to being misconfigured), so it can't show you what was sent .

It's probably not directly related to why the webhook delivery is failing. You or whomever has access to this would need to look at the server logs of your server that receives the webhook and see what it does when receiving the requset from Stripe and what errors it encountered by checking logs there and debug from that point.