AmountBoxControl
overview package class tree index help package com samsung android sdk samsungpay v2 payment sheet class amountboxcontrol java lang object com samsung android sdk samsungpay v2 payment sheet sheetcontrol com samsung android sdk samsungpay v2 payment sheet amountboxcontrol all implemented interfaces android os parcelable public class amountboxcontrol extends sheetcontrol implements android os parcelable this class provides amountboxcontrol on custom payment sheet amountboxcontrol is used for displaying amount information on custom payment sheet since api level 1 3 nested class summary nested classes/interfaces inherited from class com samsung android sdk samsungpay v2 payment sheet sheetcontrol sheetcontrol controltype nested classes/interfaces inherited from interface android os parcelable android os parcelable classloadercreator<t extends object>, android os parcelable creator<t extends object> field summary fields inherited from interface android os parcelable contents_file_descriptor, parcelable_write_return_value constructor summary constructors constructor description amountboxcontrol string controlid, string currencycode constructor to create amountboxcontrol method summary all methodsinstance methodsconcrete methods modifier and type method description void additem int location, string id, string title, double price, string extraprice api to add item in specific location void additem string id, string title, double price, string extraprice api to add item boolean existitem string id api to check the item is existing or not string getcurrencycode api to return the currency code iso 4217 currency code example usd, krw, eur, and so on double getvalue string id api to get value for id void removeitem string id api to remove item void setamounttotal double price, string displayoption api to set the amount total void setcurrencycode string currencycode api to set the currency code void updatetitle string id, string title api to update item title void updatevalue string id, double price api to update price currencycode + price will appear on custom payment sheet if price is set, then extraprice is initialized empty value, because extraprice appear if extraprice is not empty void updatevalue string id, double price, string extraprice api to update price and extraprice methods inherited from class com samsung android sdk samsungpay v2 payment sheet sheetcontrol getcontrolid, getcontroltype methods inherited from class java lang object getclass, notify, notifyall, wait, wait, wait constructor details amountboxcontrol public amountboxcontrol @nonnull string controlid, @nonnull string currencycode constructor to create amountboxcontrol // construct amountcontrolbox amountboxcontrol amountboxcontrol = new amountboxcontrol "id_amount", "usd" ; // set each item amountboxcontrol additem "id_item", "item", 1000, "" ; amountboxcontrol additem "id_tax", "tax", 10, "" ; amountboxcontrol additem "id_shipping", "shipping", 20, "" ; amount setamounttotal 1030, amountconstants format_total_price_only ; // update sheetcontrol sheet updatecontrol amountboxcontrol ; // call updatesheet api method with amountboxcontrol this is mandatory paymentmanager updatesheet sheet ; parameters controlid - unique id to represent the amountboxcontrol this id is used to compare and identify the other sheetcontrols currencycode - currency code to be used by payment gateway for payment iso 4217 currency code example usd, krw, eur, and so on / all uppercase throws illegalargumentexception - thrown if controlid is null or empty nullpointerexception - thrown if currencycode is null illegalargumentexception - thrown if currencycode is invalid since api level 1 3 method details getvalue public double getvalue @nonnull string id api to get value for id parameters id - unique id to get value returns double value throws nullpointerexception - thrown if the id is null illegalargumentexception - thrown if the id is invalid since api level 1 3 existitem public boolean existitem @nonnull string id api to check the item is existing or not parameters id - unique id to be checked returns true or false throws nullpointerexception - thrown if id is null since api level 1 3 additem public void additem @nonnull string id, @nonnull string title, double price, @nullable string extraprice api to add item parameters id - unique id to be set title - title to be displayed price - price to be set extraprice - if extraprice is set, extraprice is displayed instead of price on custom payment sheet throws nullpointerexception - thrown if id or title is null illegalargumentexception - thrown if the same id is used in other sheetcontrol since api level 1 3 additem public void additem int location, @nonnull string id, @nonnull string title, double price, @nullable string extraprice api to add item in specific location amountboxcontrol amountboxcontrol = amountboxcontrol sheet getsheetcontrol "amount" ; amountboxcontrol updatevalue "item", 1000 ; amountboxcontrol updatevalue "tax", 10 ; amountboxcontrol updatevalue "shipping", 20 ; if !amountboxcontrol existitem "fuel" { amountboxcontrol additem 3, "fuel", "fuel", 0, "amount pending" ; } else { amountboxcontrol updatevalue "fuel", 0, "amount pending" ; } amountboxcontrol setamounttotal 1030 00, amountconstants format_total_price_only ; // update sheetcontrol sheet updatecontrol amountboxcontrol ; // call updatesheet api method with amountboxcontrol this is mandatory paymentmanager updatesheet sheet ; parameters location - location to be displayed in amountboxcontrol on custom payment sheet id - unique id to be set title - title to be displayed price - price to be set extraprice - if extraprice is set, extraprice is displayed instead of price on custom payment sheet throws nullpointerexception - thrown if id or title is null illegalargumentexception - thrown if location is invalid or the same id is used in other sheetcontrols since api level 1 3 setamounttotal public void setamounttotal double price, @nonnull string displayoption api to set the amount total amountboxcontrol amount = new amountboxcontrol "amount", "usd" ; amount additem "item", "item", 1000, null ; amount additem "tax", "tax", 10, null ; amount additem "shipping", "shipping", 20, null ; amount setamounttotal 1030 00, amountconstants format_total_price_only ; parameters price - price to be set this amount is for online payment transaction displayoption - amount total display option merchant must set one of the predefined formats to display total the possible values are amountconstants format_total_price_only amountconstants format_total_estimated_amount amountconstants format_total_estimated_charge amountconstants format_total_estimated_fare amountconstants format_total_free_text_only amountconstants format_total_amount_pending amountconstants format_total_amount_pending_text_only amountconstants format_total_pending amountconstants format_total_pending_text_only amountconstants format_total_up_to_amount throws illegalargumentexception - thrown if displayoption is null or empty since api level 1 3 removeitem public void removeitem @nonnull string id api to remove item amountboxcontrol updatevalue "id_tax", 30 ; if amountboxcontrol existitem "id_fuel" { amountboxcontrol removeitem "id_fuel" ; } amountboxcontrol updatevalue "id_total", 1040 ; parameters id - id of item to remove throws nullpointerexception - thrown if the id is null illegalargumentexception - thrown if the id is invalid since api level 1 3 updatevalue public void updatevalue @nonnull string id, double price api to update price currencycode + price will appear on custom payment sheet if price is set, then extraprice is initialized empty value, because extraprice appear if extraprice is not empty parameters id - unique id of item to update price - price to be set throws nullpointerexception - thrown if the id is null illegalargumentexception - thrown if there are no items associated with the id since api level 1 3 updatevalue public void updatevalue @nonnull string id, double price, @nullable string extraprice api to update price and extraprice if extraprice string is set, then extraprice will appear instead of price parameters id - unique id of item to update price - price to be set extraprice - extraprice to be set throws nullpointerexception - thrown if the id is null illegalargumentexception - thrown if there are no items associated with the id since api level 1 3 updatetitle public void updatetitle @nonnull string id, @nullable string title api to update item title parameters id - unique id of item to update title - title to be set throws nullpointerexception - thrown if the id is null illegalargumentexception - thrown if there are no items associated with the id since api level 1 3 getcurrencycode public string getcurrencycode api to return the currency code iso 4217 currency code example usd, krw, eur, and so on returns currency code since api level 1 3 setcurrencycode public void setcurrencycode @nonnull string currencycode api to set the currency code parameters currencycode - currency code to be used by payment gateway for payment iso 4217 currency code example usd, krw, eur, and so on / all uppercase throws illegalargumentexception - if the currency code is invalid nullpointerexception - if the currency code is null since api level 1 3 samsung electronics samsung pay sdk 2 22 00 - nov 19 2024