#wiiim

1 messages ยท Page 1 of 1 (latest)

signal arrowBOT
wanton hemlock
#

Hello ๐Ÿ‘‹
Can you share more details?

dim lava
#

Sure ๐Ÿ™‚
I'm trying to get the receipt number from either the invoice/charge object
Basically I want to sent the receipt via email to my customers on my own, not via stripe.
I wanted to use the receipt_number on the receipt email so it's kept in sync for easier tracking if the customer contacts me.
I now read on the docs that the receipt_number "will be null until a receipt has been sent."
I checked it and the receipt number is only present if I once viewed the Receipt via the dashboard.
Is there a way to generate that number programmitcally?

wanton hemlock
#

hmm, I don't think there's a way to generate the receipt_number without sending it unfortunately.

dim lava
#

Well technically I wasn't sending it via the dashboard, I just viewed it.

wanton hemlock
#

As far as I know, that field is generated and filled when the user gets the email and visits the hosted page.
I think viewing the receipt via the dashboard also follows the same logic.

Quick question, do you see a receipt_url on the charge instead?

dim lava
#
"receipt_number": null,
"receipt_url": "https://pay.stripe.com/receipts/invoices/CAcaFwoVYWNjdF8xTFE4dWdCZWRQZ3IwWnYyKN3ji6EGMgYdS6aspds6LBZOndRIpRMfAKK8P_az8c21K9xqUR9cp6nipKg421gOm3PshdRk5TEy7Qlz?s=ap",
#

Yes

#

Can I decode the CA... part with my secret key or something like that?

wanton hemlock
#

unfortunately, no. However, you could try sending a curl/get request to the url and see if the API counts that as a visit to the page and fills the receipt_number parameter

dim lava
#

Okay, will try that.
One more question came up to my mind now: I also want to show the PaymentMethod used on the receipt. I get the ID from the webhook event invoice.payment_succeeded. With that I need to make another request to stripe's api to get the whole PaymentMethod object. Is there a way to like expand the webhook data that stripe sents so I do not need to fetch the payment method again? Would also consider the charge object too I guess.

#

(curl command actually did work, a little bit ugly to do in code, but I think that's my way to go)

wanton hemlock
dim lava
#

Alright, thank you ๐Ÿ™‚ Got it working now