Skip to content

Latest commit

 

History

History
236 lines (168 loc) · 20.7 KB

File metadata and controls

236 lines (168 loc) · 20.7 KB

ShippoAccounts

(shippoAccounts())

Overview

Shippo Accounts are used by Shippo Platform Accounts to create and manage Managed Shippo Accounts. Managed Shippo Accounts are headless accounts that represent your customers. They are opaque to your end customers, meaning customers do not need to create their own Shippo login or have a billing relationship with Shippo. They can be used by marketplaces, e-commerce platforms, and third-party logistics providers who want to offer, seamless, built-in shipping functionality to their customers. See our guide for more details.

Available Operations

  • list - List all Shippo Accounts
  • create - Create a Shippo Account
  • get - Retrieve a Shippo Account
  • update - Update a Shippo Account

list

Returns a list of Shippo Managed Accounts objects.

Example Usage

package hello.world;

import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.ListShippoAccountsResponse;
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();

        ListShippoAccountsResponse res = sdk.shippoAccounts().list()
                .page(1L)
                .results(25L)
                .shippoApiVersion("2018-02-08")
                .call();

        if (res.shippoAccountPaginatedList().isPresent()) {
            // handle response
        }
    }
}

Parameters

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)
shippoApiVersion Optional<String> Optional string used to pick a non-default API version to use. See our API version guide. 2018-02-08

Response

ListShippoAccountsResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

create

Creates a new Shippo Managed Account.

Example Usage

package hello.world;

import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.components.ShippoAccountUpdateRequest;
import com.goshippo.shippo_sdk.models.operations.CreateShippoAccountResponse;
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();

        CreateShippoAccountResponse res = sdk.shippoAccounts().create()
                .shippoApiVersion("2018-02-08")
                .shippoAccountUpdateRequest(ShippoAccountUpdateRequest.builder()
                    .email("hippo@shippo.com")
                    .firstName("Shippo")
                    .lastName("Meister")
                    .companyName("Acme")
                    .build())
                .call();

        if (res.shippoAccount().isPresent()) {
            // handle response
        }
    }
}

Parameters

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
shippoAccountUpdateRequest ShippoAccountUpdateRequest ✔️ N/A

Response

CreateShippoAccountResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

get

Returns a Shippo Managed Account using an object ID.

Example Usage

package hello.world;

import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.operations.GetShippoAccountResponse;
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();

        GetShippoAccountResponse res = sdk.shippoAccounts().get()
                .shippoAccountId("<id>")
                .shippoApiVersion("2018-02-08")
                .call();

        if (res.shippoAccount().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
shippoAccountId String ✔️ Object ID of the ShippoAccount
shippoApiVersion Optional<String> Optional string used to pick a non-default API version to use. See our API version guide. 2018-02-08

Response

GetShippoAccountResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

update

Updates a Shippo Managed Account using an object ID.

Example Usage

package hello.world;

import com.goshippo.shippo_sdk.Shippo;
import com.goshippo.shippo_sdk.models.components.ShippoAccountUpdateRequest;
import com.goshippo.shippo_sdk.models.operations.UpdateShippoAccountResponse;
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();

        UpdateShippoAccountResponse res = sdk.shippoAccounts().update()
                .shippoAccountId("<id>")
                .shippoApiVersion("2018-02-08")
                .shippoAccountUpdateRequest(ShippoAccountUpdateRequest.builder()
                    .email("hippo@shippo.com")
                    .firstName("Shippo")
                    .lastName("Meister")
                    .companyName("Acme")
                    .build())
                .call();

        if (res.shippoAccount().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description Example
shippoAccountId String ✔️ Object ID of the ShippoAccount
shippoApiVersion Optional<String> Optional string used to pick a non-default API version to use. See our API version guide. 2018-02-08
shippoAccountUpdateRequest Optional<ShippoAccountUpdateRequest> N/A

Response

UpdateShippoAccountResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*