Expire a Test Payment Intent
Simula a expiração de um payment intent em sandbox.
curl -X POST "https://api.chargefy.io/v1/test-helpers/payment-intents/pi_123/expire" \
-H "Authorization: Bearer {{API_KEY}}"
{
"id": "pi_123",
"object": "payment_intent",
"amount": 7500,
"amount_capturable": 0,
"amount_details": {},
"amount_received": 0,
"canceled_at": "2026-05-26T14:12:00Z",
"cancellation_reason": "abandoned",
"capture_method": "automatic",
"client_secret": "pi_123_secret_abc",
"confirmation_method": "automatic",
"created_at": "2026-05-26T14:10:00Z",
"currency": "brl",
"customer": "cus_123",
"invoice": null,
"last_payment_error": {
"category": "invalid",
"code": "payment_method_expired",
"message": "Payment method expired before completion."
},
"latest_charge": "ch_123",
"livemode": false,
"metadata": {},
"next_action": null,
"payment_method": null,
"payment_method_options": {},
"payment_method_types": [
"boleto"
],
"setup_future_usage": null,
"status": "canceled",
"updated_at": "2026-05-26T14:12:00Z"
}
Marca um payment intent de sandbox como
canceled com cancellation_reason: "abandoned". A charge associada fica como falha, e os webhooks de cancelamento/falha são emitidos.
Se a cobrança nasceu em uma checkout session, você também pode chamar POST /v1/test-helpers/checkout-sessions/{id}/expire.
ID do payment intent (
pi_*) em test mode.curl -X POST "https://api.chargefy.io/v1/test-helpers/payment-intents/pi_123/expire" \
-H "Authorization: Bearer {{API_KEY}}"
{
"id": "pi_123",
"object": "payment_intent",
"amount": 7500,
"amount_capturable": 0,
"amount_details": {},
"amount_received": 0,
"canceled_at": "2026-05-26T14:12:00Z",
"cancellation_reason": "abandoned",
"capture_method": "automatic",
"client_secret": "pi_123_secret_abc",
"confirmation_method": "automatic",
"created_at": "2026-05-26T14:10:00Z",
"currency": "brl",
"customer": "cus_123",
"invoice": null,
"last_payment_error": {
"category": "invalid",
"code": "payment_method_expired",
"message": "Payment method expired before completion."
},
"latest_charge": "ch_123",
"livemode": false,
"metadata": {},
"next_action": null,
"payment_method": null,
"payment_method_options": {},
"payment_method_types": [
"boleto"
],
"setup_future_usage": null,
"status": "canceled",
"updated_at": "2026-05-26T14:12:00Z"
}
⌘I
curl -X POST "https://api.chargefy.io/v1/test-helpers/payment-intents/pi_123/expire" \
-H "Authorization: Bearer {{API_KEY}}"
{
"id": "pi_123",
"object": "payment_intent",
"amount": 7500,
"amount_capturable": 0,
"amount_details": {},
"amount_received": 0,
"canceled_at": "2026-05-26T14:12:00Z",
"cancellation_reason": "abandoned",
"capture_method": "automatic",
"client_secret": "pi_123_secret_abc",
"confirmation_method": "automatic",
"created_at": "2026-05-26T14:10:00Z",
"currency": "brl",
"customer": "cus_123",
"invoice": null,
"last_payment_error": {
"category": "invalid",
"code": "payment_method_expired",
"message": "Payment method expired before completion."
},
"latest_charge": "ch_123",
"livemode": false,
"metadata": {},
"next_action": null,
"payment_method": null,
"payment_method_options": {},
"payment_method_types": [
"boleto"
],
"setup_future_usage": null,
"status": "canceled",
"updated_at": "2026-05-26T14:12:00Z"
}

