stripe – how to get promo code information form payment link

I am trying to get promo code information from payments in stripe. It could be either invoice, subscription or payment link. For subscription, I can get it from invoice.paid.

However for payment link, I am having a tough time to find promo code when its applied. The checkout.session.completed event does not have any information. Nor does the payment_intent.succeeded event have it.

Example of payment intent

{
  "object": {
    "id": "pi_3PekrdDLL6mQEvFD2z3EYfXH",
    "object": "payment_intent",
    "amount": 990,
    "amount_capturable": 0,
    "amount_details": {
      "tip": {
      }
    },
    "amount_received": 990,
    "application": null,
    "application_fee_amount": null,
    "automatic_payment_methods": null,
    "canceled_at": null,
    "cancellation_reason": null,
    "capture_method": "automatic_async",
    "client_secret": "pi_3PekrdDLL6mQEvFD2z3EYfXH_secret_8jdd9QUARxzFp7ywewyiQRQ9G",
    "confirmation_method": "automatic",
    "created": 1721511049,
    "currency": "usd",
    "customer": null,
    "description": null,
    "invoice": null,
    "last_payment_error": null,
    "latest_charge": "ch_3PekrdDLL6mQEvFD2SyHUWM2",
    "livemode": false,
    "metadata": {
    },
    "next_action": null,
    "on_behalf_of": null,
    "payment_method": "pm_1PekrdDLL6mQEvFDA0vSPPxG",
    "payment_method_configuration_details": null,
    "payment_method_options": {
      "card": {
        "installments": null,
        "mandate_options": null,
        "network": null,
        "request_three_d_secure": "automatic"
      }
    },
    "payment_method_types": [
      "card"
    ],
    "processing": null,
    "receipt_email": null,
    "review": null,
    "setup_future_usage": null,
    "shipping": null,
    "source": null,
    "statement_descriptor": null,
    "statement_descriptor_suffix": null,
    "status": "succeeded",
    "transfer_data": null,
    "transfer_group": null
  }
}

This for checkecout.session.completed

{
  "object": {
    "id": "cs_test_b14uJHQgleFfeBD5YsOQdSXdC4WRGqQ2OGYm4q6ai704FjIkOem5rBF22G",
    "object": "checkout.session",
    "after_expiration": null,
    "allow_promotion_codes": true,
    "amount_subtotal": 1100,
    "amount_total": 990,
    "automatic_tax": {
      "enabled": false,
      "liability": null,
      "status": null
    },
    "billing_address_collection": "auto",
    "cancel_url": "https://stripe.com",
    "client_reference_id": "9PVT0AMJ",
    "client_secret": null,
    "consent": null,
    "consent_collection": {
      "payment_method_reuse_agreement": null,
      "promotions": "none",
      "terms_of_service": "none"
    },
    "created": 1721511033,
    "currency": "usd",
    "currency_conversion": null,
    "custom_fields": [
      {
        "key": "referralcode",
        "label": {
          "custom": "Referral Code",
          "type": "custom"
        },
        "optional": true,
        "text": {
          "default_value": null,
          "maximum_length": 255,
          "minimum_length": null,
          "value": null
        },
        "type": "text"
      }
    ],
    "custom_text": {
      "after_submit": null,
      "shipping_address": null,
      "submit": null,
      "terms_of_service_acceptance": null
    },
    "customer": null,
    "customer_creation": "if_required",
    "customer_details": {
      "address": {
        "city": null,
        "country": "US",
        "line1": null,
        "line2": null,
        "postal_code": "07310",
        "state": null
      },
      "email": "[email protected]",
      "name": "123",
      "phone": null,
      "tax_exempt": "none",
      "tax_ids": [
      ]
    },
    "customer_email": null,
    "expires_at": 1721597433,
    "invoice": null,
    "invoice_creation": {
      "enabled": false,
      "invoice_data": {
        "account_tax_ids": null,
        "custom_fields": null,
        "description": null,
        "footer": null,
        "issuer": null,
        "metadata": {
        },
        "rendering_options": null
      }
    },
    "livemode": false,
    "locale": "auto",
    "metadata": {
    },
    "mode": "payment",
    "payment_intent": "pi_3PekrdDLL6mQEvFD2z3EYfXH",
    "payment_link": "plink_1Ov62mDLL6mQEvFDOyqA0DLX",
    "payment_method_collection": "always",
    "payment_method_configuration_details": {
      "id": "pmc_1Ne5fgDLL6mQEvFDhq2LTqTH",
      "parent": null
    },
    "payment_method_options": {
      "card": {
        "request_three_d_secure": "automatic"
      }
    },
    "payment_method_types": [
      "card"
    ],
    "payment_status": "paid",
    "phone_number_collection": {
      "enabled": false
    },
    "recovered_from": null,
    "saved_payment_method_options": null,
    "setup_intent": null,
    "shipping_address_collection": null,
    "shipping_cost": null,
    "shipping_details": null,
    "shipping_options": [
    ],
    "status": "complete",
    "submit_type": "auto",
    "subscription": null,
    "success_url": "https://stripe.com",
    "total_details": {
      "amount_discount": 110,
      "amount_shipping": 0,
      "amount_tax": 0
    },
    "ui_mode": "hosted",
    "url": null
  }
}

The only event that is created is customer.discount.created which has promo id but customer email is missing.

{
  "object": {
    "id": "di_1PekreDLL6mQEvFDshNIz6fe",
    "object": "discount",
    "checkout_session": "cs_test_b14uJHQgleFfeBD5YsOQdSXdC4WRGqQ2OGYm4q6ai704FjIkOem5rBF22G",
    "coupon": {
      "id": "D3muUbBu",
      "object": "coupon",
      "amount_off": null,
      "created": 1710630574,
      "currency": null,
      "duration": "once",
      "duration_in_months": null,
      "livemode": false,
      "max_redemptions": null,
      "metadata": {
      },
      "name": "williamette",
      "percent_off": 10,
      "redeem_by": null,
      "times_redeemed": 17,
      "valid": true
    },
    "customer": null,
    "end": null,
    "invoice": null,
    "invoice_item": null,
    "promotion_code": "promo_1Ov6MmDLL6mQEvFDcPVK9bfM",
    "start": 1721511050,
    "subscription": null,
    "subscription_item": null
  }
}

How do I get this information for payment link? Which event is the best to see if payment has promo code or not for any payment (subscription, invoice, payment link)

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật