Stripe receipt url
Asked Answered
D

5

43

From the Stripe dashboard I can view a receipt (click preview link in invoice details). The receipt is then shown inside a popup but there is a permalink in it, so it can be viewed as a separate page. The URL of an emailed receipt looks like this:

https://dashboard.stripe.com/emails/receipts/invrc_xxxxxxxxxxxx

This URL does not require authentication, and so would be perfect for allowing me to show links to receipt details from inside my app's billing page. Except that there seems to be no way to get the magical invrc_xxxxxxxxxxxx id from the API, so I am unable construct the URL.

Or for some strange reason, Stripe engineers went through the trouble of designing an unauthenticated receipt view page, but have decided not to expose it via the API. Why??

This issue has been brought up in Stripe API - Receipts Listing (see comments section at the bottom), but no explanation, solution or justification was provided. Hope this more specific question can help.

UPDATE: As of January 17 2019, this is now possible to do. The Charge object has the receipt_url property that lets you access this information whether an email receipt was sent or not!

Deniable answered 2/3, 2015 at 16:31 Comment(1)
is there any way to get direct receipt pdf URL instead of receipt_url??Septempartite
S
23

That's unfortunately not something currently supported. There isn't any way through the API to get an receipt ID to be used here. That endpoint was built with the intent that it would only be used to permalink to a receipt from the body of a receipt email. That said, we are considering building out this functionality at some point in the future.

EDIT: Looks like my colleagues in Stripe support beat me to the punch here.

UPDATE: as of 2019-01-17, this is now supported via the receipt_url property on Charges (https://stripe.com/docs/api/charges/object#charge_object-receipt_url).

Skeptical answered 3/3, 2015 at 18:1 Comment(9)
This is absolutely a critical feature - anyone wanting to offer customers access to their invoices from within their app (which is common) must now recreate those invoices entirely- which is duplicative and stupid. (Also, can we get invoices as PDFs!) ThanksBr
@peter-raboud Does Stripe have a public feature request site where we can upvote this? We have many, many clients asking to review copies of their receipts or for PDF copies. As Yarin mentioned it would be duplicate work for us to create that on our side and whatever we produce would be unlikely to (continue to) match the Stripe receipts.Oglethorpe
Is this "considering" trackable? This would be very useful (for the customers who need it). It's available in the dashboard... but not scriptable! Which makes no sense.Transposition
any updates on this? does stripe provides this option nowGlanders
04/2018 update from Stripe support: Still not possible. They recommend using one of their invoicing partners (stripe.com/works-with/categories/invoicing).Sunglass
Is this possible with new stripe billing platform?Brade
@peter-raboud So I see a way to get link for hosted pdf invoice, but invoices are not receipts meaning and invoice always shows as unpaid. Can you link to a hosted pdf of the receipt that shows payment was made?Tamratamsky
Is this also applicable on subscription charges?Harelip
With subscription charges the receipt_url on the charge object is just a link to stripe hosted representation of the receipt, containing downloadable links. Is it possible to get the infamous download link: "dashboard.stripe.com/emails/receipts/invrc_xxxxxxxxxxxxxxxxxxx/…"Highlands
P
5

The invoice object has attributes for this:

hosted_invoice_url - string - The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.

invoice_pdf - string - The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.

Priebe answered 5/6, 2018 at 17:31 Comment(1)
Note that invoice links expire 30 days after the invoice due date: stripe.com/docs/invoicing/…Arboriculture
B
1

Solved using screenshot API If you are using React try this but you can just use the ajax request to show the receipt in your app

const [recipt, setrecipt] = useState({loading: false,img: '',});

get the url from the strip response receipt_url const url = receipt_url

const result = await axios.get(`https://screenshotapi.net/api/v1/screenshot url=${url}&token=yourtokenhere`,);

then you can find the png URL from result.data.screenshot then you can use img tag to display it make sure to replace token with yours

Bride answered 8/8, 2020 at 4:36 Comment(0)
W
1

Yes, it's possible

The trick is to give expand: ['latest_charge'] as a parameter. That will return a lot more information for the payment_intent, including a receipt_url.

Example

(this uses ruby but it will be similar for other languages):

require 'stripe'

# Id of payment intent
payment_intent_id = "pi_3NcGv9Bn74CpQJ8BC8kJU"  

# Call api 
response = Stripe::PaymentIntent.retrieve(
  { id: payment_intent_id, expand: ['latest_charge'] }
)

# Access receipt_url
response.latest_charge.receipt_url
=> "https://pay.stripe.com/receipts/payment/CAcaFwmC71adF8xTlp5cVdSVDI4UU1SNUhXKP-SwP0majgw4UwY6LBYjNcus8XsJxgeD71QMWCmZWtZvMwc9hJpJwync86sjFH2gJ0-ukROFt6EA"

Specific styles can be configured here:

enter image description here

Note

  • expand: ['latest_charge'] tells the API to return not just the id of the latest_charge, but all the associated info as well (including the receipt_url)

References

For Stripe Connect

For Stripe Connect, you must give expand: ['latest_charge'] as a parameter and the stripe account id as an option.

Example:

require 'stripe'

# Id of payment intent
payment_intent_id = "pi_3NcGv9Bn74CpQJ8BC8kJU" 

# Id of account funds were paid to
stripe_account_id = "acct_1NJyqN2Ab3GCK1HW" 

# Call api 
response = Stripe::PaymentIntent.retrieve(
  { id: payment_intent_id, expand: ['latest_charge'] },
  { stripe_account_id: stripe_account_id }
)

# Access receipt_url
response.latest_charge.receipt_url
=> "https://pay.stripe.com/receipts/payment/CAcaFwmC71adF8xTlp5cVdSVDI4UU1SNUhXKP-SwP0majgw4UwY6LBYjNcus8XsJxgeD71QMWCmZWtZvMwc9hJpJwync86sjFH2gJ0-ukROFt6EA"
Washwoman answered 7/8, 2023 at 1:47 Comment(0)
O
0

Is this to resend a new email? There is an option send emails to the customer in the settings on successful payment. Another idea is to have the email send to something like Mandrill for processing and extract the URL:

http://help.mandrill.com/entries/21699367-Inbound-Email-Processing-Overview

Odrick answered 2/3, 2015 at 22:56 Comment(1)
Thanks but no I don't want to resend an email. I want to show the receipt from my app. I just need to be able to construct the invoice receipt url using the Stripe API. This should not require a third party service.Deniable

© 2022 - 2024 — McMap. All rights reserved.