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

# payment.attempt.failed

> Fired when one charge attempt is declined and the payment stays open for retry. Doc-only for parsing.



## OpenAPI

````yaml https://swagger.flexprice.io post /webhook-events/payment.attempt.failed
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
  - url: https://canada.api.flexprice.io/v1
    description: Canada Region
  - url: https://eu.api.flexprice.io/v1
    description: EU Region
security: []
paths:
  /webhook-events/payment.attempt.failed:
    post:
      tags:
        - Webhook Events
      summary: payment.attempt.failed
      description: >-
        Fired when one charge attempt is declined and the payment stays open for
        retry. Doc-only for parsing.
      responses:
        '200':
          description: Webhook payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/webhookDto.PaymentAttemptWebhookPayload'
      x-codeSamples:
        - lang: typescript
          label: TypeScript
          source: |-
            import { Flexprice } from "@flexprice/sdk";

            const flexprice = new Flexprice({
              apiKeyAuth: "<YOUR_API_KEY_HERE>",
            });

            async function run() {
              const result = await flexprice.webhookEvents.postWebhookEventsPaymentAttemptFailed();

              console.log(result);
            }

            run();
        - lang: go
          label: Go
          source: "package main\n\nimport(\n\t\"context\"\n\tflexprice \"github.com/flexprice/go-sdk/v2\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := flexprice.New(\n        flexprice.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n    )\n\n    res, err := s.WebhookEvents.PostWebhookEventsPaymentAttemptFailed(ctx)\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.WebhookDtoPaymentAttemptWebhookPayload != nil {\n        // handle response\n    }\n}"
        - lang: python
          label: Python
          source: |-
            from flexprice import Flexprice


            with Flexprice(
                api_key_auth="<YOUR_API_KEY_HERE>",
            ) as f_client:

                res = f_client.webhook_events.post_webhook_events_payment_attempt_failed()

                # Handle response
                print(res)
components:
  schemas:
    webhookDto.PaymentAttemptWebhookPayload:
      type: object
      properties:
        attempt:
          $ref: '#/components/schemas/webhookDto.PaymentAttempt'
        checkout_session:
          $ref: '#/components/schemas/webhookDto.CheckoutSession'
        event_type:
          $ref: '#/components/schemas/types.WebhookEventName'
        payment:
          $ref: '#/components/schemas/webhookDto.Payment'
    webhookDto.PaymentAttempt:
      type: object
      properties:
        attempt_number:
          type: integer
        created_at:
          type: string
          format: date-time
        error_message:
          type: string
        gateway_attempt_id:
          type: string
        id:
          type: string
        metadata:
          $ref: '#/components/schemas/types.Metadata'
    webhookDto.CheckoutSession:
      type: object
      properties:
        action:
          $ref: '#/components/schemas/types.CheckoutAction'
        cancelled_at:
          type: string
          format: date-time
        checkout_invoice_id:
          type: string
        checkout_payment_id:
          type: string
        checkout_status:
          $ref: '#/components/schemas/types.CheckoutStatus'
        completed_at:
          type: string
          format: date-time
        customer_id:
          type: string
        expires_at:
          type: string
          format: date-time
        failure_reason:
          type: string
        id:
          type: string
        payment_action:
          $ref: '#/components/schemas/types.PaymentAction'
        payment_provider:
          $ref: '#/components/schemas/types.CheckoutPaymentProvider'
    types.WebhookEventName:
      type: string
      enum:
        - subscription.created
        - subscription.draft.created
        - subscription.activated
        - subscription.updated
        - subscription.paused
        - subscription.cancelled
        - subscription.resumed
        - subscription.plan_changed
        - subscription.phase.created
        - subscription.phase.updated
        - subscription.phase.deleted
        - feature.created
        - feature.updated
        - feature.deleted
        - feature.wallet_balance.alert
        - entitlement.created
        - entitlement.updated
        - entitlement.deleted
        - commitment.created
        - commitment.updated
        - commitment.terminated
        - wallet.created
        - wallet.updated
        - wallet.terminated
        - wallet.transaction.created
        - wallet.transaction.updated
        - payment.created
        - payment.updated
        - payment.failed
        - payment.attempt.failed
        - payment.success
        - payment.pending
        - refund.created
        - refund.succeeded
        - refund.failed
        - customer.created
        - customer.updated
        - customer.deleted
        - invoice.update.finalized
        - invoice.update.payment
        - invoice.update.voided
        - invoice.update
        - invoice.payment.overdue
        - invoice.sync.success
        - invoice.sync.failed
        - wallet.credit_balance.dropped
        - wallet.credit_balance.recovered
        - wallet.ongoing_balance.dropped
        - wallet.ongoing_balance.recovered
        - wallet.ongoing_balance.updated
        - subscription.spend.threshold_reached
        - subscription.spend.threshold_recovered
        - subscription.line_item_spend.threshold_reached
        - subscription.line_item_spend.threshold_recovered
        - subscription.group_spend.threshold_reached
        - subscription.group_spend.threshold_recovered
        - entitlement.grant.exhausted
        - subscription.renewal.due
        - invoice.communication.triggered
        - credit_note.created
        - credit_note.updated
        - checkout.session.initiated
        - checkout.session.completed
        - checkout.session.failed
        - checkout.session.expired
        - event.rejected
      x-enum-varnames:
        - WebhookEventSubscriptionCreated
        - WebhookEventSubscriptionDraftCreated
        - WebhookEventSubscriptionActivated
        - WebhookEventSubscriptionUpdated
        - WebhookEventSubscriptionPaused
        - WebhookEventSubscriptionCancelled
        - WebhookEventSubscriptionResumed
        - WebhookEventSubscriptionPlanChanged
        - WebhookEventSubscriptionPhaseCreated
        - WebhookEventSubscriptionPhaseUpdated
        - WebhookEventSubscriptionPhaseDeleted
        - WebhookEventFeatureCreated
        - WebhookEventFeatureUpdated
        - WebhookEventFeatureDeleted
        - WebhookEventFeatureWalletBalanceAlert
        - WebhookEventEntitlementCreated
        - WebhookEventEntitlementUpdated
        - WebhookEventEntitlementDeleted
        - WebhookEventCommitmentCreated
        - WebhookEventCommitmentUpdated
        - WebhookEventCommitmentTerminated
        - WebhookEventWalletCreated
        - WebhookEventWalletUpdated
        - WebhookEventWalletTerminated
        - WebhookEventWalletTransactionCreated
        - WebhookEventWalletTransactionUpdated
        - WebhookEventPaymentCreated
        - WebhookEventPaymentUpdated
        - WebhookEventPaymentFailed
        - WebhookEventPaymentAttemptFailed
        - WebhookEventPaymentSuccess
        - WebhookEventPaymentPending
        - WebhookEventRefundCreated
        - WebhookEventRefundSucceeded
        - WebhookEventRefundFailed
        - WebhookEventCustomerCreated
        - WebhookEventCustomerUpdated
        - WebhookEventCustomerDeleted
        - WebhookEventInvoiceUpdateFinalized
        - WebhookEventInvoiceUpdatePayment
        - WebhookEventInvoiceUpdateVoided
        - WebhookEventInvoiceUpdate
        - WebhookEventInvoicePaymentOverdue
        - WebhookEventInvoiceSyncSuccess
        - WebhookEventInvoiceSyncFailed
        - WebhookEventWalletCreditBalanceDropped
        - WebhookEventWalletCreditBalanceRecovered
        - WebhookEventWalletOngoingBalanceDropped
        - WebhookEventWalletOngoingBalanceRecovered
        - WebhookEventWalletOngoingBalanceUpdated
        - WebhookEventSubscriptionSpendThresholdReached
        - WebhookEventSubscriptionSpendThresholdRecovered
        - WebhookEventSubscriptionLineItemSpendThresholdReached
        - WebhookEventSubscriptionLineItemSpendThresholdRecovered
        - WebhookEventSubscriptionGroupSpendThresholdReached
        - WebhookEventSubscriptionGroupSpendThresholdRecovered
        - WebhookEventEntitlementGrantExhausted
        - WebhookEventSubscriptionRenewalDue
        - WebhookEventInvoiceCommunicationTriggered
        - WebhookEventCreditNoteCreated
        - WebhookEventCreditNoteUpdated
        - WebhookEventCheckoutSessionInitiated
        - WebhookEventCheckoutSessionCompleted
        - WebhookEventCheckoutSessionFailed
        - WebhookEventCheckoutSessionExpired
        - WebhookEventEventRejected
      x-speakeasy-name-override: WebhookEventName
    webhookDto.Payment:
      type: object
      properties:
        amount:
          type: string
        currency:
          type: string
        destination_id:
          type: string
        destination_type:
          $ref: '#/components/schemas/types.PaymentDestinationType'
        error_message:
          type: string
        failed_at:
          type: string
          format: date-time
        id:
          type: string
        invoice_number:
          type: string
        payment_gateway:
          type: string
        payment_method_type:
          $ref: '#/components/schemas/types.PaymentMethodType'
        payment_status:
          $ref: '#/components/schemas/types.PaymentStatus'
        refunded_at:
          type: string
          format: date-time
        succeeded_at:
          type: string
          format: date-time
        voided_at:
          type: string
          format: date-time
    types.Metadata:
      type: object
      additionalProperties:
        type: string
      x-speakeasy-name-override: Metadata
    types.CheckoutAction:
      type: string
      enum:
        - create_subscription
        - modify_subscription
        - wallet_topup
        - add_addon
        - pay_invoice
      x-enum-varnames:
        - CheckoutActionCreateSubscription
        - CheckoutActionModifySubscription
        - CheckoutActionWalletTopup
        - CheckoutActionAddAddon
        - CheckoutActionPayInvoice
      x-speakeasy-name-override: CheckoutAction
    types.CheckoutStatus:
      type: string
      enum:
        - initiated
        - pending
        - completed
        - failed
        - expired
      x-enum-varnames:
        - CheckoutStatusInitiated
        - CheckoutStatusPending
        - CheckoutStatusCompleted
        - CheckoutStatusFailed
        - CheckoutStatusExpired
      x-speakeasy-name-override: CheckoutStatus
    types.PaymentAction:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/types.PaymentActionType'
        url:
          type: string
      x-speakeasy-name-override: PaymentAction
    types.CheckoutPaymentProvider:
      type: string
      enum:
        - razorpay
        - chargebee
        - stripe
      x-enum-varnames:
        - CheckoutPaymentProviderRazorpay
        - CheckoutPaymentProviderChargebee
        - CheckoutPaymentProviderStripe
      x-speakeasy-name-override: CheckoutPaymentProvider
    types.PaymentDestinationType:
      type: string
      enum:
        - INVOICE
        - CUSTOMER
      x-enum-varnames:
        - PaymentDestinationTypeInvoice
        - PaymentDestinationTypeCustomer
      x-speakeasy-name-override: PaymentDestinationType
    types.PaymentMethodType:
      type: string
      enum:
        - CARD
        - ACH
        - OFFLINE
        - CREDITS
        - PAYMENT_LINK
        - UPI
      x-enum-varnames:
        - PaymentMethodTypeCard
        - PaymentMethodTypeACH
        - PaymentMethodTypeOffline
        - PaymentMethodTypeCredits
        - PaymentMethodTypePaymentLink
        - PaymentMethodTypeUPI
      x-speakeasy-name-override: PaymentMethodType
    types.PaymentStatus:
      type: string
      enum:
        - INITIATED
        - PENDING
        - PROCESSING
        - SUCCEEDED
        - OVERPAID
        - FAILED
        - REFUNDED
        - PARTIALLY_REFUNDED
        - VOIDED
      x-enum-varnames:
        - PaymentStatusInitiated
        - PaymentStatusPending
        - PaymentStatusProcessing
        - PaymentStatusSucceeded
        - PaymentStatusOverpaid
        - PaymentStatusFailed
        - PaymentStatusRefunded
        - PaymentStatusPartiallyRefunded
        - PaymentStatusVoided
      x-speakeasy-name-override: PaymentStatus
    types.PaymentActionType:
      type: string
      enum:
        - checkout_url
        - payment_link
      x-enum-varnames:
        - PaymentActionTypeCheckoutURL
        - PaymentActionTypePaymentLink
      x-speakeasy-name-override: PaymentActionType

````

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