Charges

Receive notifications when charges succeed, fail, or are refunded.

Overview

Charge webhooks notify your application when payment transactions occur. Use these events to track successful payments, handle failed charges, and process refunds.


Use Cases

  • Update order status when payment succeeds
  • Trigger dunning workflows when charges fail
  • Sync payment data to your accounting system
  • Send payment confirmation emails
  • Track refund requests and completions
  • Monitor payment failure rates

Events

EventDescription
charge.succeededA charge was successfully processed
charge.failedA charge attempt failed
charge.refundedA charge was refunded (fully or partially)

charge.succeeded

Triggered When

  • A customer's payment method is successfully charged
  • A subscription payment is processed
  • An invoice is paid
  • A one-time purchase is completed

Payload

{
  "type": "charge.succeeded",
  "id": "evt_a1b2C3d4E5f6g7H8i9J0k1L2",
  "created": 1704067200,
  "data": {
    "charge": {
      "object": "charge",
      "id": 12345,
      "amount": 10000,
      "amount_refunded": 0,
      "by_agency": false,
      "created": "2024-01-01T00:00:00.000000Z",
      "created_at": "2024-01-01T00:00:00.000000Z",
      "currency": "usd",
      "customer": {
        "object": "customer",
        "id": 67890,
        "email": "[email protected]",
        "first_name": "John",
        "last_name": "Doe"
      },
      "description": "Subscription payment",
      "disputed": false,
      "failure_code": null,
      "failure_message": null,
      "invoice": {
        "object": "invoice",
        "id": 11111
      },
      "invoice_id": 11111,
      "object_id": "ch_1234567890abcdef",
      "offline": false,
      "origin": 1,
      "paid": true,
      "receipt_email": "[email protected]",
      "receipt_number": "1234-5678",
      "receipt_url": "https://pay.stripe.com/receipts/...",
      "reference": "REF-001",
      "refunded": false,
      "refunded_at": null,
      "remit_rate": null,
      "remit_rate_amount": null,
      "site_id": 1,
      "source_id": 99999,
      "statement_descriptor": "ACME INC",
      "status": "succeeded",
      "updated_at": "2024-01-01T00:00:00.000000Z",
      "user_id": 67890
    }
  }
}

charge.failed

Triggered When

  • A customer's payment method is declined
  • Insufficient funds on the payment method
  • Card expired or invalid
  • Payment gateway error occurs

Payload

{
  "type": "charge.failed",
  "id": "evt_b2C3d4E5f6g7H8i9J0k1L2m3",
  "created": 1704067200,
  "data": {
    "charge": {
      "object": "charge",
      "id": 12346,
      "amount": 10000,
      "amount_refunded": 0,
      "by_agency": false,
      "created": "2024-01-01T00:00:00.000000Z",
      "created_at": "2024-01-01T00:00:00.000000Z",
      "currency": "usd",
      "customer": {
        "object": "customer",
        "id": 67890,
        "email": "[email protected]",
        "first_name": "John",
        "last_name": "Doe"
      },
      "description": "Subscription payment",
      "disputed": false,
      "failure_code": "card_declined",
      "failure_message": "Your card was declined.",
      "invoice": {
        "object": "invoice",
        "id": 11112
      },
      "invoice_id": 11112,
      "object_id": "ch_failed_1234567890",
      "offline": false,
      "origin": 1,
      "paid": false,
      "receipt_email": null,
      "receipt_number": null,
      "receipt_url": null,
      "reference": null,
      "refunded": false,
      "refunded_at": null,
      "remit_rate": null,
      "remit_rate_amount": null,
      "site_id": 1,
      "source_id": 99999,
      "statement_descriptor": null,
      "status": "failed",
      "updated_at": "2024-01-01T00:00:00.000000Z",
      "user_id": 67890
    }
  }
}

Common Failure Codes

CodeDescription
card_declinedThe card was declined by the issuer
insufficient_fundsThe card has insufficient funds
expired_cardThe card has expired
incorrect_cvcThe CVC code is incorrect
processing_errorAn error occurred while processing
do_not_honorThe card issuer declined the transaction

charge.refunded

Triggered When

  • A full refund is issued for a charge
  • A partial refund is issued for a charge
  • A subscription is canceled with proration

