Payments
Endpoints to process payments with Stripe.
Stripe Integration
SalonBookIt uses Stripe for payment processing. The widget handles the entire flow automatically. These endpoints are for custom integrations.
POST
/api/v1/pagos/intent/
Creates a Stripe PaymentIntent to process a payment.
Body parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cliente_id |
integer | Yes | Customer ID |
amount |
integer | Yes | Amount in cents (e.g., 2500 = 25.00€) |
type |
string | Yes | booking, order or points |
reference_id |
integer | Yes | Booking, order or points package ID |
Request example
cURL
curl -X POST "https://app.salonbookit.com/api/v1/pagos/intent/" \
-H "X-API-Key: hh_pub_live_abc123..." \
-H "Authorization: Bearer eyJhbG..." \
-H "Content-Type: application/json" \
-d '{
"cliente_id": 456,
"amount": 2500,
"type": "booking",
"reference_id": 12345
}'
Response (200 OK)
JSON
{
"success": true,
"data": {
"client_secret": "pi_3N...secret_abc123",
"payment_intent_id": "pi_3N...",
"amount": 2500,
"currency": "eur",
"stripe_publishable_key": "pk_live_...",
"customer_id": "cus_abc123"
}
}
Frontend usage
Use the client_secret with Stripe.js to complete the payment:
JavaScript
// Initialize Stripe
const stripe = Stripe('pk_live_...');
const elements = stripe.elements({
clientSecret: response.data.client_secret
});
// Create card element
const cardElement = elements.create('card');
cardElement.mount('#card-element');
// Confirm payment
const { error, paymentIntent } = await stripe.confirmCardPayment(
response.data.client_secret,
{
payment_method: {
card: cardElement,
billing_details: {
name: 'Juan Pérez',
email: 'juan@email.com'
}
}
}
);
if (error) {
console.error('Error:', error.message);
} else if (paymentIntent.status === 'succeeded') {
// Successful payment
console.log('Payment completed:', paymentIntent.id);
}
POST
/api/v1/pagos/confirmar/
Confirms a payment after Stripe processes it.
Body parameters
| Parameter | Type | Description |
|---|---|---|
payment_intent_id |
string | Stripe PaymentIntent ID |
Response (200 OK)
JSON
{
"success": true,
"data": {
"pago_id": 789,
"estado": "completado",
"monto": 25.00,
"moneda": "EUR",
"reserva_actualizada": true,
"puntos_otorgados": 25,
"recibo_url": "https://pay.stripe.com/receipts/..."
}
}
Stripe Webhook
SalonBookIt receives Stripe webhooks automatically at:
POST https://app.salonbookit.com/api/v1/webhooks/stripe/
Processed events:
| Stripe Event | Action |
|---|---|
payment_intent.succeeded |
Marks payment as completed, updates booking |
payment_intent.payment_failed |
Marks payment as failed, notifies customer |
charge.refunded |
Records the refund |
charge.dispute.created |
Notifies business of dispute |
No configuration needed
The Stripe webhook is configured automatically when connecting your Stripe account in the Dashboard.
Payment errors
| Code | HTTP | Description |
|---|---|---|
STRIPE_NOT_CONFIGURED |
400 | Business doesn't have Stripe configured |
INVALID_AMOUNT |
400 | Invalid amount (must be positive) |
BOOKING_ALREADY_PAID |
400 | Booking has already been paid |
PAYMENT_FAILED |
400 | Error processing payment (see Stripe message) |
CARD_DECLINED |
400 | Card declined |
Supported currencies
| Code | Currency | Symbol |
|---|---|---|
EUR |
Euro | € |
USD |
US Dollar | $ |
GBP |
British Pound | £ |
AED |
UAE Dirham | د.إ |