Skip to content

Latest commit

 

History

History
168 lines (116 loc) · 12.6 KB

README.md

File metadata and controls

168 lines (116 loc) · 12.6 KB

Refunds

(refunds())

Overview

Refunds are reimbursements for successfully created but unused shipping labels or other charges.

Available Operations

  • create - Create a refund
  • list - List all refunds
  • get - Retrieve a refund

create

Creates a new refund object.

Example Usage

package hello.world;

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

        CreateRefundResponse res = sdk.refunds().create()
                .shippoApiVersion("2018-02-08")
                .refundRequestBody(RefundRequestBody.builder()
                    .transaction("915d94940ea54c3a80cbfa328722f5a1")
                    .async(false)
                    .build())
                .call();

        if (res.refund().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
refundRequestBody RefundRequestBody ✔️ Refund details

Response

CreateRefundResponse

Errors

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

list

Returns a list all refund objects.

Example Usage

package hello.world;

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

        ListRefundsResponse res = sdk.refunds().list()
                .shippoApiVersion("2018-02-08")
                .call();

        if (res.refundPaginatedList().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

Response

ListRefundsResponse

Errors

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

get

Returns an existing rate using a rate object ID.

Example Usage

package hello.world;

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

        GetRefundResponse res = sdk.refunds().get()
                .refundId("<id>")
                .shippoApiVersion("2018-02-08")
                .call();

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

Parameters

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

Response

GetRefundResponse

Errors

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