> For the complete documentation index, see [llms.txt](https://docs.umbcheckout.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.umbcheckout.net/v17/payment-providers/payment-providers/stripe/services/stripe-shipping-rate-database-service.md).

# Stripe Shipping Rate Database Service

A service which handles getting the Stripe Shipping Rates from the database

The Stripe Shipping Rate database service is what handles the insertion, retrieval, updating, and deletion of the Shipping Rates within the database.

You can access the database service by injecting `IStripeShippingRateDatabaseService` which can be found within the namespace `UmbCheckout.Stripe.Interfaces`

Every method takes an optional `CancellationToken` as its last parameter. Reads publish `OnShippingRatesLoadedNotification`, and saves and deletes publish the cancellable `OnShippingRateSavingNotification` and `OnShippingRateDeletingNotification` (see [Extending UmbCheckout](/v17/core-services/extending-umbcheckout.md)).

#### GetShippingRatesAsync

Gets the Shipping Rates

```csharp
Task<IEnumerable<ShippingRate>> GetShippingRatesAsync(CancellationToken cancellationToken = default);
```

#### GetShippingRateAsync

Gets a specified Shipping Rate by its key, or by its Stripe ID

| Name  | Detail                                                                                                                   |
| ----- | ------------------------------------------------------------------------------------------------------------------------ |
| key   | Key of the Stripe [Shipping Rate](/v17/payment-providers/payment-providers/stripe/object-reference/shippingrate.md)      |
| value | StripeId of the Stripe [Shipping Rate](/v17/payment-providers/payment-providers/stripe/object-reference/shippingrate.md) |

```csharp
Task<ShippingRate?> GetShippingRateAsync(Guid key, CancellationToken cancellationToken = default);
Task<ShippingRate?> GetShippingRateAsync(string value, CancellationToken cancellationToken = default);
```

#### CreateShippingRateAsync

Creates a Shipping Rate. Returns `null` when a rate with the same Stripe ID already exists.

```csharp
Task<ShippingRate?> CreateShippingRateAsync(ShippingRate shippingRate, CancellationToken cancellationToken = default);
```

#### UpdateShippingRateAsync

Updates a specified Shipping Rate

```csharp
Task<ShippingRate?> UpdateShippingRateAsync(ShippingRate shippingRate, CancellationToken cancellationToken = default);
```

#### DeleteShippingRateAsync

Deletes a specified Shipping Rate

| Name | Detail                                                                                                              |
| ---- | ------------------------------------------------------------------------------------------------------------------- |
| key  | Key of the Stripe [Shipping Rate](/v17/payment-providers/payment-providers/stripe/object-reference/shippingrate.md) |

```csharp
Task<bool> DeleteShippingRateAsync(Guid key, CancellationToken cancellationToken = default);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.umbcheckout.net/v17/payment-providers/payment-providers/stripe/services/stripe-shipping-rate-database-service.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
