Skip to main content

POST /api/payments/create

Creates a new payment intent in Stripe. A payment intent represents an intention to collect payment from a customer and tracks the lifecycle of the payment process from creation through completion.
The amount should be provided in whole currency units (e.g., euros, not cents). The API automatically multiplies by 100 internally to convert to cents for Stripe. For example, to charge €10.00, pass 10.

Request Body

amount
integer
required
The amount to charge in whole currency units (euros). The API multiplies this by 100 internally to convert to cents.Example: 10 for €10.00 (becomes 1000 cents internally)
customer_id
string
required
The Stripe customer ID to charge. Must be a valid Stripe customer ID starting with cus_.Example: cus_NffrFeUfNV2Hib
payment_method
string
required
The payment method ID to use for this payment. Must be a valid Stripe payment method ID starting with pm_.Example: pm_1Nvmn6LkdIwHu7ix

Response

status
boolean
Indicates if the request was successful
message
string
Human-readable message describing the resultExample: Intento de pago creado correctamente
data
object
The Stripe PaymentIntent object

Success Response

{
  "status": true,
  "message": "Intento de pago creado correctamente",
  "data": {
    "id": "pi_3OJxRe2eZvKYlo2C0XYZ1234",
    "object": "payment_intent",
    "amount": 100000,
    "currency": "eur",
    "customer": "cus_NffrFeUfNV2Hib",
    "payment_method": "pm_1Nvmn6LkdIwHu7ix",
    "payment_method_types": ["card"],
    "status": "requires_confirmation",
    "client_secret": "pi_3OJxRe2eZvKYlo2C0XYZ1234_secret_abcdefghij",
    "created": 1672531200,
    "livemode": false
  }
}

Error Responses

{
  "status": false,
  "message": "customer_id, amount y payment_method son requeridos",
  "code": null
}

Code Examples

curl -X POST https://api.example.com/api/payments/create \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "amount": 1000,
    "customer_id": "cus_NffrFeUfNV2Hib",
    "payment_method": "pm_1Nvmn6LkdIwHu7ix"
  }'

Payment Intent Lifecycle

After creating a payment intent, it typically follows this flow:
  1. Created - Payment intent is created with status requires_confirmation
  2. Confirmed - Call the confirm endpoint to process the payment
  3. Succeeded - Payment completes successfully
Note that the API multiplies the amount by 100 internally. If you pass 1000, the actual charge will be €100,000.00 (1000 × 100 cents). Make sure you’re passing the correct amount in cents.

Build docs developers (and LLMs) love