I want to use stripe payment system in the addons
The payment method can be Card/Wallet
Once the payment is successful (auto subscription or manual checkout) I need to send the activation code. The next year when the charge is successful I need to send the activation key again if the payment is successful
I see there are many events in the Stripe payment webhooks
I have used charge.succeeded event listener and it does send me the object (pasted below). I have one issue here. If I rely on this charge.succeeded object I find no information on which product the purchase is made.
The response does have user supplied email but there is no way I find the metadata or product code in the charge.succeeded object
How do I find the product name on which the charge was successful?
Test card number: 4242 4242 4242 4242
Any help is greatly appreciated
{
  "id": "evt_1KWzCbHpIo9Nhh5aYEv7XlY8",
  "object": "event",
  "api_version": "2017-12-14",
  "created": 1645777861,
  "data": {
    "object": {
      "id": "ch_1KWzCaHpIo9Nhh5atK09dpaO",
      "object": "charge",
      "amount": 100,
      "amount_captured": 100,
      "amount_refunded": 0,
      "application": null,
      "application_fee": null,
      "application_fee_amount": null,
      "balance_transaction": "txn_1KWzCaHpIo9Nhh5anEebLs4X",
      "billing_details": {
        "address": {
          "city": null,
          "country": "IN",
          "line1": null,
          "line2": null,
          "postal_code": null,
          "state": null
        },
        "email": "te...@email.com",
        "name": "CARDNAME",
        "phone": null
      },
      "calculated_statement_descriptor": "DIGITALTHOUGHTS",
      "captured": true,
      "created": 1645777860,
      "currency": "inr",
      "customer": "cus_LDQ2DBhL2VkPOH",
      "description": "Subscription creation",
      "destination": null,
      "dispute": null,
      "disputed": false,
      "failure_code": null,
      "failure_message": null,
      "fraud_details": {
      },
      "invoice": "in_1KWzCYHpIo9Nhh5ammBkFvU1",
      "livemode": false,
      "metadata": {
      },
      "on_behalf_of": null,
      "order": null,
      "outcome": {
        "network_status": "approved_by_network",
        "reason": null,
        "risk_level": "normal",
        "risk_score": 58,
        "seller_message": "Payment complete.",
        "type": "authorized"
      },
      "paid": true,
      "payment_intent": "pi_1KWzCYHpIo9Nhh5aj6Xgl3tS",
      "payment_method": "pm_1KWzCXHpIo9Nhh5aADMKyWPc",
      "payment_method_details": {
        "card": {
          "brand": "visa",
          "checks": {
            "address_line1_check": null,
            "address_postal_code_check": null,
            "cvc_check": "pass"
          },
          "country": "US",
          "exp_month": 2,
          "exp_year": 2022,
          "fingerprint": "MxtsbEBU2BmJbOn4",
          "funding": "credit",
          "installments": null,
          "last4": "4242",
          "network": "visa",
          "three_d_secure": null,
          "wallet": null
        },
        "type": "card"
      },
      "receipt_email": null,
      "receipt_number": null,
      "receipt_url": "https://pay.stripe.com/receipts/acct_1BhpF1HpIo9Nhh5a/ch_1KWzCaHpIo9Nhh5atK09dpaO/rcpt_LDQ2FDPK6fwsEyBOISiDCItSv8JeNbl",
      "refunded": false,
      "refunds": {
        "object": "list",
        "data": [
        ],
        "has_more": false,
        "total_count": 0,
        "url": "/v1/charges/ch_1KWzCaHpIo9Nhh5atK09dpaO/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
    }
  },
  "livemode": false,
  "pending_webhooks": 1,
  "request": {
    "id": "req_QzrolSFU0OA7D7",
    "idempotency_key": "228c5670-85ea-4047-9f9f-9d1e519ffc2c"
  },
  "type": "charge.succeeded"
}