--- title: Moving money with Treasury using CreditReversal objects subtitle: >- Learn how you can return funds from received credits that add money to your Treasury financial account. route: /treasury/moving-money/financial-accounts/into/credit-reversals --- # Moving money with Treasury using CreditReversal objects Learn how you can return funds from received credits that add money to your Treasury financial account. Reversing a [ReceivedCredit](https://stripe.com/api/treasury/received_credits) creates a [CreditReversal](https://stripe.com/api/treasury/credit_reversals). You can reverse `ReceivedCredits` only in some scenarios (detailed in the following table). Whether you can reverse a `ReceivedCredit` depends on the network and source flow. The `reversal_details` sub-hash on the `ReceivedCredit` object can have the following combination of values, which determines if you can reverse the `ReceivedCredit`. | RESTRICTED REASON | DEADLINE (EPOCH TIMESTAMP) | EXAMPLE SCENARIO | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `source_flow_restricted` | `null` | A Stripe network `ReceivedCredit` that’s the result of a flow other than an `OutboundPayment`. Stripe restricts users from reversing such `ReceivedCredits`. | | `network_restricted` | `null` | Network constraints prevent Stripe from allowing reversal on some `ReceivedCredits`, such as a `ReceivedCredit` from a wire transfer. | | `null` | `{{TIMESTAMP}}` | A `ReceivedCredit`, which is reversible, but only until the timestamp in `deadline`. ACH `ReceivedCredits` have a deadline that determines how long you have to reverse them. | | `deadline_passed` | `{{TIMESTAMP}}` | A `ReceivedCredit` that’s reversible before the timestamp in `deadline`, but is no longer reversible because the `deadline` has passed. ACH `ReceivedCredits` have a limited time of when they’re reversible after they’re created. | | `already_reversed` | `null` | A `ReceivedCredit` that’s already reversed has this `restricted_reason`. It might have a non-null `deadline` value. | | `null` | `null` | You can reverse `ReceivedCredits` anytime if they have `null` for both `restricted_reason` and `deadline`. | ## Create a CreditReversal Use `POST /v1/treasury/credit_reversals` to create a `CreditReversal`. Set the `received_credit` parameter in the body of the request to the value of the `ReceivedCredit` ID to reverse. You can’t update `CreditReversals`, so you must set any optional [metadata](https://stripe.com/api/treasury/credit_reversals/create#create_credit_reversal-metadata) on creation. The following request creates a `CreditReversal` based on the `ReceivedCredit` ID value on the required `received_credit` parameter. The request also sets an optional metadata value. Code snippet calling post /v1/treasury/credit_reversals in curl (resource-based pattern). ```curl curl https://api.stripe.com/v1/treasury/credit_reversals \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -H "Stripe-Account: {{CONNECTEDACCOUNT_ID}}" \ -d received_credit={{RECEIVED_CREDIT_ID}} \ -d "metadata[reason]"=Because ``` Code snippet calling post /v1/treasury/credit_reversals in cli (resource-based pattern). ```cli stripe treasury credit_reversals create \ --stripe-account {{CONNECTEDACCOUNT_ID}} \ --received-credit={{RECEIVED_CREDIT_ID}} \ -d "metadata[reason]"=Because ``` Code snippet calling post /v1/treasury/credit_reversals in ruby (resource-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key = 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' credit_reversal = Stripe::Treasury::CreditReversal.create( { received_credit: '{{RECEIVED_CREDIT_ID}}', metadata: {reason: 'Because'}, }, {stripe_account: '{{CONNECTEDACCOUNT_ID}}'}, ) ``` Code snippet calling post /v1/treasury/credit_reversals in ruby (service-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2") credit_reversal = client.v1.treasury.credit_reversals.create( { received_credit: '{{RECEIVED_CREDIT_ID}}', metadata: {reason: 'Because'}, }, {stripe_account: '{{CONNECTEDACCOUNT_ID}}'}, ) ``` Code snippet calling post /v1/treasury/credit_reversals in python (resource-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" credit_reversal = stripe.treasury.CreditReversal.create( received_credit="{{RECEIVED_CREDIT_ID}}", metadata={"reason": "Because"}, stripe_account="{{CONNECTEDACCOUNT_ID}}", ) ``` Code snippet calling post /v1/treasury/credit_reversals in python (service-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2") credit_reversal = client.treasury.credit_reversals.create( {"received_credit": "{{RECEIVED_CREDIT_ID}}", "metadata": {"reason": "Because"}}, {"stripe_account": "{{CONNECTEDACCOUNT_ID}}"}, ) ``` Code snippet calling post /v1/treasury/credit_reversals in php (resource-based pattern). ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $creditReversal = $stripe->treasury->creditReversals->create( [ 'received_credit' => '{{RECEIVED_CREDIT_ID}}', 'metadata' => ['reason' => 'Because'], ], ['stripe_account' => '{{CONNECTEDACCOUNT_ID}}'] ); ``` Code snippet calling post /v1/treasury/credit_reversals in java (resource-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; CreditReversalCreateParams params = CreditReversalCreateParams.builder() .setReceivedCredit("{{RECEIVED_CREDIT_ID}}") .putMetadata("reason", "Because") .build(); RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("{{CONNECTEDACCOUNT_ID}}").build(); CreditReversal creditReversal = CreditReversal.create(params, requestOptions); ``` Code snippet calling post /v1/treasury/credit_reversals in java (service-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); CreditReversalCreateParams params = CreditReversalCreateParams.builder() .setReceivedCredit("{{RECEIVED_CREDIT_ID}}") .putMetadata("reason", "Because") .build(); RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("{{CONNECTEDACCOUNT_ID}}").build(); CreditReversal creditReversal = client.treasury().creditReversals().create(params, requestOptions); ``` Code snippet calling post /v1/treasury/credit_reversals in node (resource-based pattern). ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); const creditReversal = await stripe.treasury.creditReversals.create( { received_credit: '{{RECEIVED_CREDIT_ID}}', metadata: { reason: 'Because', }, }, { stripeAccount: '{{CONNECTEDACCOUNT_ID}}', } ); ``` Code snippet calling post /v1/treasury/credit_reversals in go (resource-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" params := &stripe.TreasuryCreditReversalParams{ ReceivedCredit: stripe.String("{{RECEIVED_CREDIT_ID}}"), }; params.AddMetadata("reason", "Because") params.SetStripeAccount("{{CONNECTEDACCOUNT_ID}}") result, err := creditreversal.New(params); ``` Code snippet calling post /v1/treasury/credit_reversals in go (service-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); params := &stripe.TreasuryCreditReversalCreateParams{ ReceivedCredit: stripe.String("{{RECEIVED_CREDIT_ID}}"), }; params.AddMetadata("reason", "Because") params.SetStripeAccount("{{CONNECTEDACCOUNT_ID}}") result, err := sc.V1TreasuryCreditReversals.Create(context.TODO(), params); ``` Code snippet calling post /v1/treasury/credit_reversals in dotnet (resource-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeConfiguration.ApiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; var options = new Stripe.Treasury.CreditReversalCreateOptions { ReceivedCredit = "{{RECEIVED_CREDIT_ID}}", Metadata = new Dictionary { { "reason", "Because" } }, }; var requestOptions = new RequestOptions { StripeAccount = "{{CONNECTEDACCOUNT_ID}}", }; var service = new Stripe.Treasury.CreditReversalService(); Stripe.Treasury.CreditReversal creditReversal = service.Create(options, requestOptions); ``` Code snippet calling post /v1/treasury/credit_reversals in dotnet (service-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new Stripe.Treasury.CreditReversalCreateOptions { ReceivedCredit = "{{RECEIVED_CREDIT_ID}}", Metadata = new Dictionary { { "reason", "Because" } }, }; var requestOptions = new RequestOptions { StripeAccount = "{{CONNECTEDACCOUNT_ID}}", }; var client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); var service = client.V1.Treasury.CreditReversals; Stripe.Treasury.CreditReversal creditReversal = service.Create(options, requestOptions); ``` If successful, the response returns the new `CreditReversal` object. ```json { "id": "{{CREDIT_REVERSAL_ID}}", "object": "credit_reversal", "amount": 1000, "currency": "usd", "financial_account": "{{FINANCIAL_ACCOUNT_ID}}", "hosted_regulatory_receipt_url": "https://payments.stripe.com/regulatory-receipt/{{URL_ID}}", "livemode": false, "metadata": { "csr_id": "CSR-12" }, "network": "ach", "received_credit": "{{RECEIVED_CREDIT_ID}}", "status": "processing", "status_transitions": { "posted_at": null }, "transaction": "{{TRANSACTION_ID}}" } ``` ## Retrieve a CreditReversal Use `GET /v1/treasury/credit_reversals/{{CREDIT_REVERSAL_ID}}` to retrieve the `CreditReversal` with the associated ID. Code snippet calling get /v1/treasury/credit_reversals/{id} in curl (resource-based pattern). ```curl curl https://api.stripe.com/v1/treasury/credit_reversals/{{CREDIT_REVERSAL_ID}} \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -H "Stripe-Account: {{CONNECTEDACCOUNT_ID}}" ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in cli (resource-based pattern). ```cli stripe treasury credit_reversals retrieve {{CREDIT_REVERSAL_ID}} \ --stripe-account {{CONNECTEDACCOUNT_ID}} ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in ruby (resource-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key = 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' credit_reversal = Stripe::Treasury::CreditReversal.retrieve( '{{CREDIT_REVERSAL_ID}}', {stripe_account: '{{CONNECTEDACCOUNT_ID}}'}, ) ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in ruby (service-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2") credit_reversal = client.v1.treasury.credit_reversals.retrieve( '{{CREDIT_REVERSAL_ID}}', {}, {stripe_account: '{{CONNECTEDACCOUNT_ID}}'}, ) ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in python (resource-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" credit_reversal = stripe.treasury.CreditReversal.retrieve( "{{CREDIT_REVERSAL_ID}}", stripe_account="{{CONNECTEDACCOUNT_ID}}", ) ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in python (service-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2") credit_reversal = client.treasury.credit_reversals.retrieve( "{{CREDIT_REVERSAL_ID}}", options={"stripe_account": "{{CONNECTEDACCOUNT_ID}}"}, ) ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in php (resource-based pattern). ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $creditReversal = $stripe->treasury->creditReversals->retrieve( '{{CREDIT_REVERSAL_ID}}', [], ['stripe_account' => '{{CONNECTEDACCOUNT_ID}}'] ); ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in java (resource-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("{{CONNECTEDACCOUNT_ID}}").build(); CreditReversal creditReversal = CreditReversal.retrieve("{{CREDIT_REVERSAL_ID}}", requestOptions); ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in java (service-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); CreditReversalRetrieveParams params = CreditReversalRetrieveParams.builder().build(); RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("{{CONNECTEDACCOUNT_ID}}").build(); CreditReversal creditReversal = client.treasury().creditReversals().retrieve( "{{CREDIT_REVERSAL_ID}}", params, requestOptions ); ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in node (resource-based pattern). ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); const creditReversal = await stripe.treasury.creditReversals.retrieve( '{{CREDIT_REVERSAL_ID}}', { stripeAccount: '{{CONNECTEDACCOUNT_ID}}', } ); ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in go (resource-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" params := &stripe.TreasuryCreditReversalParams{}; params.SetStripeAccount("{{CONNECTEDACCOUNT_ID}}") result, err := creditreversal.Get("{{CREDIT_REVERSAL_ID}}", params); ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in go (service-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); params := &stripe.TreasuryCreditReversalRetrieveParams{ CreditReversal: stripe.String("{{CREDIT_REVERSAL_ID}}"), }; params.SetStripeAccount("{{CONNECTEDACCOUNT_ID}}") result, err := sc.V1TreasuryCreditReversals.Retrieve(context.TODO(), params); ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in dotnet (resource-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeConfiguration.ApiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; var requestOptions = new RequestOptions { StripeAccount = "{{CONNECTEDACCOUNT_ID}}", }; var service = new Stripe.Treasury.CreditReversalService(); Stripe.Treasury.CreditReversal creditReversal = service.Get( "{{CREDIT_REVERSAL_ID}}", null, requestOptions); ``` Code snippet calling get /v1/treasury/credit_reversals/{id} in dotnet (service-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var requestOptions = new RequestOptions { StripeAccount = "{{CONNECTEDACCOUNT_ID}}", }; var client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); var service = client.V1.Treasury.CreditReversals; Stripe.Treasury.CreditReversal creditReversal = service.Get( "{{CREDIT_REVERSAL_ID}}", null, requestOptions); ``` The response returns the specific `CreditReversal` object. ## List CreditReversals Use `GET /v1/treasury/credit_reversals` to retrieve a list of `CreditReversals` for the financial account with the ID provided in the required `financial_account` parameter. You can filter the list by standard list parameters, `status`, or by `ReceivedCredit` ID using the `received_credit` parameter. ``` { // Standard list parameters "limit", "starting_after", "ending_before", // Filter by status "status": "processing" | "posted", // Filter by FinancialAccount (Required) "financial_account": "{{FINANCIAL_ACCOUNT_ID}}", // Filter by ReceivedCredit "received_credit": "{{RECEIVED_CREDIT_ID}}" } ``` The following request returns the three most recent credit reversals with a status of `posted` for the specified financial account. Code snippet calling get /v1/treasury/credit_reversals in curl (resource-based pattern). ```curl curl -G https://api.stripe.com/v1/treasury/credit_reversals \ -u "sk_test_BQokikJOvBiI2HlWgH4olfQ2:" \ -H "Stripe-Account: {{CONNECTEDACCOUNT_ID}}" \ -d limit=3 \ -d status=posted \ -d financial_account="{{TREASURYFINANCIALACCOUNT_ID}}" ``` Code snippet calling get /v1/treasury/credit_reversals in cli (resource-based pattern). ```cli stripe treasury credit_reversals list \ --stripe-account {{CONNECTEDACCOUNT_ID}} \ --limit=3 \ --status=posted \ --financial-account="{{TREASURYFINANCIALACCOUNT_ID}}" ``` Code snippet calling get /v1/treasury/credit_reversals in ruby (resource-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key = 'sk_test_BQokikJOvBiI2HlWgH4olfQ2' credit_reversals = Stripe::Treasury::CreditReversal.list( { limit: 3, status: 'posted', financial_account: '{{TREASURYFINANCIALACCOUNT_ID}}', }, {stripe_account: '{{CONNECTEDACCOUNT_ID}}'}, ) ``` Code snippet calling get /v1/treasury/credit_reversals in ruby (service-based pattern). ```ruby # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = Stripe::StripeClient.new("sk_test_BQokikJOvBiI2HlWgH4olfQ2") credit_reversals = client.v1.treasury.credit_reversals.list( { limit: 3, status: 'posted', financial_account: '{{TREASURYFINANCIALACCOUNT_ID}}', }, {stripe_account: '{{CONNECTEDACCOUNT_ID}}'}, ) ``` Code snippet calling get /v1/treasury/credit_reversals in python (resource-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys import stripe stripe.api_key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" credit_reversals = stripe.treasury.CreditReversal.list( limit=3, status="posted", financial_account="{{TREASURYFINANCIALACCOUNT_ID}}", stripe_account="{{CONNECTEDACCOUNT_ID}}", ) ``` Code snippet calling get /v1/treasury/credit_reversals in python (service-based pattern). ```python # Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys client = StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2") credit_reversals = client.treasury.credit_reversals.list( { "limit": 3, "status": "posted", "financial_account": "{{TREASURYFINANCIALACCOUNT_ID}}", }, {"stripe_account": "{{CONNECTEDACCOUNT_ID}}"}, ) ``` Code snippet calling get /v1/treasury/credit_reversals in php (resource-based pattern). ```php // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys $stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); $creditReversals = $stripe->treasury->creditReversals->all( [ 'limit' => 3, 'status' => 'posted', 'financial_account' => '{{TREASURYFINANCIALACCOUNT_ID}}', ], ['stripe_account' => '{{CONNECTEDACCOUNT_ID}}'] ); ``` Code snippet calling get /v1/treasury/credit_reversals in java (resource-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys Stripe.apiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; CreditReversalListParams params = CreditReversalListParams.builder() .setLimit(3L) .setStatus(CreditReversalListParams.Status.POSTED) .setFinancialAccount("{{TREASURYFINANCIALACCOUNT_ID}}") .build(); RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("{{CONNECTEDACCOUNT_ID}}").build(); CreditReversalCollection creditReversals = CreditReversal.list(params, requestOptions); ``` Code snippet calling get /v1/treasury/credit_reversals in java (service-based pattern). ```java // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeClient client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); CreditReversalListParams params = CreditReversalListParams.builder() .setLimit(3L) .setStatus(CreditReversalListParams.Status.POSTED) .setFinancialAccount("{{TREASURYFINANCIALACCOUNT_ID}}") .build(); RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("{{CONNECTEDACCOUNT_ID}}").build(); StripeCollection stripeCollection = client.treasury().creditReversals().list(params, requestOptions); ``` Code snippet calling get /v1/treasury/credit_reversals in node (resource-based pattern). ```node // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys const stripe = require('stripe')('sk_test_BQokikJOvBiI2HlWgH4olfQ2'); const creditReversals = await stripe.treasury.creditReversals.list( { limit: 3, status: 'posted', financial_account: '{{TREASURYFINANCIALACCOUNT_ID}}', }, { stripeAccount: '{{CONNECTEDACCOUNT_ID}}', } ); ``` Code snippet calling get /v1/treasury/credit_reversals in go (resource-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys stripe.Key = "sk_test_BQokikJOvBiI2HlWgH4olfQ2" params := &stripe.TreasuryCreditReversalListParams{ Status: stripe.String(stripe.TreasuryCreditReversalStatusPosted), FinancialAccount: stripe.String("{{TREASURYFINANCIALACCOUNT_ID}}"), }; params.Limit = stripe.Int64(3) params.SetStripeAccount("{{CONNECTEDACCOUNT_ID}}") result := creditreversal.List(params); ``` Code snippet calling get /v1/treasury/credit_reversals in go (service-based pattern). ```go // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys sc := stripe.NewClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); params := &stripe.TreasuryCreditReversalListParams{ Status: stripe.String(stripe.TreasuryCreditReversalStatusPosted), FinancialAccount: stripe.String("{{TREASURYFINANCIALACCOUNT_ID}}"), }; params.Limit = stripe.Int64(3) params.SetStripeAccount("{{CONNECTEDACCOUNT_ID}}") result := sc.V1TreasuryCreditReversals.List(context.TODO(), params); ``` Code snippet calling get /v1/treasury/credit_reversals in dotnet (resource-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys StripeConfiguration.ApiKey = "sk_test_BQokikJOvBiI2HlWgH4olfQ2"; var options = new Stripe.Treasury.CreditReversalListOptions { Limit = 3, Status = "posted", FinancialAccount = "{{TREASURYFINANCIALACCOUNT_ID}}", }; var requestOptions = new RequestOptions { StripeAccount = "{{CONNECTEDACCOUNT_ID}}", }; var service = new Stripe.Treasury.CreditReversalService(); StripeList creditReversals = service.List( options, requestOptions); ``` Code snippet calling get /v1/treasury/credit_reversals in dotnet (service-based pattern). ```dotnet // Set your secret key. Remember to switch to your live secret key in production. // See your keys here: https://dashboard.stripe.com/apikeys var options = new Stripe.Treasury.CreditReversalListOptions { Limit = 3, Status = "posted", FinancialAccount = "{{TREASURYFINANCIALACCOUNT_ID}}", }; var requestOptions = new RequestOptions { StripeAccount = "{{CONNECTEDACCOUNT_ID}}", }; var client = new StripeClient("sk_test_BQokikJOvBiI2HlWgH4olfQ2"); var service = client.V1.Treasury.CreditReversals; StripeList creditReversals = service.List( options, requestOptions); ``` If successful, the response returns the relevant list of [CreditReversal objects](https://stripe.com/api/treasury/credit_reversals). ## Test CreditReversals To test CreditReversals, you must first create [test ReceivedCredits](#testingrc). Then use `POST /v1/treasury/credit_reversals` and specify the test `ReceivedCredit` ID in the `received_credit` parameter to create a test `CreditReversal`. ## CreditReversal Webhooks Stripe emits the following `CreditReversal` events to your [webhook](https://stripe.com/webhooks) endpoint: - `treasury.credit_reversal.created` on `CreditReversal` creation. - `treasury.credit_reversal.posted` when the `CreditReversal` posts.