2
votes

I am trying to automate my monthly flow of doing some math and sending people Google Pay requests using Google Apps Script. Right now my script sends people email with what is due but I would like to also attach GPay request in the email or just send GPay request alone.

Background -

I receive an email from a phone service every month with the bill amount. I split that with a group of 4-5 people depending on their usage and any overages they may have. My script correctly finds out the email and parses to find out the total amount due and then also goes ahead and figures out who owes me how much. I pay the entire bill and then collect money from other people. In the end, the script sends each person an email with the amount they owe me each month.

Problem -

tbh, it is not a "problem" as such but this is an enhancement I would like to add. Gmail allows attaching Google Pay request in the email. (Please see screenshot). I would like to enhance my script so that I can attach such a Payment request in the email that this script sends out.

My question is if this is at all possible?

enter image description here

References

Google Apps Script

Google Apps Script Console

Google Pay API

For my use case, it does not have to be an email with Google Pay attachment. It can just be a Google Pay request.

1
Welcome to StackOverFlow please take this opportunity to take the tour and learn how to How to Ask and minimal reproducible example.Cooper
@Cooper thank you. Although I am not new to SO, I thought that question was self-explanatory. I get it, everyone always thinks their own question is explanatory but it may not be so for a third person. Honestly there is nothing more I could explain better about it but I will try my best.hvkale
For web applications, Google Pay is implemented in client side JavaScript code. It doesn't use server side code, and it doesn't have a REST API, as far as I can tell. So, you can't use Apps Script server code. The first prerequisite for using Google Pay is to have a webpage served with HTTPS that has a TLS domain-validated certificate.Alan Wells

1 Answers

0
votes

Unfortunately the public Google Pay APIs aren't set up for this.

Unless you happen to also be registered as a merchant and are able receive payments I would avoid this.

If on the other hand you are an existing Google Pay merchant and you're interested in doing it for giggles, you could try the following:

  1. Create a webpage that you can link to in your email
    1. Have the webpage accept required query string parameters (like amount and description)
    2. Render payment information (like amount and description) and integrate the Google Pay Button
  2. Embed the link in your email

IMHO this isn't practical at all... it just depends on how desperate you are for giggle.