Payment Gateways
HMP integrates with multiple payment gateways for secure transaction processing.
Supported Gateways
| Gateway | Regions | Features |
|---|---|---|
| Razorpay | India | Cards, UPI, Wallets, EMI |
| Stripe | Global | Cards, Apple Pay, Google Pay |
| PayU | India, LatAm | Cards, Net Banking, Wallets |
| CCAvenue | India | Cards, Net Banking |
| PayPal | Global | PayPal, Cards |
Integration Architecture
Razorpay Integration
Configuration
payment:
gateway: razorpay
mode: live # or 'test'
razorpay:
key_id: rzp_live_xxxxx
key_secret: xxxxx
webhook_secret: xxxxx
Supported Payment Methods
- Credit/Debit Cards (Visa, Mastercard, RuPay)
- UPI (Google Pay, PhonePe, Paytm)
- Net Banking (50+ banks)
- Wallets (Paytm, Amazon Pay, etc.)
- EMI (No-cost EMI available)
Payment Flow
API Example
// Create Razorpay order
const order = await razorpay.orders.create({
amount: 500000, // INR 5000 in paise
currency: 'INR',
receipt: 'folio_123',
notes: {
reservation_id: 'res_xyz789',
guest_name: 'John Doe'
}
});
// Frontend: Initialize checkout
const options = {
key: 'rzp_live_xxxxx',
amount: order.amount,
currency: order.currency,
order_id: order.id,
handler: function(response) {
// Verify payment
verifyPayment(response);
}
};
const rzp = new Razorpay(options);
rzp.open();
Stripe Integration
Configuration
payment:
gateway: stripe
mode: live
stripe:
publishable_key: pk_live_xxxxx
secret_key: sk_live_xxxxx
webhook_secret: whsec_xxxxx
Supported Payment Methods
- Credit/Debit Cards
- Apple Pay
- Google Pay
- Affirm, Klarna (Buy Now Pay Later)
- ACH Direct Debit (US)
- SEPA Direct Debit (EU)
Payment Flow
// Create PaymentIntent
const paymentIntent = await stripe.paymentIntents.create({
amount: 50000, // USD $500 in cents
currency: 'usd',
metadata: {
reservation_id: 'res_xyz789',
folio_id: 'folio_123'
}
});
// Frontend: Confirm payment
const result = await stripe.confirmCardPayment(
paymentIntent.client_secret,
{
payment_method: {
card: cardElement,
billing_details: {
name: 'John Doe'
}
}
}
);
Pre-Authorization
Create Authorization
curl -X POST https://api.hmpcloud.com/v1/payments/authorize \
-H "Authorization: Bearer <token>" \
-d '{
"amount": 15000.00,
"currency": "INR",
"folio_id": "folio_123",
"card_token": "tok_xxxxx"
}'
Capture Authorization
curl -X POST https://api.hmpcloud.com/v1/payments/capture \
-H "Authorization: Bearer <token>" \
-d '{
"authorization_id": "auth_xyz",
"amount": 12000.00
}'
Release Authorization
curl -X POST https://api.hmpcloud.com/v1/payments/release \
-H "Authorization: Bearer <token>" \
-d '{
"authorization_id": "auth_xyz"
}'
Refunds
Process Refund
curl -X POST https://api.hmpcloud.com/v1/payments/refund \
-H "Authorization: Bearer <token>" \
-d '{
"payment_id": "pay_xyz789",
"amount": 5000.00,
"reason": "Guest requested cancellation"
}'
PCI Compliance
Tokenization
HMP never stores raw card data. All card information is tokenized:
{
"card": {
"token": "tok_abc123",
"last_four": "4242",
"brand": "visa",
"expiry_month": 12,
"expiry_year": 2028
}
}
Security Measures
- TLS 1.3 encryption
- PCI DSS Level 1 compliance
- Tokenization of sensitive data
- 3D Secure authentication
Webhooks
Configure webhooks to receive payment notifications:
{
"event": "payment.captured",
"data": {
"payment_id": "pay_xyz789",
"amount": 15000.00,
"currency": "INR",
"status": "captured",
"folio_id": "folio_123"
}
}
Error Handling
| Error Code | Description | Action |
|---|---|---|
card_declined | Card declined | Try another card |
insufficient_funds | Insufficient balance | Try another card |
expired_card | Card expired | Use valid card |
invalid_cvv | CVV mismatch | Re-enter CVV |
3ds_failed | 3D Secure failed | Retry authentication |