Payload

{
  "type": "charge.refunded",
  "id": "evt_c3D4e5F6g7H8i9J0k1L2m3N4",
  "created": 1704153600,
  "data": {
    "charge": {
      "object": "charge",
      "id": 12345,
      "amount": 10000,
      "amount_refunded": 10000,
      "by_agency": false,
      "created": "2024-01-01T00:00:00.000000Z",
      "created_at": "2024-01-01T00:00:00.000000Z",
      "currency": "usd",
      "customer": {
        "object": "customer",
        "id": 67890,
        "email": "[email protected]",
        "first_name": "John",
        "last_name": "Doe"
      },
      "description": "Subscription payment",
      "disputed": false,
      "failure_code": null,
      "failure_message": null,
      "invoice": {
        "object": "invoice",
        "id": 11111
      },
      "invoice_id": 11111,
      "object_id": "ch_1234567890abcdef",
      "offline": false,
      "origin": 1,
      "paid": true,
      "receipt_email": "[email protected]",
      "receipt_number": "1234-5678",
      "receipt_url": "https://pay.stripe.com/receipts/...",
      "reference": "REF-001",
      "refund": {
        "object": "refund",
        "id": 55555,
        "amount": 10000,
        "currency": "usd",
        "reason": "requested_by_customer",
        "status": "succeeded"
      },
      "refunded": true,
      "refunded_at": "2024-01-02T00:00:00.000000Z",
      "remit_rate": null,
      "remit_rate_amount": null,
      "site_id": 1,
      "source_id": 99999,
      "statement_descriptor": "ACME INC",
      "status": "refunded",
      "updated_at": "2024-01-02T00:00:00.000000Z",
      "user_id": 67890
    }
  }
}

Payload Fields

Charge Object

FieldTypeDescription
objectstringObject type identifier, always charge
idintegerUnique identifier for the charge
amountintegerCharge amount in cents
amount_refundedintegerTotal refunded amount in cents
by_agencybooleanWhether charged through an agency
createdstringISO 8601 timestamp when charge was initiated
created_atstringISO 8601 timestamp when record was created
currencystringThree-letter ISO currency code (lowercase)
customerobjectCustomer details (see Customer Object)
descriptionstringDescription of the charge
disputedbooleanWhether the charge is disputed
failure_codestringError code if charge failed
failure_messagestringHuman-readable failure description
invoiceobjectAssociated invoice (see Invoice Object)
invoice_idintegerAssociated invoice ID
object_idstringExternal payment gateway identifier
offlinebooleanWhether this was an offline payment
originintegerPayment origin: 1 (Stripe), 4 (Offline), etc.
paidbooleanWhether the charge succeeded
receipt_emailstringEmail address for receipt
receipt_numberstringReceipt reference number
receipt_urlstringURL to view payment receipt
referencestringCustom reference identifier
refundobjectRefund details when charge.refunded (see Refund Object)
refundedbooleanWhether the charge has been refunded
refunded_atstringISO 8601 timestamp when refunded
remit_ratefloatRemittance rate percentage
remit_rate_amountintegerRemittance amount in cents
site_idintegerAssociated site ID
source_idintegerPayment source ID
statement_descriptorstringText appearing on customer's statement
statusstringCharge status (see Status Values)
updated_atstringISO 8601 timestamp when last modified
user_idintegerCustomer user ID

Status Values

StatusDescription
succeededCharge completed successfully
failedCharge attempt failed
pendingCharge is being processed
refundedCharge was fully refunded
partially refundedCharge was partially refunded
creditedAmount was credited back
partially creditedAmount was partially credited
pending offline refundOffline refund is pending

Customer Object (Nested)

FieldTypeDescription
objectstringAlways customer
idintegerCustomer ID
emailstringCustomer email
first_namestringCustomer first name
last_namestringCustomer last name

Invoice Object (Nested)

FieldTypeDescription
objectstringAlways invoice
idintegerInvoice ID

Refund Object (Nested, charge.refunded only)

FieldTypeDescription
objectstringAlways refund
idintegerRefund ID
amountintegerRefund amount in cents
currencystringCurrency code
reasonstringRefund reason
statusstringRefund status

Related