Overview
Masar Eagle integrates with Moyasar payment gateway to process online payments for trip bookings. The verification flow ensures payment authenticity before confirming bookings.Moyasar is a Saudi Arabian payment gateway supporting credit cards, Apple Pay, and STC Pay.
Verify Company Trip Payment
Verify Moyasar payment for a company trip booking and update booking status.Path Parameters
The booking ID to verify payment for
Request Body
The payment ID returned by Moyasar after payment completion
Response Fields
Indicates if payment verification succeeded
Status message in Arabic
Current booking status after verification (Pending, Cancelled, etc.)
Payment status (Completed, Failed, etc.)
Amount paid if payment succeeded
Currency of the payment
Payment Verification Flow
- Payment Order Lookup: System retrieves payment order from database
- Moyasar Verification: Queries Moyasar API to verify payment status
- Status Check: Validates payment wasn’t already processed
- Booking Update: Updates booking and trip seat availability
- Notification: Sends confirmation to company
Example Request
Success Response
Failed Payment Response
Expired Payment Response
Already Verified Response
Post-Verification Actions:
- Successful payments increment trip booking count
- Booking status changes to “Pending” awaiting company approval
- Company receives notification of new booking
- Wallet operations are deferred until company approval
Verify Public Trip Payment
Verify Moyasar payment for a public trip booking with seat reservation.Path Parameters
The public trip booking ID
Request Body
The payment ID returned by Moyasar
Response Fields
Indicates if payment verification succeeded
Status message in Arabic
Booking status after verification
Payment status
Amount paid
Payment currency
Public Trip Verification Flow
- Payment Verification: Validates payment with Moyasar
- Seat Availability Check: Ensures requested seats are still available
- Seat Reservation: Reserves seats on the trip
- Booking Confirmation: Updates booking to Pending status
- Notification: Alerts company of new booking
Example Request
Success Response
Seats No Longer Available
Payment Verification States
Payment Order Not Found
Booking Not Found
Booking Already Rejected/Cancelled
Integration Notes
Frontend Integration
- Create Booking: Get booking ID from booking creation endpoint
- Initiate Moyasar Payment: Use booking ID as order reference
- Payment Callback: Receive Moyasar payment ID
- Verify Payment: Call verification endpoint with payment ID
- Handle Response: Show success/failure message to user
Transaction Safety
- All payment verifications use database transactions
- Failed verifications trigger automatic rollback
- Duplicate verification attempts are detected and prevented
- Payment status transitions are atomic
Notification Flow
| Event | Recipient | Notification Type |
|---|---|---|
| Payment Success | Passenger | Payment confirmation |
| Payment Success | Company | New booking alert |
| Payment Failed | Passenger | Payment failed notice |
| Seats Unavailable | Passenger | Refund notification |