{
	"info": {
		"_postman_id": "f5e4b2d3-1a2b-3c4d-5e6f-7a8b9c0d1e2f",
		"name": "WithPay Platform API",
		"description": "API collection for integrating WithPay's checkout and payment verification system into your application.",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Initialize Checkout",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{api_key}}",
							"type": "string"
						}
					]
				},
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"amount\": 100.50,\r\n    \"currency\": \"ETB\",\r\n    \"description\": \"Support tip for creator\",\r\n    \"callback_url\": \"{{base_url}}/api/webhook\",\r\n    \"return_url\": \"{{base_url}}/payment/success\"\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/checkout",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"checkout"
					]
				},
				"description": "Initiates a new checkout session. Generates a unique transaction reference (`tx_ref`) and returns a payment `checkout_url` to redirect the user to."
			},
			"response": []
		},
		{
			"name": "Verify Transaction",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{api_key}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/verify?tx_ref={{tx_ref}}",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"verify"
					],
					"query": [
						{
							"key": "tx_ref",
							"value": "{{tx_ref}}",
							"description": "The WithPay transaction reference returned during checkout initialization."
						}
					]
				},
				"description": "Retrieves the status and metadata of a specific transaction using its unique `tx_ref`."
			},
			"response": []
		},
		{
			"name": "Payment Webhook Simulator",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Chapa-Signature",
						"value": "YOUR_GENERATED_HMAC_SIGNATURE",
						"type": "text",
						"description": "HMAC SHA256 of the payload using your webhook secret."
					},
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n  \"event\": \"charge.success\",\r\n  \"tx_ref\": \"wp-your-transaction-ref\",\r\n  \"reference\": \"chapa-internal-ref\",\r\n  \"amount\": 100.50,\r\n  \"currency\": \"ETB\",\r\n  \"email\": \"payer@example.com\",\r\n  \"first_name\": \"John\",\r\n  \"last_name\": \"Doe\",\r\n  \"status\": \"success\"\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{base_url}}/api/webhook",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"webhook"
					]
				},
				"description": "Simulates an incoming webhook from the payment gateway to automatically process and verify a successful payment."
			},
			"response": []
		},
		{
			"name": "Verify Event Ticket",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{api_key}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/events/verify/:reference",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"events",
						"verify",
						":reference"
					],
					"variable": [
						{
							"key": "reference",
							"value": "BK-63B6C4CF",
							"description": "The unique booking reference."
						}
					]
				},
				"description": "Verifies an event ticket booking using its unique reference."
			},
			"response": []
		},
		{
			"name": "Verify Wedding RSVP",
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{api_key}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"url": {
					"raw": "{{base_url}}/api/wedding/verify/:reference",
					"host": [
						"{{base_url}}"
					],
					"path": [
						"api",
						"wedding",
						"verify",
						":reference"
					],
					"variable": [
						{
							"key": "reference",
							"value": "WD-63B6C4CF",
							"description": "The unique wedding RSVP booking reference."
						}
					]
				},
				"description": "Verifies a wedding RSVP ticket booking using its unique reference."
			},
			"response": []
		}
	],
	"variable": [
		{
			"key": "base_url",
			"value": "http://localhost/github/withpay",
			"type": "string"
		},
		{
			"key": "api_key",
			"value": "tip_live_put_your_key_here",
			"type": "string"
		},
		{
			"key": "tx_ref",
			"value": "wp-put-your-tx-ref-here",
			"type": "string"
		}
	]
}
