Reference documentation and code samples for the Google API Common Protos Client class Money.
Represents an amount of money with its currency type.
Generated from protobuf messagegoogle.type.Money
Namespace
Google \ Type
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ currency_code
string
The three-letter currency code defined in ISO 4217.
↳ units
int|string
The whole units of the amount. For example ifcurrencyCodeis"USD", then 1 unit is one US dollar.
↳ nanos
int
Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. Ifunitsis positive,nanosmust be positive or zero. Ifunitsis zero,nanoscan be positive, zero, or negative. Ifunitsis negative,nanosmust be negative or zero. For example $-1.75 is represented asunits=-1 andnanos=-750,000,000.
getCurrencyCode
The three-letter currency code defined in ISO 4217.
Returns
Type
Description
string
setCurrencyCode
The three-letter currency code defined in ISO 4217.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getUnits
The whole units of the amount.
For example ifcurrencyCodeis"USD", then 1 unit is one US dollar.
Returns
Type
Description
int|string
setUnits
The whole units of the amount.
For example ifcurrencyCodeis"USD", then 1 unit is one US dollar.
Parameter
Name
Description
var
int|string
Returns
Type
Description
$this
getNanos
Number of nano (10^-9) units of the amount.
The value must be between -999,999,999 and +999,999,999 inclusive.
Ifunitsis positive,nanosmust be positive or zero.
Ifunitsis zero,nanoscan be positive, zero, or negative.
Ifunitsis negative,nanosmust be negative or zero.
For example $-1.75 is represented asunits=-1 andnanos=-750,000,000.
Returns
Type
Description
int
setNanos
Number of nano (10^-9) units of the amount.
The value must be between -999,999,999 and +999,999,999 inclusive.
Ifunitsis positive,nanosmust be positive or zero.
Ifunitsis zero,nanoscan be positive, zero, or negative.
Ifunitsis negative,nanosmust be negative or zero.
For example $-1.75 is represented asunits=-1 andnanos=-750,000,000.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google API Common Protos Client - Class Money (4.12.3)\n\nVersion latestkeyboard_arrow_down\n\n- [4.12.3 (latest)](/php/docs/reference/common-protos/latest/Type.Money)\n- [4.12.2](/php/docs/reference/common-protos/4.12.2/Type.Money)\n- [4.11.0](/php/docs/reference/common-protos/4.11.0/Type.Money)\n- [4.10.0](/php/docs/reference/common-protos/4.10.0/Type.Money)\n- [4.9.0](/php/docs/reference/common-protos/4.9.0/Type.Money)\n- [4.8.3](/php/docs/reference/common-protos/4.8.3/Type.Money) \nReference documentation and code samples for the Google API Common Protos Client class Money.\n\nRepresents an amount of money with its currency type.\n\nGenerated from protobuf message `google.type.Money`\n\nNamespace\n---------\n\nGoogle \\\\ Type\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getCurrencyCode\n\nThe three-letter currency code defined in ISO 4217.\n\n### setCurrencyCode\n\nThe three-letter currency code defined in ISO 4217.\n\n### getUnits\n\nThe whole units of the amount.\n\nFor example if `currencyCode` is `\"USD\"`, then 1 unit is one US dollar.\n\n### setUnits\n\nThe whole units of the amount.\n\nFor example if `currencyCode` is `\"USD\"`, then 1 unit is one US dollar.\n\n### getNanos\n\nNumber of nano (10\\^-9) units of the amount.\n\nThe value must be between -999,999,999 and +999,999,999 inclusive.\nIf `units` is positive, `nanos` must be positive or zero.\nIf `units` is zero, `nanos` can be positive, zero, or negative.\nIf `units` is negative, `nanos` must be negative or zero.\nFor example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.\n\n### setNanos\n\nNumber of nano (10\\^-9) units of the amount.\n\nThe value must be between -999,999,999 and +999,999,999 inclusive.\nIf `units` is positive, `nanos` must be positive or zero.\nIf `units` is zero, `nanos` can be positive, zero, or negative.\nIf `units` is negative, `nanos` must be negative or zero.\nFor example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000."]]