#heleem

1 messages ยท Page 1 of 1 (latest)

woeful tartanBOT
potent lava
#

Did you pass the raw request body from the firebase request with firebaseRequest.rawBody?

app.post('/', async (req, res) => {
  // ...
  const firebaseRequest = req as https.Request
  event = stripe.webhooks.constructEvent(
    firebaseRequest.rawBody,
    sig,
    ENDPOINT_SECRET,
  )
  // ...
}
raw prawn
#

Yes I have tried to use like this but it is giving error like success_url is missing and other time it gave error for another parameter. I was trying to call webhook for payment_intent.succeeded

potent lava
#

stripe.webhooks.constructEvent is for event signature validation. Where did you see "error like success_url is missing and other time it gave error for another parameter" from as this function doesn't throw these errors?

raw prawn
#

I tried it again and it is working now but it wasn't working earlier. Is there anything I need to change?

potent lava
#

If it's working now, then you shouldn't need to change anything

raw prawn
#

Okay, Thank you.

potent lava
#

No problem! Happy to help ๐Ÿ˜„

raw prawn
#

Hello,
I have question for the invoices,
Can we get the direct downloadable link for the invoice from the API?

potent lava
woeful tartanBOT
raw prawn
#

Okay. And how can we get the invoice id from the payment_intent.succeeded webhook ?

true kraken
#

It's inside the payload

#

Have you looked at the payload?

raw prawn
#
  "id": "pi_3NXKhsSAbls2I3yI0P3uyT4g",
  "object": "payment_intent",
  "amount": 110000,
  "amount_capturable": 0,
  "amount_details": {
    "tip": {}
  },
  "amount_received": 110000,
  "application": null,
  "application_fee_amount": 10000,
  "automatic_payment_methods": null,
  "canceled_at": null,
  "cancellation_reason": null,
  "capture_method": "automatic",
  "client_secret": "pi_3NXKhsSAbls2I3yI0P3uyT4g_secret_PxvoXDcnXPU6MsirpCevXqR08",
  "confirmation_method": "automatic",
  "created": 1690189532,
  "currency": "inr",
  "customer": null,
  "description": null,
  "invoice": null,
  "last_payment_error": null,
  "latest_charge": "ch_3NXKhsSAbls2I3yI0FyTttJ6",
  "livemode": false,
  "metadata": {
    "agentId": "qOznsMoV3PNdfZWwJeYIhOJiVDJ3",
    "clientId": "0SxJZAiQg4x0JzeiPwpR"
  },
  "next_action": null,
  "on_behalf_of": null,
  "payment_method": "pm_1NXKhrSAbls2I3yI2r0Oi73I",
  "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": "TEST TESTSET",
  "statement_descriptor_suffix": null,
  "status": "succeeded",
  "transfer_data": {
    "destination": "acct_1NVw7jSF1pNBnPaX"
  },
  "transfer_group": "group_pi_3NXKhsSAbls2I3yI0P3uyT4g"
}```

This is what I am getting
#

event is payment_intent.succeeded and I am using event.data.object

true kraken
raw prawn
#

I am still getting "invoice": null,

#

I have added
invoice_creation: {
enabled: true,
}

true kraken
#

Can you provide the example request id you set invoice_creation?

raw prawn
true kraken
#

It takes long for me to open the Id, gimme some times

raw prawn
#

Okay

true kraken
#

Can you do a Retrieve PaymentIntent API, with expand: ['invoice']?

raw prawn
#

Yes this is the event, let me try for the same

#

I got the invoice details