{
	"info": {
		"_postman_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
		"name": "Payment Module API",
		"description": "# Payment Module API Collection\n\nComplete API documentation for the Payment Module.\n\n## Features\n- Multiple payment gateways (HyperPay, Tabby, Tamara, MyFatoorah, Moyasar, Wallet)\n- Wallet management (balance, transactions, charges)\n- Withdraw requests system\n- Admin dashboard APIs\n\n## Authentication\nAll endpoints require Bearer token authentication except public callbacks.\n\n## Setup\n1. Set `base_url` variable to your server URL\n2. Login and set the `token` variable\n3. Start testing!\n\n## Support\nFor issues, contact the development team.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"variable": [
		{
			"key": "base_url",
			"value": "http://localhost:8000",
			"type": "string",
			"description": "Base URL of the API server"
		},
		{
			"key": "token",
			"value": "",
			"type": "string",
			"description": "Bearer authentication token"
		},
		{
			"key": "transaction_id",
			"value": "",
			"type": "string",
			"description": "Payment transaction ID (auto-saved from checkout)"
		},
		{
			"key": "payment_transaction_db_id",
			"value": "1",
			"type": "string",
			"description": "Payment transaction database ID"
		},
		{
			"key": "withdraw_request_id",
			"value": "1",
			"type": "string",
			"description": "Withdraw request ID"
		}
	],
	"auth": {
		"type": "bearer",
		"bearer": [
			{
				"key": "token",
				"value": "{{token}}",
				"type": "string"
			}
		]
	},
	"item": [
		{
			"name": "01. Payment Checkout",
			"description": "# Payment Checkout Endpoints\n\nInitiate payments using various payment gateways.\n\n## Supported Gateways\n- **HyperPay**: VISA, MasterCard, MADA, Apple Pay\n- **Tabby**: Buy Now Pay Later\n- **Tamara**: Buy Now Pay Later\n- **MyFatoorah**: Multiple payment methods\n- **Moyasar**: Credit cards\n- **Wallet**: Pay from wallet balance\n\n## Flow\n1. Call checkout endpoint\n2. Redirect user to `redirect_url`\n3. User completes payment\n4. Verify payment status",
			"item": [
				{
					"name": "Checkout - HyperPay VISA",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "payable_type",
									"value": "order",
									"description": "Type of payable model (e.g., order, subscription)",
									"type": "text"
								},
								{
									"key": "payable_id",
									"value": "1",
									"description": "ID of the payable model",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "hyperpay",
									"description": "Payment gateway name",
									"type": "text"
								},
								{
									"key": "brand",
									"value": "visa",
									"description": "Card brand: visa, master, mada, applepay",
									"type": "text"
								},
								{
									"key": "meta[order_id]",
									"value": "ORD-123",
									"description": "Optional metadata",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/checkout",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "checkout"]
						},
						"description": "# Checkout with HyperPay (VISA)\n\nInitiate a payment using HyperPay gateway with VISA card.\n\n## Request Parameters\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| payable_type | string | Yes | Model type (order, subscription) |\n| payable_id | integer | Yes | Model ID |\n| payment_method | string | Yes | `hyperpay` |\n| brand | string | Yes | `visa` |\n| meta | object | No | Additional metadata |\n\n## Response\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"transaction_id\": \"txn_01HXXXXXXXXX\",\n    \"redirect_url\": \"https://...\",\n    \"action\": \"redirect\"\n  }\n}\n```"
					},
					"response": []
				},
				{
					"name": "Checkout - HyperPay MADA",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "payable_type",
									"value": "order",
									"description": "Type of payable model",
									"type": "text"
								},
								{
									"key": "payable_id",
									"value": "1",
									"description": "ID of the payable model",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "hyperpay",
									"description": "Payment gateway name",
									"type": "text"
								},
								{
									"key": "brand",
									"value": "mada",
									"description": "MADA debit card (Saudi Arabia)",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/checkout",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "checkout"]
						},
						"description": "# Checkout with HyperPay (MADA)\n\nInitiate a payment using HyperPay gateway with MADA debit card.\n\n**Note:** MADA is a Saudi Arabian debit card network."
					},
					"response": []
				},
				{
					"name": "Checkout - HyperPay MasterCard",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "payable_type",
									"value": "order",
									"description": "Type of payable model",
									"type": "text"
								},
								{
									"key": "payable_id",
									"value": "1",
									"description": "ID of the payable model",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "hyperpay",
									"description": "Payment gateway name",
									"type": "text"
								},
								{
									"key": "brand",
									"value": "master",
									"description": "MasterCard credit/debit card",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/checkout",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "checkout"]
						},
						"description": "# Checkout with HyperPay (MasterCard)\n\nInitiate a payment using HyperPay gateway with MasterCard."
					},
					"response": []
				},
				{
					"name": "Checkout - HyperPay Apple Pay",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "payable_type",
									"value": "order",
									"description": "Type of payable model",
									"type": "text"
								},
								{
									"key": "payable_id",
									"value": "1",
									"description": "ID of the payable model",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "hyperpay",
									"description": "Payment gateway name",
									"type": "text"
								},
								{
									"key": "brand",
									"value": "applepay",
									"description": "Apple Pay",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/checkout",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "checkout"]
						},
						"description": "# Checkout with HyperPay (Apple Pay)\n\nInitiate a payment using HyperPay gateway with Apple Pay.\n\n**Note:** Requires Apple Pay enabled device."
					},
					"response": []
				},
				{
					"name": "Checkout - Tabby",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "payable_type",
									"value": "order",
									"description": "Type of payable model",
									"type": "text"
								},
								{
									"key": "payable_id",
									"value": "1",
									"description": "ID of the payable model",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "tabby",
									"description": "Tabby - Buy Now Pay Later",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/checkout",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "checkout"]
						},
						"description": "# Checkout with Tabby\n\nInitiate a Buy Now Pay Later payment using Tabby.\n\n## About Tabby\n- Split payments into 4 interest-free installments\n- Available in Saudi Arabia, UAE, Kuwait, Bahrain"
					},
					"response": []
				},
				{
					"name": "Checkout - Tamara",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "payable_type",
									"value": "order",
									"description": "Type of payable model",
									"type": "text"
								},
								{
									"key": "payable_id",
									"value": "1",
									"description": "ID of the payable model",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "tamara",
									"description": "Tamara - Buy Now Pay Later",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/checkout",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "checkout"]
						},
						"description": "# Checkout with Tamara\n\nInitiate a Buy Now Pay Later payment using Tamara.\n\n## About Tamara\n- Split payments into installments\n- Available in Saudi Arabia, UAE, Kuwait"
					},
					"response": []
				},
				{
					"name": "Checkout - MyFatoorah",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "payable_type",
									"value": "order",
									"description": "Type of payable model",
									"type": "text"
								},
								{
									"key": "payable_id",
									"value": "1",
									"description": "ID of the payable model",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "myfatoorah",
									"description": "MyFatoorah payment gateway",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/checkout",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "checkout"]
						},
						"description": "# Checkout with MyFatoorah\n\nInitiate a payment using MyFatoorah gateway.\n\n## About MyFatoorah\n- Supports multiple payment methods\n- Available in GCC countries"
					},
					"response": []
				},
				{
					"name": "Checkout - Moyasar",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "payable_type",
									"value": "order",
									"description": "Type of payable model",
									"type": "text"
								},
								{
									"key": "payable_id",
									"value": "1",
									"description": "ID of the payable model",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "moyasar",
									"description": "Moyasar payment gateway",
									"type": "text"
								},
								{
									"key": "brand",
									"value": "creditcard",
									"description": "Payment type: creditcard, applepay, stcpay",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/checkout",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "checkout"]
						},
						"description": "# Checkout with Moyasar\n\nInitiate a payment using Moyasar gateway.\n\n## About Moyasar\n- Saudi payment gateway\n- Supports credit cards, Apple Pay, STC Pay"
					},
					"response": []
				},
				{
					"name": "Checkout - Wallet",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "payable_type",
									"value": "order",
									"description": "Type of payable model",
									"type": "text"
								},
								{
									"key": "payable_id",
									"value": "1",
									"description": "ID of the payable model",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "wallet",
									"description": "Pay from wallet balance",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/checkout",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "checkout"]
						},
						"description": "# Checkout with Wallet\n\nPay directly from user's wallet balance.\n\n## Notes\n- Instant payment (no redirect)\n- Requires sufficient wallet balance\n- Action will be `completed` instead of `redirect`"
					},
					"response": []
				}
			]
		},
		{
			"name": "02. Payment Verification",
			"description": "# Payment Verification\n\nVerify and check payment status after user completes payment on gateway.",
			"item": [
				{
					"name": "Verify Payment (by Transaction ID)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "transaction_id",
									"value": "{{transaction_id}}",
									"description": "Merchant transaction ID (txn_XXXXX)",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/verify",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "verify"]
						},
						"description": "# Verify Payment\n\nVerify payment status using the merchant transaction ID.\n\n## When to Call\n- After user returns from payment gateway\n- To check if payment was successful\n\n## Response Status\n- `completed`: Payment successful\n- `failed`: Payment failed\n- `pending`: Payment still processing"
					},
					"response": []
				},
				{
					"name": "Verify Payment (by Database ID)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "id",
									"value": "{{payment_transaction_db_id}}",
									"description": "Database ID of the transaction",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/verify",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "verify"]
						},
						"description": "# Verify Payment by Database ID\n\nAlternative way to verify payment using database ID instead of merchant transaction ID."
					},
					"response": []
				},
				{
					"name": "Get Transaction Status",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/status/{{transaction_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "status", "{{transaction_id}}"]
						},
						"description": "# Get Transaction Status\n\nGet current status of a transaction without triggering verification with the gateway.\n\n## Use Case\n- Check status without calling external gateway\n- Display transaction info to user"
					},
					"response": []
				},
				{
					"name": "Payment Callback - Success",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/callback?transaction_id={{transaction_id}}&status=success",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "callback"],
							"query": [
								{
									"key": "transaction_id",
									"value": "{{transaction_id}}",
									"description": "Transaction ID"
								},
								{
									"key": "status",
									"value": "success",
									"description": "Payment status from gateway"
								}
							]
						},
						"description": "# Payment Callback (Success)\n\nHandle callback from payment gateway after successful payment.\n\n## Status Values\n- `success`: Payment completed\n- `paid`: Payment completed (alternative)\n- `failure`: Payment failed\n- `cancel`: User cancelled"
					},
					"response": []
				},
				{
					"name": "Payment Callback - Failure",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/callback?transaction_id={{transaction_id}}&status=failure",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "callback"],
							"query": [
								{
									"key": "transaction_id",
									"value": "{{transaction_id}}"
								},
								{
									"key": "status",
									"value": "failure"
								}
							]
						},
						"description": "# Payment Callback (Failure)\n\nHandle callback from payment gateway after failed payment."
					},
					"response": []
				},
				{
					"name": "Payment Callback - Cancel",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/callback?transaction_id={{transaction_id}}&status=cancel",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "callback"],
							"query": [
								{
									"key": "transaction_id",
									"value": "{{transaction_id}}"
								},
								{
									"key": "status",
									"value": "cancel"
								}
							]
						},
						"description": "# Payment Callback (Cancel)\n\nHandle callback when user cancels payment on gateway."
					},
					"response": []
				}
			]
		},
		{
			"name": "03. Wallet",
			"description": "# Wallet Management\n\nUser wallet operations including:\n- View balance and transactions\n- Charge wallet via payment gateway\n- Request withdrawals",
			"item": [
				{
					"name": "Get Wallet Info",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/wallet",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "wallet"]
						},
						"description": "# Get Wallet Info\n\nGet complete wallet information including:\n- Current balance\n- Withdrawal balance (pending withdrawals)\n- Total balance\n- Recent transactions"
					},
					"response": []
				},
				{
					"name": "Get Wallet Balance",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/wallet/balance",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "wallet", "balance"]
						},
						"description": "# Get Wallet Balance\n\nGet wallet balance only (lightweight endpoint).\n\n## Response\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"balance\": 500.00,\n    \"formatted_balance\": \"500.00 SAR\"\n  }\n}\n```"
					},
					"response": []
				},
				{
					"name": "Get Wallet Transactions",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/wallet/transactions?per_page=15&page=1",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "wallet", "transactions"],
							"query": [
								{
									"key": "per_page",
									"value": "15",
									"description": "Items per page (default: 15)"
								},
								{
									"key": "page",
									"value": "1",
									"description": "Page number"
								}
							]
						},
						"description": "# Get Wallet Transactions\n\nGet paginated list of wallet transactions.\n\n## Transaction Types\n- `deposit`: Money added to wallet\n- `withdraw`: Money deducted from wallet\n- `payment`: Payment made using wallet\n- `refund`: Refund received\n- `transfer_in`: Transfer received\n- `transfer_out`: Transfer sent"
					},
					"response": []
				},
				{
					"name": "Charge Wallet - HyperPay VISA",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "amount",
									"value": "100",
									"description": "Amount to charge (minimum based on config)",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "hyperpay",
									"description": "Payment gateway",
									"type": "text"
								},
								{
									"key": "brand",
									"value": "visa",
									"description": "Card brand",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/wallet/charge",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "wallet", "charge"]
						},
						"description": "# Charge Wallet\n\nAdd funds to wallet using payment gateway.\n\n## Flow\n1. Call this endpoint\n2. Redirect user to `redirect_url`\n3. User completes payment\n4. Wallet balance is automatically updated"
					},
					"response": []
				},
				{
					"name": "Charge Wallet - HyperPay MADA",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "amount",
									"value": "100",
									"description": "Amount to charge",
									"type": "text"
								},
								{
									"key": "payment_method",
									"value": "hyperpay",
									"description": "Payment gateway",
									"type": "text"
								},
								{
									"key": "brand",
									"value": "mada",
									"description": "MADA card",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/wallet/charge",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "wallet", "charge"]
						},
						"description": "# Charge Wallet with MADA\n\nAdd funds to wallet using MADA debit card."
					},
					"response": []
				},
				{
					"name": "Get Charge History",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/wallet/charges?per_page=15&page=1",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "wallet", "charges"],
							"query": [
								{
									"key": "per_page",
									"value": "15",
									"description": "Items per page"
								},
								{
									"key": "page",
									"value": "1",
									"description": "Page number"
								}
							]
						},
						"description": "# Get Charge History\n\nGet history of wallet charge attempts.\n\n## Charge Status\n- `pending`: Awaiting payment\n- `completed`: Successfully charged\n- `failed`: Payment failed"
					},
					"response": []
				},
				{
					"name": "Create Withdraw Request",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "amount",
									"value": "200",
									"description": "Withdrawal amount (min/max based on config)",
									"type": "text"
								},
								{
									"key": "bank_name",
									"value": "Al Rajhi Bank",
									"description": "Bank name",
									"type": "text"
								},
								{
									"key": "account_name",
									"value": "Mohammed Ahmed",
									"description": "Account holder name",
									"type": "text"
								},
								{
									"key": "account_number",
									"value": "1234567890",
									"description": "Bank account number",
									"type": "text"
								},
								{
									"key": "IBAN",
									"value": "SA0380000000608010167519",
									"description": "IBAN (24 characters for Saudi Arabia)",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/payment/wallet/withdraw",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "wallet", "withdraw"]
						},
						"description": "# Create Withdraw Request\n\nRequest to withdraw funds from wallet to bank account.\n\n## Requirements\n- Sufficient wallet balance\n- Valid bank details\n- Amount within min/max limits\n\n## Process\n1. User submits request\n2. Amount is held in `withdrawal_balance`\n3. Admin reviews and approves/rejects\n4. If approved, funds are transferred\n5. If rejected, amount returns to main balance"
					},
					"response": []
				},
				{
					"name": "Get My Withdraw Requests",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/wallet/withdraw-requests?per_page=15&page=1",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "wallet", "withdraw-requests"],
							"query": [
								{
									"key": "per_page",
									"value": "15",
									"description": "Items per page"
								},
								{
									"key": "page",
									"value": "1",
									"description": "Page number"
								}
							]
						},
						"description": "# Get My Withdraw Requests\n\nGet list of user's withdraw requests.\n\n## Request Status\n- `pending`: Awaiting admin review\n- `approved`: Request approved and processed\n- `rejected`: Request rejected by admin"
					},
					"response": []
				}
			]
		},
		{
			"name": "04. Admin - Transactions",
			"description": "# Admin Transaction Management\n\nAdmin endpoints for managing payment transactions.\n\n**Required Permission:** Admin access",
			"item": [
				{
					"name": "List All Transactions",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/transactions?per_page=15&page=1",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "transactions"],
							"query": [
								{
									"key": "per_page",
									"value": "15",
									"description": "Items per page"
								},
								{
									"key": "page",
									"value": "1",
									"description": "Page number"
								}
							]
						},
						"description": "# List All Transactions\n\nGet paginated list of all payment transactions."
					},
					"response": []
				},
				{
					"name": "List Transactions (Filtered)",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/transactions?status=completed&payment_method=hyperpay&from_date=2024-01-01&to_date=2024-12-31&min_amount=100&max_amount=1000&search=&per_page=15&page=1",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "transactions"],
							"query": [
								{
									"key": "status",
									"value": "completed",
									"description": "Filter by status: pending, processing, completed, failed, cancelled, refunded"
								},
								{
									"key": "payment_method",
									"value": "hyperpay",
									"description": "Filter by gateway: hyperpay, tabby, tamara, myfatoorah, moyasar, wallet"
								},
								{
									"key": "from_date",
									"value": "2024-01-01",
									"description": "Filter from date (YYYY-MM-DD)"
								},
								{
									"key": "to_date",
									"value": "2024-12-31",
									"description": "Filter to date (YYYY-MM-DD)"
								},
								{
									"key": "min_amount",
									"value": "100",
									"description": "Minimum amount"
								},
								{
									"key": "max_amount",
									"value": "1000",
									"description": "Maximum amount"
								},
								{
									"key": "search",
									"value": "",
									"description": "Search by transaction ID, user name, email"
								},
								{
									"key": "per_page",
									"value": "15",
									"description": "Items per page"
								},
								{
									"key": "page",
									"value": "1",
									"description": "Page number"
								}
							]
						},
						"description": "# List Transactions with Filters\n\nGet filtered list of transactions.\n\n## Available Filters\n| Filter | Description |\n|--------|-------------|\n| status | Transaction status |\n| payment_method | Payment gateway |\n| from_date | Start date |\n| to_date | End date |\n| min_amount | Minimum amount |\n| max_amount | Maximum amount |\n| search | Search term |"
					},
					"response": []
				},
				{
					"name": "Get Transaction Statistics",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/transactions/statistics?from_date=2024-01-01&to_date=2024-12-31",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "transactions", "statistics"],
							"query": [
								{
									"key": "from_date",
									"value": "2024-01-01",
									"description": "Optional: Start date"
								},
								{
									"key": "to_date",
									"value": "2024-12-31",
									"description": "Optional: End date"
								}
							]
						},
						"description": "# Get Transaction Statistics\n\nGet aggregated statistics for transactions.\n\n## Response Includes\n- Total transactions count\n- Total amount\n- Breakdown by status\n- Breakdown by payment method\n- Daily stats (last 30 days)"
					},
					"response": []
				},
				{
					"name": "Get Filter Options",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/transactions/filters",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "transactions", "filters"]
						},
						"description": "# Get Filter Options\n\nGet available filter options for building filter UI.\n\n## Returns\n- List of statuses\n- List of payment methods\n- List of brands"
					},
					"response": []
				},
				{
					"name": "Export Transactions (CSV)",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "text/csv",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/transactions/export?status=completed&from_date=2024-01-01&to_date=2024-12-31",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "transactions", "export"],
							"query": [
								{
									"key": "status",
									"value": "completed",
									"description": "Optional: Filter by status"
								},
								{
									"key": "from_date",
									"value": "2024-01-01",
									"description": "Optional: Start date"
								},
								{
									"key": "to_date",
									"value": "2024-12-31",
									"description": "Optional: End date"
								}
							]
						},
						"description": "# Export Transactions to CSV\n\nDownload transactions as CSV file.\n\n**Note:** Same filters as list endpoint can be applied."
					},
					"response": []
				},
				{
					"name": "Get Single Transaction",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/transactions/{{payment_transaction_db_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "transactions", "{{payment_transaction_db_id}}"]
						},
						"description": "# Get Single Transaction\n\nGet detailed information about a specific transaction.\n\n## Response Includes\n- Transaction details\n- Payable information\n- User information\n- Gateway response data"
					},
					"response": []
				},
				{
					"name": "Refund Transaction (Full)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "reason",
									"value": "Customer requested full refund",
									"description": "Reason for refund",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/admin/payment/transactions/{{payment_transaction_db_id}}/refund",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "transactions", "{{payment_transaction_db_id}}", "refund"]
						},
						"description": "# Full Refund\n\nRefund the full transaction amount.\n\n## Requirements\n- Transaction must be completed\n- Not already refunded"
					},
					"response": []
				},
				{
					"name": "Refund Transaction (Partial)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "amount",
									"value": "50",
									"description": "Partial refund amount",
									"type": "text"
								},
								{
									"key": "reason",
									"value": "Partial refund for returned item",
									"description": "Reason for refund",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/admin/payment/transactions/{{payment_transaction_db_id}}/refund",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "transactions", "{{payment_transaction_db_id}}", "refund"]
						},
						"description": "# Partial Refund\n\nRefund a partial amount of the transaction.\n\n## Requirements\n- Transaction must be completed\n- Amount must be less than or equal to original amount\n- Not already fully refunded"
					},
					"response": []
				}
			]
		},
		{
			"name": "05. Admin - Withdrawals",
			"description": "# Admin Withdrawal Management\n\nAdmin endpoints for managing user withdrawal requests.\n\n**Required Permission:** Admin access",
			"item": [
				{
					"name": "List All Withdraw Requests",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/withdrawals?per_page=15&page=1",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "withdrawals"],
							"query": [
								{
									"key": "per_page",
									"value": "15",
									"description": "Items per page"
								},
								{
									"key": "page",
									"value": "1",
									"description": "Page number"
								}
							]
						},
						"description": "# List All Withdraw Requests\n\nGet paginated list of all withdrawal requests."
					},
					"response": []
				},
				{
					"name": "List Withdraw Requests (Filtered)",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/withdrawals?status=pending&bank_name=Al Rajhi&from_date=2024-01-01&to_date=2024-12-31&min_amount=100&max_amount=5000&search=&per_page=15&page=1",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "withdrawals"],
							"query": [
								{
									"key": "status",
									"value": "pending",
									"description": "Filter by status: pending, approved, rejected"
								},
								{
									"key": "bank_name",
									"value": "Al Rajhi",
									"description": "Filter by bank name"
								},
								{
									"key": "from_date",
									"value": "2024-01-01",
									"description": "Filter from date"
								},
								{
									"key": "to_date",
									"value": "2024-12-31",
									"description": "Filter to date"
								},
								{
									"key": "min_amount",
									"value": "100",
									"description": "Minimum amount"
								},
								{
									"key": "max_amount",
									"value": "5000",
									"description": "Maximum amount"
								},
								{
									"key": "search",
									"value": "",
									"description": "Search by user name, email, account name, IBAN"
								},
								{
									"key": "per_page",
									"value": "15"
								},
								{
									"key": "page",
									"value": "1"
								}
							]
						},
						"description": "# List Withdraw Requests with Filters\n\nGet filtered list of withdrawal requests."
					},
					"response": []
				},
				{
					"name": "Get Withdrawal Statistics",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/withdrawals/statistics?from_date=2024-01-01&to_date=2024-12-31",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "withdrawals", "statistics"],
							"query": [
								{
									"key": "from_date",
									"value": "2024-01-01",
									"description": "Optional: Start date"
								},
								{
									"key": "to_date",
									"value": "2024-12-31",
									"description": "Optional: End date"
								}
							]
						},
						"description": "# Get Withdrawal Statistics\n\nGet aggregated statistics for withdrawals.\n\n## Response Includes\n- Total requests count\n- Pending/Approved/Rejected counts and amounts\n- Breakdown by bank\n- Daily stats"
					},
					"response": []
				},
				{
					"name": "Get Filter Options",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/withdrawals/filters",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "withdrawals", "filters"]
						},
						"description": "# Get Filter Options\n\nGet available filter options.\n\n## Returns\n- List of statuses\n- List of banks (from existing requests)"
					},
					"response": []
				},
				{
					"name": "Export Withdrawals (CSV)",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "text/csv",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/withdrawals/export?status=approved&from_date=2024-01-01&to_date=2024-12-31",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "withdrawals", "export"],
							"query": [
								{
									"key": "status",
									"value": "approved"
								},
								{
									"key": "from_date",
									"value": "2024-01-01"
								},
								{
									"key": "to_date",
									"value": "2024-12-31"
								}
							]
						},
						"description": "# Export Withdrawals to CSV\n\nDownload withdrawal requests as CSV file."
					},
					"response": []
				},
				{
					"name": "Get Single Withdraw Request",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/admin/payment/withdrawals/{{withdraw_request_id}}",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "withdrawals", "{{withdraw_request_id}}"]
						},
						"description": "# Get Single Withdraw Request\n\nGet detailed information about a specific withdrawal request.\n\n## Response Includes\n- Request details\n- Bank information\n- User information\n- Wallet information\n- Processing history"
					},
					"response": []
				},
				{
					"name": "Approve Withdraw Request",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "note",
									"value": "Approved and transferred to bank account",
									"description": "Admin note (optional)",
									"type": "text"
								},
								{
									"key": "admin_data[transfer_reference]",
									"value": "TRF-123456",
									"description": "Bank transfer reference (optional)",
									"type": "text"
								},
								{
									"key": "admin_data[transfer_date]",
									"value": "2024-01-15",
									"description": "Transfer date (optional)",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/admin/payment/withdrawals/{{withdraw_request_id}}/approve",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "withdrawals", "{{withdraw_request_id}}", "approve"]
						},
						"description": "# Approve Withdraw Request\n\nApprove a pending withdrawal request.\n\n## What Happens\n1. Request status changes to `approved`\n2. Amount is deducted from `withdrawal_balance`\n3. User is notified\n\n## Requirements\n- Request must be pending\n- Admin must have approval permission"
					},
					"response": []
				},
				{
					"name": "Reject Withdraw Request",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "formdata",
							"formdata": [
								{
									"key": "note",
									"value": "Invalid bank account details - IBAN verification failed",
									"description": "Rejection reason (required)",
									"type": "text"
								},
								{
									"key": "admin_data[rejection_code]",
									"value": "INVALID_IBAN",
									"description": "Rejection code (optional)",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "{{base_url}}/api/admin/payment/withdrawals/{{withdraw_request_id}}/reject",
							"host": ["{{base_url}}"],
							"path": ["api", "admin", "payment", "withdrawals", "{{withdraw_request_id}}", "reject"]
						},
						"description": "# Reject Withdraw Request\n\nReject a pending withdrawal request.\n\n## What Happens\n1. Request status changes to `rejected`\n2. Amount returns to user's main `balance`\n3. User is notified with rejection reason\n\n## Requirements\n- Request must be pending\n- Rejection note is required"
					},
					"response": []
				}
			]
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					"// Set default headers",
					"pm.request.headers.add({",
					"    key: 'Accept-Language',",
					"    value: 'en'",
					"});"
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					"// Auto-save transaction_id from checkout response",
					"if (pm.response.code === 200 || pm.response.code === 201) {",
					"    try {",
					"        var jsonData = pm.response.json();",
					"        if (jsonData.data) {",
					"            // Save transaction_id",
					"            if (jsonData.data.transaction_id) {",
					"                pm.collectionVariables.set('transaction_id', jsonData.data.transaction_id);",
					"                console.log('Saved transaction_id:', jsonData.data.transaction_id);",
					"            }",
					"            // Save withdraw_request from withdraw response",
					"            if (jsonData.data.withdraw_request && jsonData.data.withdraw_request.id) {",
					"                pm.collectionVariables.set('withdraw_request_id', jsonData.data.withdraw_request.id);",
					"                console.log('Saved withdraw_request_id:', jsonData.data.withdraw_request.id);",
					"            }",
					"        }",
					"    } catch (e) {",
					"        console.log('Response is not JSON');",
					"    }",
					"}"
				]
			}
		}
	]
}
