Skip to content

Instantly share code, notes, and snippets.

@SimonHoiberg
Created June 19, 2020 14:22
Show Gist options
  • Save SimonHoiberg/40fc0d312ad5fb661e094a7c60517a8d to your computer and use it in GitHub Desktop.
Save SimonHoiberg/40fc0d312ad5fb661e094a7c60517a8d to your computer and use it in GitHub Desktop.
const paymentSucceeded = async (dataObject: any) => {
const customerID = dataObject['customer'] as string;
if (!customerID) {
throw Error(`No customer with ID "${customerID}"`);
}
const customerEmail = dataObject['customer_email'] as string;
const customerName = dataObject['customer_name'] as string;
const linkToInvoice = dataObject['hosted_invoice_url'] as string;
// Use the above to send confirmation email with a link to invoice,
// thus enabling the paid functionality.
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment