Stripe causing double payments

@onepresstech Thanks for your help with this, and sorry for the confusion! The api log was for a single transaction that double charged the customer, not the for the four sequential transactions that quadruple charged the customer which I first posted about.

Thank you for pointing out the fields that were not obscured in the previous log, I fixed it now.

Here are the obscured logs for the four sequential transactions that resulted in a quadruple charge:

==================================
Failure 1

payment_intent.created
{
  "id": "pi_ddd",
  "object": "payment_intent",
  "last_payment_error": null,
  "livemode": true,
  "next_action": null,
  "status": "requires_source",
  "allowed_source_types": [
    "card"
  ],
  "amount": 16800,
  "amount_capturable": 0,
  "amount_received": 0,
  "application": null,
  "application_fee_amount": null,
  "canceled_at": null,
  "cancellation_reason": null,
  "capture_method": "automatic",
  "charges": {
    "object": "list",
    "data": [
    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/charges?payment_intent=pi_ddd"
  },
  "client_secret": "pi_ddd_secret_eeee",
  "confirmation_method": "automatic",
  "created": 1585423212,
  "currency": "usd",
  "customer": "cus_ccc",
  "description": "Subscription creation",
  "invoice": null,
  "metadata": {
  },
  "next_source_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_options": {
    "card": {
      "installments": null,
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": [
    "card"
  ],
  "receipt_email": null,
  "review": null,
  "setup_future_usage": null,
  "shipping": null,
  "source": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "transfer_data": null,
  "transfer_group": null
}

payment_intent.canceled
{
  "id": "pi_ddd",
  "object": "payment_intent",
  "last_payment_error": null,
  "livemode": true,
  "next_action": null,
  "status": "canceled",
  "allowed_source_types": [
    "card"
  ],
  "amount": 16800,
  "amount_capturable": 0,
  "amount_received": 0,
  "application": null,
  "application_fee_amount": null,
  "canceled_at": 1585423212,
  "cancellation_reason": "failed_invoice",
  "capture_method": "automatic",
  "charges": {
    "object": "list",
    "data": [
    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/charges?payment_intent=pi_ddd"
  },
  "client_secret": "pi_ddd_secret_eeee",
  "confirmation_method": "automatic",
  "created": 1585423212,
  "currency": "usd",
  "customer": "cus_ccc",
  "description": "Subscription creation",
  "invoice": null,
  "metadata": {
  },
  "next_source_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_options": {
    "card": {
      "installments": null,
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": [
    "card"
  ],
  "receipt_email": null,
  "review": null,
  "setup_future_usage": null,
  "shipping": null,
  "source": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "transfer_data": null,
  "transfer_group": null
}

==================================
Failure 2

payment_intent.created
{
  "id": "pi_bbb",
  "object": "payment_intent",
  "last_payment_error": null,
  "livemode": true,
  "next_action": null,
  "status": "requires_source",
  "allowed_source_types": [
    "card"
  ],
  "amount": 33600,
  "amount_capturable": 0,
  "amount_received": 0,
  "application": null,
  "application_fee_amount": null,
  "canceled_at": null,
  "cancellation_reason": null,
  "capture_method": "automatic",
  "charges": {
    "object": "list",
    "data": [
    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/charges?payment_intent=pi_bbb"
  },
  "client_secret": "pi_bbb_secret_aaa",
  "confirmation_method": "automatic",
  "created": 1585423262,
  "currency": "usd",
  "customer": "cus_ccc",
  "description": "Subscription creation",
  "invoice": null,
  "metadata": {
  },
  "next_source_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_options": {
    "card": {
      "installments": null,
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": [
    "card"
  ],
  "receipt_email": null,
  "review": null,
  "setup_future_usage": null,
  "shipping": null,
  "source": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "transfer_data": null,
  "transfer_group": null
}

payment_intent.canceled
{
  "id": "pi_bbb",
  "object": "payment_intent",
  "last_payment_error": null,
  "livemode": true,
  "next_action": null,
  "status": "canceled",
  "allowed_source_types": [
    "card"
  ],
  "amount": 33600,
  "amount_capturable": 0,
  "amount_received": 0,
  "application": null,
  "application_fee_amount": null,
  "canceled_at": 1585423262,
  "cancellation_reason": "failed_invoice",
  "capture_method": "automatic",
  "charges": {
    "object": "list",
    "data": [
    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/charges?payment_intent=pi_bbb"
  },
  "client_secret": "pi_bbb_secret_aaa",
  "confirmation_method": "automatic",
  "created": 1585423262,
  "currency": "usd",
  "customer": "cus_ccc",
  "description": "Subscription creation",
  "invoice": null,
  "metadata": {
  },
  "next_source_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_options": {
    "card": {
      "installments": null,
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": [
    "card"
  ],
  "receipt_email": null,
  "review": null,
  "setup_future_usage": null,
  "shipping": null,
  "source": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "transfer_data": null,
  "transfer_group": null
}

==================================
Failure 3

payment_intent.created
{
  "id": "pi_ggg",
  "object": "payment_intent",
  "last_payment_error": null,
  "livemode": true,
  "next_action": null,
  "status": "requires_source",
  "allowed_source_types": [
    "card"
  ],
  "amount": 50400,
  "amount_capturable": 0,
  "amount_received": 0,
  "application": null,
  "application_fee_amount": null,
  "canceled_at": null,
  "cancellation_reason": null,
  "capture_method": "automatic",
  "charges": {
    "object": "list",
    "data": [
    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/charges?payment_intent=pi_ggg"
  },
  "client_secret": "pi_ggg_secret_hhh",
  "confirmation_method": "automatic",
  "created": 1585423304,
  "currency": "usd",
  "customer": "cus_ccc",
  "description": "Subscription creation",
  "invoice": null,
  "metadata": {
  },
  "next_source_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_options": {
    "card": {
      "installments": null,
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": [
    "card"
  ],
  "receipt_email": null,
  "review": null,
  "setup_future_usage": null,
  "shipping": null,
  "source": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "transfer_data": null,
  "transfer_group": null
}

payment_intent.canceled
{
  "id": "pi_ggg",
  "object": "payment_intent",
  "last_payment_error": null,
  "livemode": true,
  "next_action": null,
  "status": "canceled",
  "allowed_source_types": [
    "card"
  ],
  "amount": 50400,
  "amount_capturable": 0,
  "amount_received": 0,
  "application": null,
  "application_fee_amount": null,
  "canceled_at": 1585423304,
  "cancellation_reason": "failed_invoice",
  "capture_method": "automatic",
  "charges": {
    "object": "list",
    "data": [
    ],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/charges?payment_intent=pi_ggg"
  },
  "client_secret": "pi_ggg_secret_hhh",
  "confirmation_method": "automatic",
  "created": 1585423304,
  "currency": "usd",
  "customer": "cus_ccc",
  "description": "Subscription creation",
  "invoice": null,
  "metadata": {
  },
  "next_source_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_options": {
    "card": {
      "installments": null,
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": [
    "card"
  ],
  "receipt_email": null,
  "review": null,
  "setup_future_usage": null,
  "shipping": null,
  "source": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "transfer_data": null,
  "transfer_group": null
}

==================================
Success - A request to create a subscription completed

POST /v1/subscriptions 
200 OK
Request parameters
{
  "customer": "cus_ccc",
  "items": {
    "0": {
      "plan": "s2_plan_iii"
    }
  },
  "trial_from_plan": "true",
  "metadata": {
    "tax_info": "{"trial_tax":"0.00","trial_tax_per":"0%","tax":"0.00","tax_per":"0%"}"
  },
  "expand": {
    "0": "latest_invoice.payment_intent",
    "1": "pending_setup_intent"
  }
}

Response body
{
  "id": "sub_lll",
  "object": "subscription",
  "customer": "cus_ccc",
  "items": {
    "object": "list",
    "data": [
      {
        "id": "si_mmm",
        "object": "subscription_item",
        "billing_thresholds": null,
        "created": 1585423349,
        "metadata": {
        },
        "plan": {
          "id": "s2_plan_iii",
          "object": "plan",
          "active": true,
          "aggregate_usage": null,
          "amount": 6900,
          "amount_decimal": "6900",
          "billing_scheme": "per_unit",
          "created": 1585332440,
          "currency": "usd",
          "interval": "day",
          "interval_count": 31,
          "livemode": true,
          "metadata": {
            "recurring": "true",
            "recurring_times": "-1"
          },
          "nickname": null,
          "product": "s2_prod_nnn",
          "tiers": null,
          "tiers_mode": null,
          "transform_usage": null,
          "trial_period_days": 31,
          "usage_type": "licensed"
        },
        "quantity": 1,
        "subscription": "sub_lll",
        "tax_rates": [
        ]
      }
    ],
    "has_more": false,
    "total_count": 1,
    "url": "/v1/subscription_items?subscription=sub_lll"
  },
  "livemode": true,
  "metadata": {
    "tax_info": "{"trial_tax":"0.00","trial_tax_per":"0%","tax":"0.00","tax_per":"0%"}"
  },
  "status": "trialing",
  "application_fee_percent": null,
  "billing": "charge_automatically",
  "billing_cycle_anchor": 1588101748,
  "billing_thresholds": null,
  "cancel_at": null,
  "cancel_at_period_end": false,
  "canceled_at": null,
  "collection_method": "charge_automatically",
  "created": 1585423348,
  "current_period_end": 1588101748,
  "current_period_start": 1585423348,
  "days_until_due": null,
  "default_payment_method": null,
  "default_source": null,
  "default_tax_rates": [
  ],
  "discount": null,
  "ended_at": null,
  "invoice_customer_balance_settings": {
    "consume_applied_balance_on_void": true
  },
  "latest_invoice": {
    "id": "in_ooo",
    "object": "invoice",
    "account_country": "CA",
    "account_name": "CompanyName",
    "amount_due": 67200,
    "amount_paid": 67200,
    "amount_remaining": 0,
    "application_fee_amount": null,
    "attempt_count": 1,
    "attempted": true,
    "auto_advance": false,
    "billing": "charge_automatically",
    "billing_reason": "subscription_create",
    "charge": "ch_ppp",
    "collection_method": "charge_automatically",
    "created": 1585423348,
    "currency": "usd",
    "custom_fields": null,
    "customer": "cus_ccc",
    "customer_address": null,
    "customer_email": "first.last@emailcompany.com",
    "customer_name": "First Last",
    "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,
    "due_date": null,
    "ending_balance": 0,
    "footer": null,
    "hosted_invoice_url": "https://pay.stripe.com/invoice/acct_ppp/invst_ttt",
    "invoice_pdf": "https://pay.stripe.com/invoice/acct_ppp/invst_ttt/pdf",
    "lines": {
      "object": "list",
      "data": [
        {
          "id": "ii_uuuI",
          "object": "line_item",
          "amount": 16800,
          "currency": "usd",
          "description": "Initial period",
          "discountable": true,
          "invoice_item": "ii_uuuI",
          "livemode": true,
          "metadata": {
          },
          "period": {
            "end": 1585423348,
            "start": 1585423348
          },
          "plan": null,
          "proration": false,
          "quantity": 1,
          "subscription": null,
          "tax_amounts": [
          ],
          "tax_rates": [
          ],
          "type": "invoiceitem",
          "unique_id": "il_vvv"
        },
        {
          "id": "ii_xxx",
          "object": "line_item",
          "amount": 16800,
          "currency": "usd",
          "description": "Initial period",
          "discountable": true,
          "invoice_item": "ii_xxx",
          "livemode": true,
          "metadata": {
          },
          "period": {
            "end": 1585423303,
            "start": 1585423303
          },
          "plan": null,
          "proration": false,
          "quantity": 1,
          "subscription": null,
          "tax_amounts": [
          ],
          "tax_rates": [
          ],
          "type": "invoiceitem",
          "unique_id": "il_yyy"
        },
        {
          "id": "ii_zzz",
          "object": "line_item",
          "amount": 16800,
          "currency": "usd",
          "description": "Initial period",
          "discountable": true,
          "invoice_item": "ii_zzz",
          "livemode": true,
          "metadata": {
          },
          "period": {
            "end": 1585423262,
            "start": 1585423262
          },
          "plan": null,
          "proration": false,
          "quantity": 1,
          "subscription": null,
          "tax_amounts": [
          ],
          "tax_rates": [
          ],
          "type": "invoiceitem",
          "unique_id": "il_1a1a1a"
        },
        {
          "id": "ii_1b1b1b",
          "object": "line_item",
          "amount": 16800,
          "currency": "usd",
          "description": "Initial period",
          "discountable": true,
          "invoice_item": "ii_1b1b1b",
          "livemode": true,
          "metadata": {
          },
          "period": {
            "end": 1585423211,
            "start": 1585423211
          },
          "plan": null,
          "proration": false,
          "quantity": 1,
          "subscription": null,
          "tax_amounts": [
          ],
          "tax_rates": [
          ],
          "type": "invoiceitem",
          "unique_id": "il_1c1c1c"
        },
        {
          "id": "sli_sss",
          "object": "line_item",
          "amount": 0,
          "currency": "usd",
          "description": "Trial period for CompanyName ProductName",
          "discountable": true,
          "livemode": true,
          "metadata": {
            "tax_info": "{"trial_tax":"0.00","trial_tax_per":"0%","tax":"0.00","tax_per":"0%"}"
          },
          "period": {
            "end": 1588101748,
            "start": 1585423348
          },
          "plan": {
            "id": "s2_plan_iii",
            "object": "plan",
            "active": true,
            "aggregate_usage": null,
            "amount": 6900,
            "amount_decimal": "6900",
            "billing_scheme": "per_unit",
            "created": 1585332440,
            "currency": "usd",
            "interval": "day",
            "interval_count": 31,
            "livemode": true,
            "metadata": {
              "recurring": "true",
              "recurring_times": "-1"
            },
            "nickname": null,
            "product": "s2_prod_nnn",
            "tiers": null,
            "tiers_mode": null,
            "transform_usage": null,
            "trial_period_days": 31,
            "usage_type": "licensed"
          },
          "proration": false,
          "quantity": 1,
          "subscription": "sub_lll",
          "subscription_item": "si_mmm",
          "tax_amounts": [
          ],
          "tax_rates": [
          ],
          "type": "subscription",
          "unique_id": "il_1d1d1d"
        }
      ],
      "has_more": false,
      "total_count": 5,
      "url": "/v1/invoices/in_ooo/lines"
    },
    "livemode": true,
    "metadata": {
    },
    "next_payment_attempt": null,
    "number": "rrr",
    "paid": true,
    "payment_intent": {
      "id": "pi_kkk",
      "object": "payment_intent",
      "amount": 67200,
      "amount_capturable": 0,
      "amount_received": 67200,
      "application": null,
      "application_fee_amount": null,
      "canceled_at": null,
      "cancellation_reason": null,
      "capture_method": "automatic",
      "charges": {
        "object": "list",
        "data": [
          {
            "id": "ch_ppp",
            "object": "charge",
            "amount": 67200,
            "amount_refunded": 0,
            "application": null,
            "application_fee": null,
            "application_fee_amount": null,
            "balance_transaction": "txn_1e1e1e",
            "billing_details": {
              "address": {
                "city": null,
                "country": null,
                "line1": null,
                "line2": null,
                "postal_code": "55057",
                "state": null
              },
              "email": "first.last@emailcompany.com",
              "name": "First Last",
              "phone": null
            },
            "captured": true,
            "created": 1585423349,
            "currency": "usd",
            "customer": "cus_ccc",
            "description": "Subscription creation",
            "destination": null,
            "dispute": null,
            "disputed": false,
            "failure_code": null,
            "failure_message": null,
            "fraud_details": {
            },
            "invoice": "in_ooo",
            "livemode": true,
            "metadata": {
            },
            "on_behalf_of": null,
            "order": null,
            "outcome": {
              "network_status": "approved_by_network",
              "reason": null,
              "risk_level": "normal",
              "seller_message": "Payment complete.",
              "type": "authorized"
            },
            "paid": true,
            "payment_intent": "pi_kkk",
            "payment_method": "pm_jjj",
            "payment_method_details": {
              "card": {
                "brand": "visa",
                "checks": {
                  "address_line1_check": null,
                  "address_postal_code_check": "pass",
                  "cvc_check": "pass"
                },
                "country": "US",
                "exp_month": 9,
                "exp_year": 2099,
                "fingerprint": "fff",
                "funding": "debit",
                "installments": null,
                "last4": "9999",
                "network": "visa",
                "three_d_secure": null,
                "wallet": null
              },
              "type": "card"
            },
            "receipt_email": "first.last@emailcompany.com",
            "receipt_number": "1e1e1e",
            "receipt_url": "https://pay.stripe.com/receipts/acct_ppp/ch_ppp/rcpt_qqq",
            "refunded": false,
            "refunds": {
              "object": "list",
              "data": [
              ],
              "has_more": false,
              "total_count": 0,
              "url": "/v1/charges/ch_ppp/refunds"
            },
            "review": null,
            "shipping": null,
            "source": null,
            "source_transfer": null,
            "statement_descriptor": null,
            "statement_descriptor_suffix": null,
            "status": "succeeded",
            "transfer_data": null,
            "transfer_group": null
          }
        ],
        "has_more": false,
        "total_count": 1,
        "url": "/v1/charges?payment_intent=pi_kkk"
      },
      "client_secret": "pi_kkk_secret_1f1f1f",
      "confirmation_method": "automatic",
      "created": 1585423348,
      "currency": "usd",
      "customer": "cus_ccc",
      "description": "Subscription creation",
      "invoice": "in_ooo",
      "last_payment_error": null,
      "livemode": true,
      "metadata": {
      },
      "next_action": null,
      "on_behalf_of": null,
      "payment_method": "pm_jjj",
      "payment_method_options": {
        "card": {
          "installments": null,
          "request_three_d_secure": "automatic"
        }
      },
      "payment_method_types": [
        "card"
      ],
      "receipt_email": null,
      "review": null,
      "setup_future_usage": "off_session",
      "shipping": null,
      "source": null,
      "statement_descriptor": null,
      "statement_descriptor_suffix": null,
      "status": "succeeded",
      "transfer_data": null,
      "transfer_group": null
    },
    "period_end": 1585423348,
    "period_start": 1585423348,
    "post_payment_credit_notes_amount": 0,
    "pre_payment_credit_notes_amount": 0,
    "receipt_number": "1e1e1e",
    "starting_balance": 0,
    "statement_descriptor": null,
    "status": "paid",
    "status_transitions": {
      "finalized_at": 1585423348,
      "marked_uncollectible_at": null,
      "paid_at": 1585423350,
      "voided_at": null
    },
    "subscription": "sub_lll",
    "subtotal": 67200,
    "tax": null,
    "tax_percent": null,
    "total": 67200,
    "total_tax_amounts": [
    ],
    "webhooks_delivered_at": null
  },
  "next_pending_invoice_item_invoice": null,
  "pause_collection": null,
  "pending_invoice_item_interval": null,
  "pending_setup_intent": null,
  "pending_update": null,
  "plan": {
    "id": "s2_plan_iii",
    "object": "plan",
    "active": true,
    "aggregate_usage": null,
    "amount": 6900,
    "amount_decimal": "6900",
    "billing_scheme": "per_unit",
    "created": 1585332440,
    "currency": "usd",
    "interval": "day",
    "interval_count": 31,
    "livemode": true,
    "metadata": {
      "recurring": "true",
      "recurring_times": "-1"
    },
    "nickname": null,
    "product": "s2_prod_nnn",
    "tiers": null,
    "tiers_mode": null,
    "transform_usage": null,
    "trial_period_days": 31,
    "usage_type": "licensed"
  },
  "quantity": 1,
  "schedule": null,
  "start": 1585423348,
  "start_date": 1585423348,
  "tax_percent": null,
  "trial_end": 1588101748,
  "trial_start": 1585423348
}

payment_intent.created
{
  "id": "pi_kkk",
  "object": "payment_intent",
  "last_payment_error": null,
  "livemode": true,
  "next_action": null,
  "status": "requires_source",
  "allowed_source_types": [
    "card"
  ],
  "amount": 67200,
  "amount_capturable": 0,
  "amount_received": 0,
  "application": null,
  "application_fee_amount": null,
  "canceled_at": null,
  "cancellation_reason": null,
  "capture_method": "automatic",
  "charges": {
    "object": "list",
    "data": [
      {
        "id": "ch_ppp",
        "object": "charge",
        "amount": 67200,
        "amount_refunded": 0,
        "application": null,
        "application_fee": null,
        "application_fee_amount": null,
        "balance_transaction": "txn_1e1e1e",
        "billing_details": {
          "address": {
            "city": null,
            "country": null,
            "line1": null,
            "line2": null,
            "postal_code": "55057",
            "state": null
          },
          "email": "first.last@emailcompany.com",
          "name": "First Last",
          "phone": null
        },
        "captured": true,
        "created": 1585423349,
        "currency": "usd",
        "customer": "cus_ccc",
        "description": "Subscription creation",
        "destination": null,
        "dispute": null,
        "disputed": false,
        "failure_code": null,
        "failure_message": null,
        "fraud_details": {
        },
        "invoice": "in_ooo",
        "livemode": true,
        "metadata": {
        },
        "on_behalf_of": null,
        "order": null,
        "outcome": {
          "network_status": "approved_by_network",
          "reason": null,
          "risk_level": "normal",
          "seller_message": "Payment complete.",
          "type": "authorized"
        },
        "paid": true,
        "payment_intent": "pi_kkk",
        "payment_method": "pm_jjj",
        "payment_method_details": {
          "card": {
            "brand": "visa",
            "checks": {
              "address_line1_check": null,
              "address_postal_code_check": "pass",
              "cvc_check": "pass"
            },
            "country": "US",
            "exp_month": 9,
            "exp_year": 2099,
            "fingerprint": "fff",
            "funding": "debit",
            "installments": null,
            "last4": "9999",
            "network": "visa",
            "three_d_secure": null,
            "wallet": null
          },
          "type": "card"
        },
        "receipt_email": "first.last@emailcompany.com",
        "receipt_number": "1e1e1e",
        "receipt_url": "https://pay.stripe.com/receipts/acct_ppp/ch_ppp/rcpt_qqq",
        "refunded": false,
        "refunds": {
          "object": "list",
          "data": [
          ],
          "has_more": false,
          "total_count": 0,
          "url": "/v1/charges/ch_ppp/refunds"
        },
        "review": null,
        "shipping": null,
        "source": null,
        "source_transfer": null,
        "statement_descriptor": null,
        "statement_descriptor_suffix": null,
        "status": "succeeded",
        "transfer_data": null,
        "transfer_group": null
      }
    ],
    "has_more": false,
    "total_count": 1,
    "url": "/v1/charges?payment_intent=pi_kkk"
  },
  "client_secret": "pi_kkk_secret_1f1f1f",
  "confirmation_method": "automatic",
  "created": 1585423348,
  "currency": "usd",
  "customer": "cus_ccc",
  "description": "Subscription creation",
  "invoice": "in_ooo",
  "metadata": {
  },
  "next_source_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_options": {
    "card": {
      "installments": null,
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": [
    "card"
  ],
  "receipt_email": null,
  "review": null,
  "setup_future_usage": null,
  "shipping": null,
  "source": null,
  "statement_descriptor": null,
  "statement_descriptor_suffix": null,
  "transfer_data": null,
  "transfer_group": null
}

Weā€™re getting thereā€¦this looks like the 4 responses. Can you add in the request(s). That isā€¦is this 4 responses from 1 request or 4 responses for 4 sequential requests.

We need the full sequence to analyse (Req/Resp, Req/Resp, Req/Resp,Req/Resp). What weā€™re trying to determine is if this is an s2Member error or a plug-in interaction error (e.g. nested shortcode loop).

I can confirm this will be 4 separate requests. I managed to replicate myself the error, doing nothing different to normal. Only thing I have found it to occur on is during new customer creation. It will fail payment first x amount of times and then when it finally goes through it will charge the customer the amount multiplied by number of attempts.

Cheers @jiberson - whether from you or from @CommonJuke we all just need to see the quad message req/resp sequence in entirety to figure out where the error is coming from.

Q1: You said you managed to replicate thisā€¦do you mean that you have seen it before or that you can you replicate it in Stripe test mode?

Q2: Assuming the answer to Q1 is that you can replicate in Stripe test mode, can you replicate it at will or is it intermittent (once out of 100 attempts)?

Thanks @onepresstech! Perhaps I am looking in the wrong place? When I click into the four transactions I show in my screenshot above (the screenshot with the blue boxes), I only see response/request for the final successful transaction.

The three ā€œcanceledā€ ones only have the logs I sent. I donā€™t see any request/response. This is representative of what I see for those three:

Cheers @CommonJuke - I havenā€™t had to debug in Stripe for years. I had thought there was access to logs via their devloper tools area:

This is still happening, I think - just had one of our new members charged twice on the same day, when they only have one payment agreement. Sheā€™s now cancelled her membership as she canā€™t trust us. Itā€™s getting more critical every day that Stripe is fixed.Any idea on progress???

image

Thank you for pointing that out @onepresstech, I didnā€™t know to look there! There are a LOT of logs there though. The quadruple charge has twenty logs:


Do you need all of them or just a subset. Itā€™ll take a while for me to redact all of them.

Like @jiberson, we rolled back to October release around March 29th, and it seems to be preventing duplicate charges.

But something happened that may be a clue. A customer made two failed payment attempts before the rollback, then made the purchase after the rollback. This person got triple charged:

Thatā€™s what we have been looking forā€¦data. Itā€™s hard to debug analytically without data :slight_smile:

What we are trying to determine is ā€œWhy would there be 4 sequential repeat transactions that result in an aggregated priceā€. It seems unlikely that this is a Stripe or obvious S2Member error otherwise there would be more reports. I have a number of sites deployed and have never experienced this and I have been using S2Meember for yearsā€¦

So there are three likely culprits:

  1. Custom code hooking S2Member
  2. Plugin that uses some of the same names for data objects and functions as S2Member
  3. Nested Shortcodes causing a recursion loop

The first thing I would do is to look at the 400 & 402 errors. Whatā€™s going on there!

UPDATE: I have had this issue occur with one of my clients. Technically I am in a position to trace this down so I will work on it today and update the results here. I have also pinged @clavaque to see how quickly he can push out a release once I find a fix.

Bug: If a subscription payment fails, S2member / Stripe combo is not clearing the invoice and subsequent payment retries are aggregating the invoiced amount so when the payment finally succeeds the charge amount is a multiple of the true amountā€¦sometimes 3-4 times the value. To fix this requires a refund to the client which looks bad and incurs Stripe fee.

Solution: I will spend today tracing this down. On first analysis it looks like a flaw in S2member code that is triggering an edge error in Stripeā€¦so we have a Christmas tree problem. Since this did not happen previously something has changed in S2member and / or Stripe. I looked at some of the recent Stripe API changes and there are a few that raised my concerns. There have also been some Stripe-related changes in GitHub commit-deltas for s2memberPro that I will double check for a clash with the new Stripe API rules. There have been some changes regarding trials and Visa-3D that may be involved.

Stay tunedā€¦I will fix this today.

2 Likes

Thank you so much Tim for calling my attention to this issue and all the valuable research you did on your end, and the insight you provided me with to help me understand where this issue could be coming from!

I canā€™t say with certainty that everyone here is experiencing the same problem, although they look similar. My guess is that the issue happens when there is a paid trial term for a subscription, and the subscription creation fails but the invoice item for the initial term succeeded. Each time the subscription is attempted, a new invoice item was created, until the subscription finally succeeds and all items from the previous attempts are charged.

Tim told me that heā€™s seeing the problem with a paid trial sub. I also see the invoice item in Alanā€™s log. I think Jamesā€™ is also the case. I donā€™t have enough info from Tim or Corey to say if their cases are the same.

I was able to reproduce the duplicate invoice item behavior with paid trials in my tests. I found how to avoid duplicates, and fixed the problem in my tests.

Iā€™m attaching the updated file for you to test if you can, please. 200413b-stripe-utilities.inc.zip (11.6 KB)

Itā€™s not a full release of s2Member Pro, itā€™s just the relevant file for s2Member Pro v200301. It goes here: s2member-pro/src/includes/classes/gateways/stripe/stripe-utilities.inc.php

I look forward to your feedback.

:slight_smile:

I confirm that the behaviour outlined by Tim Hibberd is one of the Stripe issues weā€™ve seen. Thank you all for your work in resolving. The other one is the month = 30 days issue, which is clearly wrong and is causing our members a big headache.

Yes, that is what is happening for me as well. I just tested it onmy test site in test mode on Stripe and I was able to reproduce that.

UPDATE: Iā€™m still in dialogue with Christian on this issue.

The fix Cristian provided in the zipfile above adds support for failed message retry protection which alleviates our problem in as a benign side-effect but only if the final successful payment occurs within 24 hours of the failed payments. If the failed payment subsequently succeeds more than 48 hours later then the aggregated payment bug will still occur (which is the case that occured for meā€¦the bank must have ben having a slow day and failed the 2 payment attempts then the Stripe retry mechanism kicked 2 days later and the payment succeeded).

This bug appears to be associated with new Stripe logic introduced to address some new requirements from VISA w.r.t. trials. Basically, Stripe now considers a subscription created even if the payment fails and considers all subsequent requests to be amendments with additional payments EVEN IF THEY ARE FAILED PAYMENTS (Say WHAT! Iā€™m not sure what the Stripe gang were thinking when they decided that logic gem). Weā€™re still working to determine the appropriate adjustment. It may require a change to the s2member payment retry logic. Not sure. Weā€™ll update you when we sort that out.

1 Like

@onepresstech Thank you so much for the update and your ongoing attention and effort on fixing this bug!

No worries Alan. This is taking longer to fix than planned. I had a client who had a COVID-related sale that generated a lot of traffic and managed to trip three stripe-related payment issues. The sale is over so now I can put some more time tracking these three bugs down. Summarising:

Bug1 (as stated previously): If a subscription payment fails, S2member / Stripe combo is not clearing the invoice and subsequent payment retries are aggregating the invoiced amount so when the payment finally succeeds the charge amount is a multiple of the true amountā€¦sometimes 3-4 times the value. To fix this requires a refund to the client which looks bad and incurs Stripe fee. The code issue here is likely related to new Stripe logic for VISA trials and SCA. Solution likely involves an adjustment to the S2 payment retry logic.

Bug2: Duplicate payments 1 minute apart for the same transaction (i.e. a single subscription in the name of the user even though two payments are successfully processed). This is likely a JavaScript bug involving the multi-transaction lockout logic AND a problem with the way transaction IDs are being handled (There is no logical reason for Stripe to endup processing 2 transactions for identical subscriptions with minor ID variations and ending up with a single subscription in the userā€™s name)

Bug3: I had a S2member L2 transaction occur from a user (user1) and then a L3 transaction from a different user (user2) but the user profiles in WordPress were tagged with a role that was mismatchedā€¦user1 had an L3 role and user2 had a L2 role. That oneā€™s going to be tough to reproduce / track-down. Oh wellā€¦no one every said being a coder was easy :slight_smile:

Hereā€™s a new fix for the paid trial. The previous fix worked, but Iā€™m afraid it may not fully take care of it under all situations. I think this new one would be more reliable.

Iā€™m attaching the file as before, for you to test if you want before the release. 200422a-stripe-utilities.inc.zip (11.4 KB)

I look forward to your feedback. :slight_smile:

Cheers @clavaque - did you end up having to modify the payment retry logic?

No. s2Member doesnā€™t touch the payment retry, thatā€™s done by Stripe. That wasnā€™t touched at all by this.