A payment processing system built with Laravel.
- Payment registration
- Payment confirmation
- Payment failure handling
- Secure session handling
git clone git@github.com:deploily/satim-api-emulator.git
cd satim-api-emulator
cp src/.env.example src/.envUpdate .env to meet your environment
Start VSCode
code .If VSCode dont detect the remote container:
- open the Command Palette (usually Ctrl or Command + Shift + P)
- and type
>Remote-Containers: Open Folder in Container, - select it and choose the location of this project.
If you are prompted to Rebuild the container do it:

If the Rebuild prompt don't shows up :
- open the Command Palette (usually Ctrl or Command + Shift + P)
- and type
>Remote-Containers: Rebuild Container, - select it.
In the Extensions menu, search for "Remote - Containers" and install it:

Connect to http://localhost:8080
Credentials admin / admin
- Create new realm named
satim - Create new client
- name it:
laravel-api - Access Type:
confidential - Valid Redirect URIs:
http://localhost:8000/*
- name it:
- Get Client Secret
- Go to:
Clients > laravel-api > Credentials - Click Secret Key and copy the key
- Paste it into your .env
- Go to:
- Create a New User
- Go to:
Users → Add User - Fill in the username and set credentials (password, etc.)
- Go to:
- Get Realm Public Key
- Go to:
Realm Settings → Keys → RS256 - Click Public Key
- Copy the key and paste it into your
.envfile
- Go to:
Instalation
cd src
composer install
php artisan key:generate
php artisan migrateRun
cd src
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan serve- Endpoint:
/payment/rest/register.do - Method: GET
- Parameters:
userName: Required - User's usernamepassword: Required - User's passwordorderNumber: Required - Unique order identifieramount: Required - Payment amountcurrency: Required - Currency codereturnUrl: Required - URL to redirect on successfailUrl: Required - URL to redirect on failuredescription: Required - Payment descriptionlanguage: Required - Language preferencejsonParams: Required - Additional parameters in JSON format
- Endpoint:
/payment/rest/confirm.do - Method: GET
- Parameters:
userName: Required - User's usernamepassword: Required - User's passwordorderNumber: Required - Order identifierlanguage: Required - Language preference
- Endpoint:
/payment/rest/refund.do - Method: GET
The payment webpage is accessible at /paymentWebpage with the order ID as a query parameter:
- Endpoint:
/paymentWebpage?orderId=ORDER_ID - Features:
- Two action buttons: Confirm Payment and Fail Payment
- Secure form submission
- Responsive design
- Session-based URL handling
The application uses PHP sessions to store:
- Return URL for successful payments
- Fail URL for failed payments
- Order information
- CSRF protection for form submissions
- Input validation for all parameters
- Secure session handling
GET /api/payment/rest/register.do?currency=012&amount=139139&language=fr&orderNumber=1538298192&userName=xxxxxxxx&password=xxxxxxx&returnUrl=httpssatimdzdirectpay
curl -X GET "http://127.0.0.1:8000/api/payment/rest/register.do?orderNumber=123&amount=100¤cy=012&returnUrl=http://localhost/success&failUrl=http://localhost/fail&language=EN&userName=satim_68be9e9c5ec3f&password=B2fgKUNR1C&description=TestPayment&jsonParams=%7B%7D" \
-H "Accept: application/json"
GET /api/payment/rest/confirmOrder.do?language=EN&orderId=1&password=xxxxx&userName=testtest
curl -X GET "http://127.0.0.1:8000/api/payment/rest/confirmOrder.do?language=EN&orderId=5&userName=satim_68be9e9c5ec3f&password=B2fgKUNR1C" \
-H "Accept: application/json"
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the Apache License - see the LICENSE file for details.
To retrieve an access token with an existing Keycloak user (ranim), use the following curl command:
curl -X POST "http://172.17.0.1:8080/realms/satim/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=password" \
-d "client_id=laravel-api" \
-d "client_secret=PK2lHGeL4QaAW0eMXiaPqFnbzIi50OcK" \
-d "username=ranim" \
-d "password=ranim"