GET /api/payments/:paymentIntentId
Retrieves detailed information about a specific payment intent by its ID. Use this endpoint to check the status of a payment or retrieve payment details.
Path Parameters
The unique identifier for the payment intent. Must be a valid Stripe payment intent ID starting with pi_. Example: pi_3OJxRe2eZvKYlo2C0XYZ1234
Response
Indicates if the request was successful
Human-readable message describing the result Example: Pago obtenido correctamente
The complete Stripe PaymentIntent object Show PaymentIntent Object
Unique identifier for the payment intent
Amount received in cents (populated after successful payment)
Three-letter ISO currency code
The customer ID associated with this payment
The payment method ID used or to be used
Array of payment method types (e.g., ["card"])
Current status of the payment intent:
requires_payment_method: No payment method attached yet
requires_confirmation: Ready to be confirmed
requires_action: Requires additional customer action (e.g., 3D Secure)
processing: Payment is being processed
succeeded: Payment completed successfully
canceled: Payment was canceled
Information about charges made against this payment intent Array of charge objects Unique charge identifier (starts with ch_)
Charge status: succeeded, pending, or failed
Whether the charge was paid successfully
Whether the charge has been refunded
Amount that has been refunded in cents
The ID of the most recent charge (starts with ch_)
Unix timestamp of when the payment intent was created
Whether this is a live mode payment or test mode
Success Response
{
"status" : true ,
"message" : "Pago obtenido correctamente" ,
"data" : {
"id" : "pi_3OJxRe2eZvKYlo2C0XYZ1234" ,
"object" : "payment_intent" ,
"amount" : 100000 ,
"amount_received" : 100000 ,
"currency" : "eur" ,
"customer" : "cus_NffrFeUfNV2Hib" ,
"payment_method" : "pm_1Nvmn6LkdIwHu7ix" ,
"payment_method_types" : [ "card" ],
"status" : "succeeded" ,
"charges" : {
"object" : "list" ,
"data" : [
{
"id" : "ch_3OJxRe2eZvKYlo2C0ABC5678" ,
"object" : "charge" ,
"amount" : 100000 ,
"currency" : "eur" ,
"status" : "succeeded" ,
"paid" : true ,
"refunded" : false ,
"amount_refunded" : 0
}
],
"has_more" : false
},
"latest_charge" : "ch_3OJxRe2eZvKYlo2C0ABC5678" ,
"created" : 1672531200 ,
"livemode" : false
}
}
Error Responses
400 Bad Request
404 Not Found
500 Internal Server Error
{
"status" : false ,
"message" : "paymentIntentId es requerido" ,
"code" : null
}
Code Examples
curl -X GET https://api.example.com/api/payments/pi_3OJxRe2eZvKYlo2C0XYZ1234 \
-H "Authorization: Bearer YOUR_API_KEY"
Use Cases
Check Payment Status
const checkPaymentStatus = async ( paymentIntentId ) => {
const response = await fetch ( `/api/payments/ ${ paymentIntentId } ` );
const { data } = await response . json ();
switch ( data . status ) {
case 'succeeded' :
console . log ( 'Payment completed successfully!' );
break ;
case 'processing' :
console . log ( 'Payment is being processed...' );
break ;
case 'requires_action' :
console . log ( 'Payment requires customer action' );
break ;
case 'canceled' :
console . log ( 'Payment was canceled' );
break ;
default :
console . log ( `Payment status: ${ data . status } ` );
}
return data . status ;
};
const getChargeInfo = async ( paymentIntentId ) => {
const response = await fetch ( `/api/payments/ ${ paymentIntentId } ` );
const { data } = await response . json ();
if ( data . charges . data . length > 0 ) {
const charge = data . charges . data [ 0 ];
return {
chargeId: charge . id ,
amount: charge . amount ,
paid: charge . paid ,
refunded: charge . refunded ,
amountRefunded: charge . amount_refunded
};
}
return null ;
};
This endpoint is useful for polling payment status after creation or confirmation. However, for production applications, it’s recommended to use Stripe webhooks to receive real-time payment updates instead of polling.