(customsDeclarations())
Customs declarations are relevant information, including one or multiple customs items, you need to provide for customs clearance for your international shipments.
- list - List all customs declarations
- create - Create a new customs declaration
- get - Retrieve a customs declaration
Returns a a list of all customs declaration objects
package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.ListCustomsDeclarationsResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("<YOUR_API_KEY_HERE>")
.shippoApiVersion("2018-02-08")
.build();
ListCustomsDeclarationsResponse res = sdk.customsDeclarations().list()
.page(1L)
.results(5L)
.shippoApiVersion("2018-02-08")
.call();
if (res.customsDeclarationPaginatedList().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
page |
Optional<Long> | ➖ | The page number you want to select | |
results |
Optional<Long> | ➖ | The number of results to return per page (max 100, default 5) | |
shippoApiVersion |
Optional<String> | ➖ | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 |
ListCustomsDeclarationsResponse
Error Type | Status Code | Content Type |
---|---|---|
models/errors/SDKError | 4XX, 5XX | */* |
Creates a new customs declaration object
package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.components.AddressImporter;
import com.goshippo.shippo_sdk.models.components.CustomsDeclarationB13AFilingOptionEnum;
import com.goshippo.shippo_sdk.models.components.CustomsDeclarationContentsTypeEnum;
import com.goshippo.shippo_sdk.models.components.CustomsDeclarationCreateRequest;
import com.goshippo.shippo_sdk.models.components.CustomsDeclarationCreateRequestAddress;
import com.goshippo.shippo_sdk.models.components.CustomsDeclarationCreateRequestType;
import com.goshippo.shippo_sdk.models.components.CustomsDeclarationEelPfcEnum;
import com.goshippo.shippo_sdk.models.components.CustomsDeclarationIncotermEnum;
import com.goshippo.shippo_sdk.models.components.CustomsDeclarationNonDeliveryOptionEnum;
import com.goshippo.shippo_sdk.models.components.CustomsExporterIdentification;
import com.goshippo.shippo_sdk.models.components.CustomsItemCreateRequest;
import com.goshippo.shippo_sdk.models.components.CustomsTaxIdentification;
import com.goshippo.shippo_sdk.models.components.CustomsTaxIdentificationType;
import com.goshippo.shippo_sdk.models.components.DutiesPayor;
import com.goshippo.shippo_sdk.models.components.WeightUnitEnum;
import com.goshippo.shippo_sdk.models.operations.CreateCustomsDeclarationResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("<YOUR_API_KEY_HERE>")
.shippoApiVersion("2018-02-08")
.build();
CreateCustomsDeclarationResponse res = sdk.customsDeclarations().create()
.shippoApiVersion("2018-02-08")
.customsDeclarationCreateRequest(CustomsDeclarationCreateRequest.builder()
.certify(true)
.certifySigner("Shawn Ippotle")
.contentsType(CustomsDeclarationContentsTypeEnum.MERCHANDISE)
.items(List.of(
CustomsItemCreateRequest.builder()
.description("T-Shirt")
.massUnit(WeightUnitEnum.LB)
.netWeight("5")
.originCountry("<value>")
.quantity(20L)
.valueAmount("200")
.valueCurrency("USD")
.metadata("Order ID \"123454\"")
.skuCode("HM-123")
.hsCode("0901.21")
.build()))
.nonDeliveryOption(CustomsDeclarationNonDeliveryOptionEnum.RETURN)
.b13aFilingOption(CustomsDeclarationB13AFilingOptionEnum.FILED_ELECTRONICALLY)
.contentsExplanation("T-Shirt purchase")
.dutiesPayor(DutiesPayor.builder()
.account("2323434543")
.type(CustomsDeclarationCreateRequestType.THIRD_PARTY)
.address(CustomsDeclarationCreateRequestAddress.builder()
.name("Patrick Kavanagh")
.zip("80331")
.country("DE")
.build())
.build())
.exporterIdentification(CustomsExporterIdentification.builder()
.eoriNumber("PL123456790ABCDE")
.taxId(CustomsTaxIdentification.builder()
.number("123456789")
.type(CustomsTaxIdentificationType.EIN)
.build())
.build())
.invoice("#123123")
.metadata("Order ID #123123")
.addressImporter(AddressImporter.builder()
.name("Shwan Ippotle")
.company("Shippo")
.street1("Blumenstraße")
.street3("")
.streetNo("22")
.city("München")
.state("CA")
.zip("80331")
.country("DE")
.phone("80331")
.email("[email protected]")
.isResidential(true)
.build())
.eelPfc(CustomsDeclarationEelPfcEnum.NOEEI3037_A)
.incoterm(CustomsDeclarationIncotermEnum.DDP)
.test(true)
.build())
.call();
if (res.customsDeclaration().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
shippoApiVersion |
Optional<String> | ➖ | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 |
customsDeclarationCreateRequest |
CustomsDeclarationCreateRequest | ✔️ | CustomsDeclaration details. |
CreateCustomsDeclarationResponse
Error Type | Status Code | Content Type |
---|---|---|
models/errors/SDKError | 4XX, 5XX | */* |
Returns an existing customs declaration using an object ID
package hello.world;
import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.GetCustomsDeclarationResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws Exception {
Shippo sdk = Shippo.builder()
.apiKeyHeader("<YOUR_API_KEY_HERE>")
.shippoApiVersion("2018-02-08")
.build();
GetCustomsDeclarationResponse res = sdk.customsDeclarations().get()
.customsDeclarationId("<id>")
.page(1L)
.shippoApiVersion("2018-02-08")
.call();
if (res.customsDeclaration().isPresent()) {
// handle response
}
}
}
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
customsDeclarationId |
String | ✔️ | Object ID of the customs declaration | |
page |
Optional<Long> | ➖ | The page number you want to select | |
shippoApiVersion |
Optional<String> | ➖ | Optional string used to pick a non-default API version to use. See our API version guide. | 2018-02-08 |
Error Type | Status Code | Content Type |
---|---|---|
models/errors/SDKError | 4XX, 5XX | */* |