> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Retry Payment

> Retry a failed subscription renewal payment by charging the saved payment method again for its open invoice.



## OpenAPI

````yaml post /payments/{payment_id}/retry
openapi: 3.1.0
info:
  title: public
  description: ''
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 1.118.3
servers:
  - url: https://test.dodopayments.com/
    description: Test Mode Server Host
  - url: https://live.dodopayments.com/
    description: Live Mode Server Host
security: []
tags:
  - name: Products
  - name: Payments
  - name: Subscriptions
  - name: Addons
  - name: Customers
  - name: Refunds
  - name: Disputes
  - name: Events
  - name: License Keys
  - name: Entitlements
  - name: Licenses
  - name: Discounts
  - name: Meters
  - name: Credit Entitlements
  - name: Credit Entitlement Balances
  - name: Outgoing Webhooks
  - name: Checkout
  - name: Webhook Events
  - name: Payment Connector Webhooks
  - name: Moderation
paths:
  /payments/{payment_id}/retry:
    post:
      tags:
        - Payments
      operationId: manual_retry_payment_handler
      parameters:
        - name: payment_id
          in: path
          description: Id of the failed payment
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The retry was sent. `status` carries its outcome
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManualRetryResponse'
        '404':
          description: No such payment for this business
        '409':
          description: >-
            A payment is already in progress, or the merchant must act elsewhere
            first
        '422':
          description: This payment cannot be retried
        '429':
          description: The per-invoice retry guardrail refused this send
      security:
        - API_KEY: []
        - ACCESS_TOKEN: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import DodoPayments from 'dodopayments';

            const client = new DodoPayments({
              bearerToken: process.env['DODO_PAYMENTS_API_KEY'], // This is the default and can be omitted
            });

            const manualRetry = await client.payments.retry('payment_id');

            console.log(manualRetry.invoice_id);
        - lang: Python
          source: |-
            import os
            from dodopayments import DodoPayments

            client = DodoPayments(
                bearer_token=os.environ.get("DODO_PAYMENTS_API_KEY"),  # This is the default and can be omitted
            )
            manual_retry = client.payments.retry(
                "payment_id",
            )
            print(manual_retry.invoice_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/dodopayments/dodopayments-go\"\n\t\"github.com/dodopayments/dodopayments-go/option\"\n)\n\nfunc main() {\n\tclient := dodopayments.NewClient(\n\t\toption.WithBearerToken(\"My Bearer Token\"),\n\t)\n\tmanualRetry, err := client.Payments.Retry(context.TODO(), \"payment_id\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", manualRetry.InvoiceID)\n}\n"
        - lang: Java
          source: |-
            package com.dodopayments.api.example;

            import com.dodopayments.api.client.DodoPaymentsClient;
            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient;
            import com.dodopayments.api.models.payments.ManualRetry;
            import com.dodopayments.api.models.payments.PaymentRetryParams;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    DodoPaymentsClient client = DodoPaymentsOkHttpClient.fromEnv();

                    ManualRetry manualRetry = client.payments().retry("payment_id");
                }
            }
        - lang: Kotlin
          source: |-
            package com.dodopayments.api.example

            import com.dodopayments.api.client.DodoPaymentsClient
            import com.dodopayments.api.client.okhttp.DodoPaymentsOkHttpClient
            import com.dodopayments.api.models.payments.ManualRetry
            import com.dodopayments.api.models.payments.PaymentRetryParams

            fun main() {
                val client: DodoPaymentsClient = DodoPaymentsOkHttpClient.fromEnv()

                val manualRetry: ManualRetry = client.payments().retry("payment_id")
            }
        - lang: Ruby
          source: |-
            require "dodopayments"

            dodo_payments = Dodopayments::Client.new(
              bearer_token: "My Bearer Token",
              environment: "test_mode" # defaults to "live_mode"
            )

            manual_retry = dodo_payments.payments.retry_("payment_id")

            puts(manual_retry)
        - lang: PHP
          source: |-
            <?php

            require_once dirname(__DIR__) . '/vendor/autoload.php';

            use Dodopayments\Client;
            use Dodopayments\Core\Exceptions\APIException;

            $client = new Client(
              bearerToken: getenv('DODO_PAYMENTS_API_KEY') ?: 'My Bearer Token',
              environment: 'test_mode',
            );

            try {
              $manualRetry = $client->payments->retry('payment_id');

              var_dump($manualRetry);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: C#
          source: |-
            using System;
            using DodoPayments.Client;
            using DodoPayments.Client.Models.Payments;

            DodoPaymentsClient client = new();

            PaymentRetryParams parameters = new() { PaymentID = "payment_id" };

            var manualRetry = await client.Payments.Retry(parameters);

            Console.WriteLine(manualRetry);
        - lang: Rust
          source: |-
            use dodopayments::Client;

            #[tokio::main]
            async fn main() -> dodopayments::Result<()> {
                let client = Client::from_env()?;
                let payment_id = "payment_id";
                let result = client
                    .payments()
                    .retry()
                    .payment_id(payment_id)
                    .await?;
                println!("{result:?}");
                Ok(())
            }
components:
  schemas:
    ManualRetryResponse:
      type: object
      required:
        - payment_id
        - invoice_id
        - retry_attempt
        - is_manual_retry
        - sends_used
        - sends_allowed
      properties:
        invoice_id:
          type: string
          description: The invoice the send charged.
        is_manual_retry:
          type: boolean
          description: >-
            Always true on this route. Tells the row apart from an automatic
            attempt.
        payment_id:
          type: string
          description: The payment row this send created.
        retry_attempt:
          type: integer
          format: int32
          description: Which attempt this send is, counting manual sends on the invoice.
        retry_available_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When the next send becomes available. Null when no send is left.
        sends_allowed:
          type: integer
          format: int64
        sends_used:
          type: integer
          format: int64
          description: Manual sends spent on this invoice, including this one.
        status:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/IntentStatus'
              description: >-
                Outcome of the charge. `processing` means the processor has not
                settled it

                yet, and the payment webhooks report the result.
    IntentStatus:
      type: string
      enum:
        - succeeded
        - failed
        - cancelled
        - processing
        - requires_customer_action
        - requires_merchant_action
        - requires_payment_method
        - requires_confirmation
        - requires_capture
        - partially_captured
        - partially_captured_and_capturable
  securitySchemes:
    API_KEY:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.