{
	"info": {
		"name": "PayGlobe Payment Gateway API",
		"description": "Complete API collection for PayGlobe Payment Gateway - Multi-gateway solution (Credit Cards + Meal Vouchers)",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"variable": [
		{
			"key": "base_url",
			"value": "https://api.payglobe.it/paymentgw",
			"type": "string"
		},
		{
			"key": "api_key_test",
			"value": "pk_test_LA_TUA_PUBLISHABLE_KEY",
			"type": "string"
		},
		{
			"key": "api_key_secret",
			"value": "sk_test_LA_TUA_SECRET_KEY",
			"type": "string"
		},
		{
			"key": "igfs_api_key",
			"value": "1234567890test",
			"type": "string"
		}
	],
	"item": [
		{
			"name": "Payment Flow",
			"item": [
				{
					"name": "1. Initiate Payment (PREAUTH)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key_test}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"amount\": 50.00,\n    \"email\": \"customer@example.com\",\n    \"description\": \"Order #12345\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/payment/initiate",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "initiate"]
						},
						"description": "Initiate payment and get checkoutUrl (PayGlobe branded page)"
					},
					"response": []
				},
				{
					"name": "2. Get Transaction Status",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key_test}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/payment/status/TXN_20251105_xxxxx",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "status", "TXN_20251105_xxxxx"]
						},
						"description": "Check transaction status"
					},
					"response": []
				},
				{
					"name": "3. Process Voucher Payment",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"transactionId\": \"TXN_20251105_xxxxx\",\n    \"otp\": \"123456\",\n    \"voucherAmount\": 30.00\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/payment/voucher/process",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "voucher", "process"]
						},
						"description": "Process voucher payment (called from voucher-choice page, NO API KEY needed)"
					},
					"response": []
				},
				{
					"name": "4. Finalize Without Vouchers",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"transactionId\": \"TXN_20251105_xxxxx\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/payment/finalize/no-voucher",
							"host": ["{{base_url}}"],
							"path": ["api", "payment", "finalize", "no-voucher"]
						},
						"description": "Finalize payment without vouchers (CAPTURE full amount, NO API KEY needed)"
					},
					"response": []
				}
			]
		},
		{
			"name": "Merchant Operations (Post-Payment)",
			"item": [
				{
					"name": "Refund Payment (Full)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key_secret}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"amount\": null,\n    \"reason\": \"Customer request\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/merchant/payment/refund/TXN_20251105_xxxxx",
							"host": ["{{base_url}}"],
							"path": ["api", "merchant", "payment", "refund", "TXN_20251105_xxxxx"]
						},
						"description": "Refund a completed payment (full refund when amount is null)\nWorks for both IGFS and Stripe gateways.\nRequires SECRET API key."
					},
					"response": []
				},
				{
					"name": "Refund Payment (Partial)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key_secret}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"amount\": 25.00,\n    \"reason\": \"Partial refund - item returned\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/merchant/payment/refund/TXN_20251105_xxxxx",
							"host": ["{{base_url}}"],
							"path": ["api", "merchant", "payment", "refund", "TXN_20251105_xxxxx"]
						},
						"description": "Partial refund of a completed payment\nWorks for both IGFS and Stripe gateways.\nRequires SECRET API key."
					},
					"response": []
				},
				{
					"name": "Capture Preauthorized Payment",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key_secret}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"amount\": 50.00\n}"
						},
						"url": {
							"raw": "{{base_url}}/api/merchant/payment/capture/TXN_20251105_xxxxx",
							"host": ["{{base_url}}"],
							"path": ["api", "merchant", "payment", "capture", "TXN_20251105_xxxxx"]
						},
						"description": "Manually capture a preauthorized payment\nWorks for both IGFS and Stripe gateways.\nRequires SECRET API key.\n\nUse this when you want to capture funds after preauthorization.\nIf amount is null, captures the full preauthorized amount."
					},
					"response": []
				},
				{
					"name": "Void Preauthorized Payment",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key_secret}}",
								"type": "text"
							}
						],
						"url": {
							"raw": "{{base_url}}/api/merchant/payment/void/TXN_20251105_xxxxx",
							"host": ["{{base_url}}"],
							"path": ["api", "merchant", "payment", "void", "TXN_20251105_xxxxx"]
						},
						"description": "Void/cancel a preauthorized payment (before capture)\nWorks for both IGFS and Stripe gateways.\nRequires SECRET API key.\n\nUse this to release the hold on customer's card without charging them.\nCannot be used after the payment has been captured - use refund instead."
					},
					"response": []
				}
			]
		},
		{
			"name": "Webhooks (Server-to-Server)",
			"item": [
				{
					"name": "IGFS Notify Webhook (with HMAC)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "X-Webhook-Signature",
								"value": "{{hmac_signature}}",
								"type": "text",
								"description": "HMAC-SHA256 signature of payload"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"transactionId\": \"TXN_20251105_xxxxx\",\n    \"paymentId\": \"PAY_12345\",\n    \"amount\": \"50.00\",\n    \"status\": \"SUCCESS\",\n    \"txRes\": {\n        \"tranId\": 123456789\n    }\n}"
						},
						"url": {
							"raw": "{{base_url}}/payment/notify/TXN_20251105_xxxxx",
							"host": ["{{base_url}}"],
							"path": ["payment", "notify", "TXN_20251105_xxxxx"]
						},
						"description": "IGFS webhook notification with HMAC signature verification\n\nSignature calculation:\n1. Payload = transactionId|paymentId|amount|status\n2. Signature = HMAC-SHA256(payload, igfsApiKey)\n3. Base64 encode\n\nExample:\npayload = \"TXN_20251105_xxxxx|PAY_12345|50.00|SUCCESS\"\nkey = \"1234567890test\"\nsignature = Base64(HMAC-SHA256(payload, key))"
					},
					"response": []
				}
			]
		},
		{
			"name": "Admin API Keys Management",
			"item": [
				{
					"name": "List All API Keys",
					"request": {
						"auth": {
							"type": "basic",
							"basic": [
								{
									"key": "username",
									"value": "admin",
									"type": "string"
								},
								{
									"key": "password",
									"value": "your_admin_password",
									"type": "string"
								}
							]
						},
						"method": "GET",
						"header": [],
						"url": {
							"raw": "{{base_url}}/admin/api-keys",
							"host": ["{{base_url}}"],
							"path": ["admin", "api-keys"]
						},
						"description": "List all merchant API keys (requires Basic Auth)"
					},
					"response": []
				},
				{
					"name": "Generate New API Key",
					"request": {
						"auth": {
							"type": "basic",
							"basic": [
								{
									"key": "username",
									"value": "admin",
									"type": "string"
								},
								{
									"key": "password",
									"value": "your_admin_password",
									"type": "string"
								}
							]
						},
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"merchantId\": \"merchant_acme_corp\",\n    \"merchantName\": \"ACME Corporation\",\n    \"environment\": \"TEST\",\n    \"webhookUrl\": \"https://merchant.com/api/webhook\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/admin/api-keys/generate",
							"host": ["{{base_url}}"],
							"path": ["admin", "api-keys", "generate"]
						},
						"description": "Generate new API keys for a merchant"
					},
					"response": []
				}
			]
		}
	]
}
