{"id":30460155,"url":"https://github.com/elian3x14/fastapi_vnpay_integration","last_synced_at":"2026-04-16T11:02:40.396Z","repository":{"id":280816729,"uuid":"943260446","full_name":"Elian3x14/fastAPI_VNPay_integration","owner":"Elian3x14","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-05T15:29:58.000Z","size":1489,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-21T16:04:13.575Z","etag":null,"topics":["fastapi","self-learning-project","vnpay"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Elian3x14.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-05T12:22:59.000Z","updated_at":"2025-03-09T14:23:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"6bd1dd68-ba9b-48d0-88e7-c7a56e1afc53","html_url":"https://github.com/Elian3x14/fastAPI_VNPay_integration","commit_stats":null,"previous_names":["limbanga/fastapi_vnpay_integration","elian3x14/fastapi_vnpay_integration"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Elian3x14/fastAPI_VNPay_integration","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elian3x14%2FfastAPI_VNPay_integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elian3x14%2FfastAPI_VNPay_integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elian3x14%2FfastAPI_VNPay_integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elian3x14%2FfastAPI_VNPay_integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Elian3x14","download_url":"https://codeload.github.com/Elian3x14/fastAPI_VNPay_integration/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Elian3x14%2FfastAPI_VNPay_integration/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271767430,"owners_count":24817581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","self-learning-project","vnpay"],"created_at":"2025-08-23T19:45:11.772Z","updated_at":"2026-04-16T11:02:40.351Z","avatar_url":"https://github.com/Elian3x14.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![banner](images/banner.png)\n\n# FastAPI VNPAY Integration\n\n## Description\nThis project integrates VNPAY with FastAPI to handle online payments.\n\n## Installation Guide\n1. Install Python 3.9+.\n2. Create a virtual environment:\n   ```sh\n   python -m venv venv\n   source venv/bin/activate  # On macOS/Linux\n   venv\\Scripts\\activate  # On Windows\n   ```\n3. Install required dependencies:\n   ```sh\n   pip install -r requirements.txt\n   ```\n4. Set up the `.env` file:\n   ```env\n   VNPAY_URL=\u003cVNPAY URL\u003e\n   VNPAY_TMN_CODE=\u003cTMN Code\u003e\n   VNPAY_HASH_SECRET=\u003cSecret Key\u003e\n   VNPAY_RETURN_URL=\u003cCallback URL\u003e\n   ```\n5. Run the application with FastAPI:\n   ```sh\n   uvicorn main:app --reload\n   ```\n\n## How to Create a VNPAY Account (Sandbox)\n\n**Access the VNPAY Sandbox Page**\n\n1. Register an account by providing your **email** and necessary details.\n2. After successful registration, you will receive the required credentials:\n   - **vnp_TmnCode**: Test merchant site code.\n   - **vnp_HashSecret**: Secret key for data encryption.\n   - **API Endpoint**: Test payment API endpoint.\n\n## API Endpoints\n- `GET /create_payment?amount=100000\u0026order_desc=Order Payment`\n- `GET /vnpay_return` - Receive transaction results from VNPAY\n\n## Workflow Diagram\n```mermaid\nsequenceDiagram\n    participant User\n    participant Website\n    participant VNPAY\n    \n    User-\u003e\u003eWebsite: 1. Request payment\n    Website-\u003e\u003eVNPAY: 2. Send transaction request\n    VNPAY--\u003e\u003eWebsite: 3. Return payment URL\n    Website-\u003e\u003eUser: 4. Redirect to VNPAY\n    User-\u003e\u003eVNPAY: 5. Enter payment details\n    VNPAY--\u003e\u003eWebsite: 6. Send transaction result\n    Website-\u003e\u003eUser: 7. Display transaction result\n```\n\n## Test Results\n\n**Request Payment**\n\n![create_payment_url_endpoint](images/previews/create_payment_url_endpoint.png)\n\n**Server redirects to VNPAY's payment URL**\n\n![VNPAY_payment_url](images/previews/VNPAY_payment_url.png)\n\n**Enter Card Information**\n\n[Link: Test Payment Account](https://sandbox.vnpayment.vn/apis/vnpay-demo/)\n\n![VNPAY_form](images/previews/VNPAY_form.png)\n\n**Payment Result**\n\n*Modify the logic to match your application needs*\n\n![vnpay_return_result](images/previews/vnpay_return_result.png)\n\n## Notes\nIf you encounter any issues, feel free to reach out for support!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felian3x14%2Ffastapi_vnpay_integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felian3x14%2Ffastapi_vnpay_integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felian3x14%2Ffastapi_vnpay_integration/lists"}