Simple Postal Address Coarse Grained
August 21, 2026 ยท View on GitHub
A simple postal address with coarse-grained fields. Do not use for an international address. Use for backward compatibility only. Does not contain phone.
Structure
SimplePostalAddressCoarseGrained
Fields
| Name | Type | Tags | Description | Getter | Setter |
|---|---|---|---|---|---|
Line1 | String | Required | The first line of the address. For example, number or street. | String getLine1() | setLine1(String line1) |
Line2 | String | Optional | The second line of the address. For example, suite or apartment number. | String getLine2() | setLine2(String line2) |
City | String | Required | The city name. | String getCity() | setCity(String city) |
State | String | Optional | The code for a US state or the equivalent for other countries. Required for transactions if the address is in one of these countries: Argentina, Brazil, Canada, China, India, Italy, Japan, Mexico, Thailand, or United States. Maximum length is 40 single-byte characters. | String getState() | setState(String state) |
CountryCode | String | Required | The two-character ISO 3166-1 code that identifies the country or region. Note: The country code for Great Britain is GB and not UK as used in the top-level domain names for that country. Use the C2 country code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border transactions.Constraints: Minimum Length: 2, Maximum Length: 2, Pattern: ^([A-Z]{2}|C2)$ | String getCountryCode() | setCountryCode(String countryCode) |
PostalCode | String | Optional | The postal code, which is the zip code or equivalent. Typically required for countries with a postal code or an equivalent. See postal code. | String getPostalCode() | setPostalCode(String postalCode) |
Example
import com.paypal.sdk.models.SimplePostalAddressCoarseGrained;
SimplePostalAddressCoarseGrained simplePostalAddressCoarseGrained = new SimplePostalAddressCoarseGrained.Builder(
"line14",
"city2",
"country_code2"
)
.line2("line26")
.state("state8")
.postalCode("postal_code4")
.build();