{
    "info": {
        "name": "Sela Pay API",
        "_postman_id": "sela-pay-2026-12-04",
        "description": "Sela Pay merchant API — release 2026-12-04. Generated by `php artisan sela:postman`; do not edit by hand.\nImport one of the two environment files (sandbox / live) and paste your access token.\nDocs: https://pay.selapay.ly/docs",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "auth": {
        "type": "bearer",
        "bearer": [
            {
                "key": "token",
                "value": "{{api_token}}",
                "type": "string"
            }
        ]
    },
    "variable": [
        {
            "key": "payment_id",
            "value": ""
        },
        {
            "key": "process_id",
            "value": ""
        },
        {
            "key": "embed_session",
            "value": ""
        }
    ],
    "item": [
        {
            "name": "Payments (API v2 — recommended)",
            "item": [
                {
                    "name": "Create payment",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            {
                                "key": "Idempotency-Key",
                                "value": "{{$guid}}"
                            }
                        ],
                        "url": "{{base_url}}/api/v2/payments",
                        "description": "Creates a payment request and returns the payment object. Send the customer to data.url.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"amount\": \"100.00\",\n    \"reference\": \"ORDER_{{$timestamp}}\",\n    \"description\": \"Order\",\n    \"return_url\": \"https://example.com/thanks\",\n    \"customer\": {\n        \"name\": \"Customer\",\n        \"email\": \"customer@example.com\",\n        \"phone\": \"0911111111\"\n    },\n    \"metadata\": {\n        \"cart_id\": 77\n    },\n    \"allowed_methods\": [\n        \"edfali\",\n        \"yasr-pay\"\n    ],\n    \"expires_in_minutes\": 30,\n    \"locale\": \"ar\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "var j = pm.response.json(); if (j.data && j.data.id) pm.collectionVariables.set('payment_id', j.data.id);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Read payment",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}/api/v2/payments/{{payment_id}}",
                        "description": "The source of truth for the payment status: open, paid, failed, expired, cancelled."
                    }
                },
                {
                    "name": "List payments",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}/api/v2/payments?status=open&per_page=20",
                        "description": "Filters: reference, status, page, per_page (max 100)."
                    }
                },
                {
                    "name": "Cancel payment",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}/api/v2/payments/{{payment_id}}/cancel",
                        "description": "Cancels an open payment. A non-open one returns 409 PAYMENT_NOT_OPEN."
                    }
                }
            ]
        },
        {
            "name": "Direct OTP payment (API v1)",
            "item": [
                {
                    "name": "Verify — send OTP",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}/api/v1/transaction/edfali/verify",
                        "description": "Sends the OTP to the customer and returns process_id.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"mobile_number\": \"{{test_mobile}}\",\n    \"amount\": \"25.00\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "var j = pm.response.json(); if (j.result && j.result.process_id) pm.collectionVariables.set('process_id', j.result.process_id);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Confirm — pay",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            {
                                "key": "Idempotency-Key",
                                "value": "{{$guid}}"
                            }
                        ],
                        "url": "{{base_url}}/api/v1/transaction/edfali/confirm",
                        "description": "Completes the payment with the OTP.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"process_id\": \"{{process_id}}\",\n    \"code\": \"1111\",\n    \"amount\": \"25.00\",\n    \"invoice_no\": \"INV_{{$timestamp}}\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                },
                {
                    "name": "Transaction status",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}/api/v1/transaction/{{payment_id}}",
                        "description": "Status of a transaction by id."
                    }
                }
            ]
        },
        {
            "name": "Hosted page (v1 routes)",
            "item": [
                {
                    "name": "Enabled methods",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}{{hosted_path}}/gateways",
                        "description": "Enabled payment methods with their canonical names (slug) and accepted_names."
                    }
                },
                {
                    "name": "Create payment (v1)",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            {
                                "key": "Idempotency-Key",
                                "value": "{{$guid}}"
                            }
                        ],
                        "url": "{{base_url}}{{hosted_path}}/payment/create",
                        "description": "Older create route; still supported.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"amount\": 100,\n    \"currency\": \"LYD\",\n    \"full_name\": \"Customer\",\n    \"email\": \"customer@example.com\",\n    \"return_url\": \"https://example.com/thanks\",\n    \"custom\": \"ORDER_{{$timestamp}}\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                },
                {
                    "name": "Payment status (v1)",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}{{hosted_path}}/payment/status/{{payment_id}}",
                        "description": "Status by transaction id."
                    }
                },
                {
                    "name": "Transactions",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}{{hosted_path}}/transactions",
                        "description": "List of transactions."
                    }
                },
                {
                    "name": "Payment links",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}{{hosted_path}}/payment-links",
                        "description": "List of payment links."
                    }
                },
                {
                    "name": "Create payment link",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}{{hosted_path}}/payment-links",
                        "description": "Creates a payment link.",
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"title\": \"Order\",\n    \"amount\": 50\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    }
                }
            ]
        },
        {
            "name": "Checkout window (publishable key)",
            "item": [
                {
                    "name": "Open session",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}/pay/embed/v1/session",
                        "description": "What sela.js calls from the browser. No access token: the publishable key identifies the merchant.",
                        "auth": {
                            "type": "noauth"
                        },
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"key\": \"{{publishable_key}}\",\n    \"amount\": \"25.00\",\n    \"ref\": \"ORDER_{{$timestamp}}\",\n    \"mode\": \"popup\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        }
                    },
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "var j = pm.response.json(); if (j.result && j.result.session) pm.collectionVariables.set('embed_session', j.result.session);"
                                ]
                            }
                        }
                    ]
                },
                {
                    "name": "Session status",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": "{{base_url}}/pay/embed/v1/session/{{embed_session}}",
                        "description": "Display-only status polled by sela.js.",
                        "auth": {
                            "type": "noauth"
                        }
                    }
                }
            ]
        }
    ]
}
