Stripe Invoice Payment Links

21 views
Skip to first unread message

Michael Bernstein

unread,
Jan 26, 2021, 5:50:51 PM1/26/21
to Accelo Developers
Hi All -

I am setting up an invoice reminder workflow and I want to include the stripe payment link, but I am having some trouble figuring out how the invoice number is encoded in the payment link so I can generate it for a reminder email. Is it possible to get this info using the API or is there a formula or encoding method used?

Example:

Payment Link Invoice ID: 814fbbdae94923d06191ed6fb7ad4f93
Invoice ID: 1705

Any help would be appreciated!

Geoff McQueen

unread,
Jan 29, 2021, 9:27:08 AM1/29/21
to Accelo Developers
Hi there,

There's actually two ways - one is to see all of the invoices for a Company, and the other is to see just one Invoice (which was your question). 

Because the interface for payments doesn't have any authentication (you want someone in an accounts payable role to pay you with a minimum of friction), it is important that a bad actor can't just iterate through numeric IDs to see all your outstanding invoices. However, if you know the specific values on the object (including in the case of a company record, the to the second created date), you can (and should) be able to recreate the "key".

For the Company:
This is an MD5 of a prefix string, the Company ID and the invoice created timestamp in UNIXTIME/Epoch seconds. Here's the calc in MySQL format:
MD5(CONCAT('AL',company.id,UNIX_TIMESTAMP(company.created)))

For the Invoice:
The construct of the Key value (in MySQL in this case) you need to know the Invoice ID and the affiliation_id the invoice is against, using:
MD5(CONCAT('AL',account_invoice.id,account_invoice.affiliation_id))

Obviously you will want to use whatever function calls and variable names you want in your own code (since you'll be pulling them back from the API, you don't be using MySQL I imagine). Note also the prefixed string of AL which helps to reduce key-collision (slightly) and increases obscurity (which isn't a big issue given the need to know these distinct IDs exactly). 

Hope this helps,

Geoff



Michael Bernstein

unread,
Feb 1, 2021, 4:14:02 PM2/1/21
to Accelo Developers
Thank you so much!
Reply all
Reply to author
Forward
0 new messages