Skip to main content
TMT Platform uses Stripe for international card payments. The integration follows the PaymentIntents API: create an intent on the server, complete it on the client with a card element, then confirm server-side.

Payment flow

1

Create a PaymentIntent

Call stripe_create_payment_intent with the order amount and currency. Receive a client_secret to pass to your Stripe.js client.
2

Collect card details on the client

Use the Stripe.js SDK with the client_secret to show a payment form and collect the card. Stripe handles PCI compliance.
3

Confirm the payment

After the client-side payment succeeds, call stripe_confirm_payment with the payment_intent_id to verify the payment status server-side.
4

Handle webhook events

Configure stripe_webhook as your Stripe webhook endpoint to receive asynchronous payment updates.

stripe_create_payment_intent

Creates a Stripe PaymentIntent for a given amount.

Endpoint

POST https://{region}-{project}.cloudfunctions.net/stripe_create_payment_intent

Request

data.amount
number
required
Payment amount in the base currency unit (e.g., dollars, not cents). The function converts to cents internally: Math.round(amount * 100).
data.currency
string
ISO 4217 currency code, lowercased. Defaults to "usd".
data.description
string
Human-readable payment description. Defaults to "Compra de tickets".
data.metadata
object
Key-value metadata attached to the PaymentIntent. Merged with { platform: "TMT", timestamp: <ISO string> }.
{
  "data": {
    "amount": 75.00,
    "currency": "usd",
    "description": "Compra de entradas - Evento Caracas Live",
    "metadata": {
      "event_id": "abc123",
      "order_id": "ord_xyz"
    }
  }
}

Response

status
number
200 on success, 400 if amount is invalid, 500 on Stripe error.
data.client_secret
string
The Stripe client_secret to pass to stripe.confirmCardPayment() on the frontend.
data.payment_intent_id
string
The PaymentIntent ID (e.g., pi_xxx). Store this to confirm or retrieve the payment later.
{
  "message": "Procesado",
  "status": 200,
  "data": {
    "success": true,
    "client_secret": "pi_3xxx_secret_yyy",
    "payment_intent_id": "pi_3xxx"
  }
}

stripe_confirm_payment

Retrieves a PaymentIntent by ID and confirms whether it has succeeded.

Endpoint

POST https://{region}-{project}.cloudfunctions.net/stripe_confirm_payment

Request

data.payment_intent_id
string
required
The Stripe PaymentIntent ID (e.g., pi_3xxx).
{
  "data": {
    "payment_intent_id": "pi_3xxx"
  }
}

Response

Payment succeeded:
{
  "message": "Procesado",
  "status": 200,
  "data": {
    "success": true,
    "payment_intent": {
      "id": "pi_3xxx",
      "status": "succeeded",
      "amount": 75.00,
      "currency": "usd",
      "created": 1718000000,
      "payment_method": "pm_xxx",
      "charges": []
    }
  }
}
Payment not completed:
{
  "message": "Error en el Proceso",
  "status": 400,
  "error": "El pago no fue completado. Estado: requires_payment_method",
  "data": {
    "payment_intent": {
      "id": "pi_3xxx",
      "status": "requires_payment_method"
    }
  }
}

stripe_get_payment_intent

Retrieves a PaymentIntent’s current state without asserting its status.

Endpoint

POST https://{region}-{project}.cloudfunctions.net/stripe_get_payment_intent

Request

data.payment_intent_id
string
required
The Stripe PaymentIntent ID.

Response

{
  "message": "Procesado",
  "status": 200,
  "data": {
    "success": true,
    "payment_intent": {
      "id": "pi_3xxx",
      "status": "succeeded",
      "amount": 75.00,
      "currency": "usd",
      "metadata": {
        "event_id": "abc123",
        "platform": "TMT"
      }
    }
  }
}

stripe_webhook

Receives and verifies Stripe webhook events. Configure this URL in your Stripe Dashboard under Webhooks.

Endpoint

POST https://{region}-{project}.cloudfunctions.net/stripe_webhook
This endpoint does not use the standard { data: { ... } } request body. Stripe sends raw event payloads with a Stripe-Signature header used for HMAC verification. Do not send JSON — configure the raw body in your Stripe Dashboard.

Handled event types

EventDescription
payment_intent.succeededPayment completed successfully
payment_intent.payment_failedPayment attempt failed

Webhook secret

Set the STRIPE_WEBHOOK_SECRET environment variable to the whsec_... secret from your Stripe Dashboard. This is used to verify the Stripe-Signature header.
firebase functions:secrets:set STRIPE_WEBHOOK_SECRET

Response

{ "received": true }
Returns HTTP 400 if signature verification fails.

Build docs developers (and LLMs) love