{"repo":"fdhhhdjd/Class-Payment-Paypal","free":true,"listed":false,"github":"https://github.com/fdhhhdjd/Class-Payment-Paypal","clone":"git clone https://github.com/fdhhhdjd/Class-Payment-Paypal.git","description":"💵 This is an international payment learn for class","language":"JavaScript","stars":12,"topics":["css","html","js","nodejs","paypal"],"license":null,"category":"auth-billing-email","readme_excerpt":"PayPal Checkout — Demo (Express + Frontend) README hướng dẫn chạy project, sơ đồ hoạt động, giải thích ngắn gọn và mô tả các API. --- Mục lục 1. Run source (chạy project) 2. Sơ đồ hoạt động (FE — BE — PayPal) 3. Giải thích ngắn gọn 4. Các API — mô tả & hướng dẫn chạy (Postman / curl) 5. Webhook (ngrok) — cách cấu hình 6. Mẹo debug & logs --- 1) Run source Yêu cầu: Node.js ( = 16), npm. 1. Clone / copy project vào thư mục paypal-demo . 2. Tạo file .env ở root với nội dung (đặt giá trị thực từ PayPal Sandbox): 3. Cài dependencies: 4. Chạy server (local): 5. Mở frontend (nếu bạn có folder public/ ): http://localhost:3000 --- 2) Sơ đồ hoạt động (FE — BE — PayPal) --- 3) Giải thích ngắn gọn FE (frontend) : tải PayPal JS SDK (client-id từ /config ), tạo order bằng gọi /create-order , hiển thị PayPal button, và khi user approve thì gọi /capture-order/:orderID để backend thực hiện capture và lưu. BE (backend) : có endpoints tạo order, capture order, đọc order từ PayPal API, list orders đã lưu, và webhook receiver. PayPal : xử lý thanh toán, trả về orderId và capture result. Webhook là cách payPal thông báo server khi có event theo đăng ký. --- 4) Các API — mô tả & ví dụ Giả sử server chạy http://localhost:3000 . 1. GET /health Mục đích: kiểm tra server đang chạy. Ví dụ: GET http://localhost:3000/health Response: { \"ok\": true, \"time\": \"...\" } 2. GET /config Trả về clientId (PayPal Sandbox client id) và mode. Dùng FE để load SDK. 3. POST /create-order Body (JSON): { \"value\": \"10.00\", \"","default_branch":null,"files":null,"tree":[],"storefront":"/r/fdhhhdjd","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/fdhhhdjd/Class-Payment-Paypal/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}