Stripe: Create a refund — refunds post Refunds
Stripe refunds.postRefunds: arguments, response, policy and SDK examples.
← Refunds operations · Get started
Operation stripe.postrefunds
Provider route: POST /v1/refunds. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/stripe with npm, or alter-sdk-stripe with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { StripeIntegration } from "@alter-ai/stripe";
async function execute(input: Parameters<StripeIntegration["refunds"]["postRefunds"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new StripeIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.refunds.postRefunds(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_stripe import StripeIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = StripeIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.refunds.post_refunds(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
headers | object | Optional | Additional keys: not allowed |
headers.Idempotency-Key | string | Optional | Minimum length: 1 Maximum length: 255 |
body | object | Optional | Additional keys: not allowed |
body.amount | integer | Optional | |
body.charge | string | Optional | The identifier of the charge to refund. Maximum length: 5000 |
body.currency | string | Optional | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Format: currency |
body.customer | string | Optional | Customer whose customer balance to refund from. Maximum length: 5000 |
body.expand | array | Optional | Specifies which fields in the response should be expanded. |
body.expand[] | string | Each item | Maximum length: 5000 |
body.instructions_email | string | Optional | For payment methods without native refund support (e.g., Konbini, PromptPay), use this email from the customer to receive refund instructions. |
body.metadata | JSON | Optional | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. |
body.metadata (anyOf 1) | object | Alternative | Additional keys: see wildcard field |
body.metadata (anyOf 1).* | string | Additional keys | |
body.metadata (anyOf 2) | string | Alternative | One of: |
body.origin | string | Optional | Origin of the refund One of: customer_balance |
body.payment_intent | string | Optional | The identifier of the PaymentIntent to refund. Maximum length: 5000 |
body.reason | string | Optional | String indicating the reason for the refund. If set, possible values are `duplicate`, `fraudulent`, and `requested_by_customer`. If you believe the charge to be fraudulent, specifying `fraudulent` as the reason will add the associated card and email to your [block lists](https://docs.stripe.com/radar/lists), and will also help us improve our fraud detection algorithms. One of: duplicate, fraudulent, requested_by_customer Maximum length: 5000 |
body.refund_application_fee | boolean | Optional | Boolean indicating whether the application fee should be refunded when refunding this charge. If a full charge refund is given, the full application fee will be refunded. Otherwise, the application fee will be refunded in an amount proportional to the amount of the charge refunded. An application fee can be refunded only by the application that created the charge. |
body.reverse_transfer | boolean | Optional | Boolean indicating whether the transfer should be reversed when refunding this charge. The transfer will be reversed proportionally to the amount being refunded (either the entire or partial amount).<br><br>A transfer can be reversed only by the application that created the charge. |
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Cancel a refund — response body |
Referenced models: Cancel a refund — response body
Schemas
Section titled “Schemas”706 more schemas are linked from the tables above, on the schema pages.
Cancel a refund — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Refund objects allow you to refund a previously created charge that isn't refunded yet. Funds are refunded to the credit or debit card that's initially charged. Related guide: [Refunds](https://docs.stripe.com/refunds) |
amount | JSON | Required within parent | |
amount (anyOf 1) | integer | Alternative | Amount, in cents (or local equivalent). |
amount (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
balance_transaction | JSON | Optional | |
balance_transaction (anyOf 1) | JSON | Alternative | Balance transaction that describes the impact on your account balance. |
balance_transaction (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
balance_transaction (anyOf 1) (anyOf 2) | Model | Alternative | Expand Retrieve a balance transaction — balance get Balance History Id — response body |
balance_transaction (anyOf 2) | null | Alternative | |
charge | JSON | Optional | |
charge (anyOf 1) | JSON | Alternative | ID of the charge that's refunded. |
charge (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
charge (anyOf 1) (anyOf 2) | Model | Alternative | Expand Create a charge — response body |
charge (anyOf 2) | null | Alternative | |
created | JSON | Required within parent | |
created (anyOf 1) | integer | Alternative | Time at which the object was created. Measured in seconds since the Unix epoch. Format: unix-time |
created (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
currency | string | Required within parent | Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Format: currency |
customer | JSON | Optional | |
customer (anyOf 1) | JSON | Alternative | ID of the customer of this refund. |
customer (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
customer (anyOf 1) (anyOf 2) | Model | Alternative | Expand Create a customer — response body |
customer (anyOf 1) (anyOf 3) | Model | Alternative | Expand Delete a customer — response body |
customer (anyOf 2) | null | Alternative | |
customer_account | JSON | Optional | |
customer_account (anyOf 1) | string | Alternative | ID of the account of this refund. Maximum length: 5000 |
customer_account (anyOf 2) | null | Alternative | |
description | string | Optional | An arbitrary string attached to the object. You can use this for displaying to users (available on non-card refunds only). Maximum length: 5000 |
destination_details | Model | Optional | Expand Cancel a refund — response body — destination details |
failure_balance_transaction | JSON | Optional | After the refund fails, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction. |
failure_balance_transaction (anyOf 1) | string | Alternative | Maximum length: 5000 |
failure_balance_transaction (anyOf 2) | Model | Alternative | Expand Retrieve a balance transaction — balance get Balance History Id — response body |
failure_reason | string | Optional | Provides the reason for the refund failure. Possible values are: `lost_or_stolen_card`, `expired_or_canceled_card`, `charge_for_pending_refund_disputed`, `insufficient_funds`, `declined`, `merchant_request`, or `unknown`. Maximum length: 5000 |
id | string | Required within parent | Unique identifier for the object. Maximum length: 5000 |
instructions_email | string | Optional | For payment methods without native refund support (for example, Konbini, PromptPay), provide an email address for the customer to receive refund instructions. Maximum length: 5000 |
metadata | JSON | Optional | |
metadata (anyOf 1) | object | Alternative | Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Additional keys: see wildcard field |
metadata (anyOf 1).* | string | Additional keys | Maximum length: 500 |
metadata (anyOf 2) | null | Alternative | |
next_action | Model | Optional | Expand Cancel a refund — response body — next action |
object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Known values: refund |
payment_intent | JSON | Optional | |
payment_intent (anyOf 1) | JSON | Alternative | ID of the PaymentIntent that's refunded. |
payment_intent (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
payment_intent (anyOf 1) (anyOf 2) | Model | Alternative | Expand Cancel a Payment Intent — response body |
payment_intent (anyOf 2) | null | Alternative | |
payment_method | JSON | Optional | |
payment_method (anyOf 1) | JSON | Alternative | ID of the payment method associated with this refund. |
payment_method (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
payment_method (anyOf 1) (anyOf 2) | Model | Alternative | Expand Create a Payment Method — response body |
payment_method (anyOf 2) | null | Alternative | |
pending_reason | string | Optional | Provides the reason for why the refund is pending. Possible values are: `processing`, `insufficient_funds`, or `charge_pending`. Known values: charge_pending, insufficient_funds, processing |
presentment_details | Model | Optional | Expand Cancel a refund — response body — presentment details |
reason | JSON | Optional | |
reason (anyOf 1) | string | Alternative | Reason for the refund, which is either user-provided (`duplicate`, `fraudulent`, or `requested_by_customer`) or generated by Stripe internally (`expired_uncaptured_charge`). Known values: duplicate, expired_uncaptured_charge, fraudulent, requested_by_customer |
reason (anyOf 2) | null | Alternative | |
receipt_number | JSON | Optional | |
receipt_number (anyOf 1) | string | Alternative | This is the transaction number that appears on email receipts sent for this refund. Maximum length: 5000 |
receipt_number (anyOf 2) | null | Alternative | |
source_transfer_reversal | JSON | Optional | |
source_transfer_reversal (anyOf 1) | JSON | Alternative | The transfer reversal that's associated with the refund. Only present if the charge came from another Stripe account. |
source_transfer_reversal (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
source_transfer_reversal (anyOf 1) (anyOf 2) | Model | Alternative | Expand Update a reversal — response body |
source_transfer_reversal (anyOf 2) | null | Alternative | |
status | JSON | Optional | |
status (anyOf 1) | string | Alternative | Status of the refund. This can be `pending`, `requires_action`, `succeeded`, `failed`, or `canceled`. Learn more about [failed refunds](https://docs.stripe.com/refunds#failed-refunds). Maximum length: 5000 |
status (anyOf 2) | null | Alternative | |
transfer_reversal | JSON | Optional | |
transfer_reversal (anyOf 1) | JSON | Alternative | This refers to the transfer reversal object if the accompanying transfer reverses. This is only applicable if the charge was created using the destination parameter. |
transfer_reversal (anyOf 1) (anyOf 1) | string | Alternative | Maximum length: 5000 |
transfer_reversal (anyOf 1) (anyOf 2) | Model | Alternative | Expand Update a reversal — response body |
transfer_reversal (anyOf 2) | null | Alternative |
Referenced models: Retrieve a balance transaction — balance get Balance History Id — response body, Create a charge — response body, Create a customer — response body, Delete a customer — response body, Cancel a refund — response body — presentment details, Cancel a Payment Intent — response body, Create a Payment Method — response body, Cancel a refund — response body — destination details, Cancel a refund — response body — next action, Update a reversal — response body
Delete a customer — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
deleted | boolean | Required within parent | Always true for a deleted object Known values: True |
id | string | Required within parent | Unique identifier for the object. Maximum length: 5000 |
object | string | Required within parent | String representing the object's type. Objects of the same type share the same value. Known values: customer |
Cancel a Setup Intent — response body — managed payments value enabled
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
enabled | boolean | Required within parent | Set to `true` to enable [Managed Payments](https://docs.stripe.com/payments/managed-payments), Stripe's merchant of record solution, for this session. |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: stripe.postrefunds. Catalog operation: PostRefunds. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Pinned headers: {"Stripe-Version": "2026-09-30.endive"}