问题
I was wondering how to achieve same email structure as PayPal has.
It looks like this (in Google's Inbox):
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?
回答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:
来源:https://stackoverflow.com/questions/32574958/how-to-add-paypal-like-structured-data-to-google-email-markup