1

I was wondering how to achieve same email structure as PayPal has.

It looks like this (in Google's Inbox):

Email, showing PayPal logo, and reading 'Receipt for Coursera, Inc.', listing amount, issuer, date and confirmation number

But I can't find right type for it here: https://developers.google.com/gmail/markup/reference/

Any idea how to achieve the PayPal-like markup?

unor
  • 92,415
  • 26
  • 211
  • 360
Uros K
  • 3,274
  • 4
  • 31
  • 45
  • I couldn't find the markup to achieve this on Google's online documentation as well. I started researching schema.org after @AaronP (http://stackoverflow.com/questions/32304322/defining-a-bill-or-invoice-using-google-email-markup) about the markup as well. It looks like they're using the "Invoice" (https://schema.org/Invoice) markup. I've tested the json/microdata examples provided on the schema.org documentation, however, it didn't trigger anything in Inbox. You could also try looking at the raw source of your PayPal email and look for the markup in it. Check the documentation for updates. – Franco Sep 15 '15 at 17:51
  • Check out my answer below and let me know if this is what you're trying to achieve. – Franco Sep 21 '15 at 22:47
  • 1
    check out Google's updated documentation for invoices https://developers.google.com/gmail/markup/reference/invoice. – Franco Oct 27 '15 at 16:51

1 Answers1

1

Using schema.org/Invoice and schema.org/PayAction, I was able to get the email structure that you've posted from PayPal. It also generated a "View Bill" button, which only shows in Inbox and not Gmail. Check out my example script below. The email markup tester seemed to like it, there were no errors found. Try sending it using this Gmail Schema Tester or through Apps Script with your Gmail account.

 <script type="application/ld+json">
[
{
    "@context": "http://schema.org",
    "@type": "Invoice",
    "description": "January 2015 Acme Bill",
    "url": "https://www.americanexpress.com",
    "accountId": "xxxx-xxxx-xxxx-1234",
    "potentialaction": {
      "url": "https://example.com",
      "@type": "PayAction"
    },
    "paymentDue": "2020-01-30",
    "minimumPaymentDue": {
      "@type": "PriceSpecification",
      "price": "$15.00"
    },
    "totalPaymentDue": {
      "@type": "PriceSpecification",
      "price": "$200.00"
    },
    "paymentStatus": "payment due",
    "provider": {
      "@type": "Organization",
      "name": "Acme Bank"
 }
}
]
    </script>

You should get this:

enter image description here

Franco
  • 566
  • 3
  • 12