How can i set price label on google payment sheet?
I want to show some labels of tax and shipping charges on gpay sheet. I went through the gpay documentation and applied some solution but I am not getting this label. anyone can give me an idea of how can I add different labels through this request.
i added labels like:
{ displayItems: [ { label: "Subtotal", type: "SUBTOTAL", price: "11.00", }, { label: "Tax", type: "TAX", price: "1.00", } ], currencyCode: "USD", countryCode: "US", totalPriceStatus: "FINAL", totalPrice: "12.00", totalPriceLabel: "Total", checkoutOption: "DEFAULT",
}
but not getting any displayItems or totalPriceLabel on google pay sheet.
Hi @chiragsharma991 this is something we may need to add to our SDK. Out of curiosity, are you now modifying the actual JSON request produced by GooglePaymentRequest#toJSON()?
@sshropshire I am able to modify the actual JSON but in final output i am not able to see any label or any text like: Subtotal/tax. do you have any idea how we can achieve this ?
We would most likely have to add API to our SDK for this. Can you provide an abbreviated code snippet of your current method?
FYI i am using google pay official document to achieve this task and in google pay document they are providing one editable json to modify the request as i mention before but no luck
you add one comment like : "add API to our SDK" , what API you want to mention?
@chiragsharma991 will need to look into this. We have our own types that wrap the GPay sdk. There may be a few fields additional fields need to get this to work without having to modify the underlying JSON.
Hi @chiragsharma991 - we appreciate your patience on this issue! In version 4.40.0 and later, you can set the totalPriceLabel on your GooglePayRequest. Please note that this price may not be shown for all transactions - see the Google Pay API docs for totalPrice for more details.