### Example Usage of Sepay VN Webhook API in JavaScript Source: https://docs.sepay.vn/oauth2/api-webhooks Demonstrates the usage of the Sepay VN Webhook API functions. This example shows how to get webhooks, get webhook details, create a new webhook, update a webhook, and delete a webhook. It includes error handling for the overall process. ```javascript async function exampleUsage() { try { // Lấy danh sách webhooks const webhooks = await getWebhooks({active: 1}); console.log('Webhooks:', webhooks); // Lấy chi tiết webhook const webhookDetails = await getWebhookDetails(23); console.log('Webhook details:', webhookDetails); // Tạo webhook mới const newWebhook = await createWebhook({ bank_account_id: 19, name: 'Tích hợp với shop online', event_type: 'In_only', authen_type: 'Api_Key', webhook_url: 'https://example.com/webhook/payment', is_verify_payment: 1, skip_if_no_code: 1, active: 1, api_key: 'a7c3b4e5f6a7b8c9d0e1f2a3b4c5d6e7', request_content_type: 'Json' }); console.log('New webhook created:', newWebhook); // Cập nhật webhook const updateResult = await updateWebhook(23, { active: 0 }); console.log('Update result:', updateResult); // Xóa webhook const deleteResult = await deleteWebhook(23); console.log('Delete result:', deleteResult); } catch (error) { console.error('Example usage error:', error); } } exampleUsage(); ``` -------------------------------- ### Sepay.vn Webhook API Operations (cURL) Source: https://docs.sepay.vn/oauth2/api-webhooks This collection of cURL commands demonstrates common operations for interacting with the Sepay.vn Webhook API. It includes examples for retrieving a list of webhooks, getting details of a specific webhook, creating a new webhook, updating an existing webhook, and deleting a webhook. ```bash # Lấy danh sách webhooks curl -X GET "https://my.sepay.vn/api/v1/webhooks" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" # Lấy chi tiết webhook curl -X GET "https://my.sepay.vn/api/v1/webhooks/23" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" # Tạo webhook mới curl -X POST "https://my.sepay.vn/api/v1/webhooks" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "bank_account_id": 19, "name": "Tích hợp với shop online", "event_type": "In_only", "authen_type": "Api_Key", "webhook_url": "https://example.com/webhook/payment", "is_verify_payment": 1, "skip_if_no_code": 1, "active": 1, "api_key": "a7c3b4e5f6a7b8c9d0e1f2a3b4c5d6e7", "request_content_type": "Json" }' # Cập nhật webhook curl -X PUT "https://my.sepay.vn/api/v1/webhooks/23" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "active": 0 }' ``` -------------------------------- ### Webhook Payment Notification Example - JSON Source: https://docs.sepay.vn/api-va-theo-don-hang-bidv Example JSON payload received when a customer successfully pays into a VA. The 'code' field contains the order code for identification. ```JSON { "id": 92704, "gateway": "BIDV", "transactionDate": "2024-01-07 14:02:37", "code": "ORD123456789", // Mã đơn hàng của VA "transferAmount": 2277000, // Số tiền giao dịch "transferType": "in", // Loại giao dịch (in: tiền vào) ... } ``` -------------------------------- ### Get Bank Account List - HTTP Request Source: https://docs.sepay.vn/oauth2/api-tai-khoan-ngan-hang This snippet shows how to make an HTTP GET request to the `/api/v1/bank-accounts` endpoint to retrieve a list of all bank accounts associated with your company. It requires an `Authorization` header with a Bearer token. Query parameters `page` and `limit` can be used for pagination. ```http GET /api/v1/bank-accounts Authorization: Bearer {YOUR_ACCESS_TOKEN} ``` -------------------------------- ### Get Bank Account Details - HTTP Request Source: https://docs.sepay.vn/oauth2/api-tai-khoan-ngan-hang This snippet demonstrates how to fetch detailed information for a specific bank account using its ID. An HTTP GET request is made to `/api/v1/bank-accounts/{id}`. The `{id}` should be replaced with the actual bank account ID. An `Authorization` header with a Bearer token is mandatory. ```http GET /api/v1/bank-accounts/19 Authorization: Bearer {YOUR_ACCESS_TOKEN} ``` -------------------------------- ### Get Order Details API - HTTP Source: https://docs.sepay.vn/api-va-theo-don-hang-bidv Retrieves detailed information about a specific order using its ID. Requires an authentication token. ```HTTP GET /orders/{order_id} GET https://my.sepay.vn/userapi/bidv/123456/orders/b64247d3-c343-11ef-9c27-52c7e9b4f41b Authorization: Bearer {token} HTTP/1.1 200 OK Content-Type: application/json { "status": "success", "data": { "id": "b64247d3-c343-11ef-9c27-52c7e9b4f41b", "order_code": "ORD123456789", "amount": 2000, "paid_amount": 2000, "status": "Paid", "created_at": "2024-12-26 11:41:46", "bank_name": "BIDV", "account_number": "1234567890", "account_holder_name": "NGO QUOC DAT", "va": [ { "va_number": "963NQDORDRSIKYXYPTZ", "va_holder_name": "NGO QUOC DAT", "amount": 2000, "status": "Paid", "expired_at": "2024-12-26 11:51:45", "paid_at": "2024-12-26 11:42:12" } ] } } ``` -------------------------------- ### Making SePay API Requests with PHP Source: https://docs.sepay.vn/oauth2/access-token Provides a PHP example using cURL to fetch bank account data from the SePay API. It shows how to set the 'Authorization: Bearer' header and handle the response, including checking the HTTP status code. ```php ``` -------------------------------- ### Making SePay API Requests with JavaScript Fetch API Source: https://docs.sepay.vn/oauth2/access-token Shows a JavaScript example using the Fetch API to retrieve bank account data from SePay. It includes setting the 'Authorization: Bearer' header and basic error handling for network requests. ```javascript async function getBankAccounts() { try { const response = await fetch('https://my.sepay.vn/api/v1/bank-accounts', { method: 'GET', headers: { 'Authorization': `Bearer ${accessToken}` } }); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const data = await response.json(); console.log(data); } catch (error) { console.error('Error:', error.message); } } getBankAccounts(); ``` -------------------------------- ### Retry-After Header Example Source: https://docs.sepay.vn/gioi-thieu-api Example of the 'x-sepay-userapi-retry-after' header returned when an API request exceeds the allowed rate limit. This header indicates the number of seconds to wait before sending the next request. ```text x-sepay-userapi-retry-after: 1 ``` -------------------------------- ### GET /api/v1/webhooks Source: https://docs.sepay.vn/oauth2/api-webhooks Retrieves a list of your company's webhooks. Supports filtering by webhook URL, API key, active status, and pagination. ```APIDOC ## GET /api/v1/webhooks ### Description Retrieves a list of your company's webhooks. You can filter the results by various criteria. ### Method GET ### Endpoint `/api/v1/webhooks` ### Parameters #### Query Parameters - **webhook_url** (string) - Optional - Filter by webhook URL (partial search) - **api_key** (string) - Optional - Filter by API key - **active** (integer) - Optional - Filter by active status (0: inactive, 1: active) - **page** (integer) - Optional - Page number, starting from 1 - **limit** (integer) - Optional - Number of results per page ### Request Example ```APIDOC GET /api/v1/webhooks?active=1 Authorization: Bearer {YOUR_ACCESS_TOKEN} ``` ### Response #### Success Response (200) - **status** (string) - The status of the response ('success' or 'error'). - **data** (array) - An array of webhook objects. - **id** (integer) - The unique identifier for the webhook. - **bank_account_id** (integer) - The ID of the associated bank account. - **name** (string) - The name of the webhook. - **event_type** (string) - The type of event that triggers the webhook. - **authen_type** (string) - The authentication type used for the webhook. - **webhook_url** (string) - The URL where the webhook notifications will be sent. - **is_verify_payment** (boolean) - Whether payment verification is enabled. - **skip_if_no_code** (boolean) - Whether to skip if no code is provided. - **retry_conditions** (object) - Conditions for retrying webhook delivery. - **only_va** (boolean) - Whether the webhook is only for VA transactions. - **active** (boolean) - Whether the webhook is active. - **created_at** (string) - The timestamp when the webhook was created. - **api_key** (string, optional) - The API key for authentication if `authen_type` is 'Api_Key'. - **request_content_type** (string) - The content type of the request. - **bank_sub_account_ids** (array, optional) - List of bank sub-account IDs. - **oauth2_client_id** (string, optional) - OAuth2 client ID if `authen_type` is 'OAuth2.0'. - **oauth2_client_secret** (string, optional) - OAuth2 client secret if `authen_type` is 'OAuth2.0'. - **oauth2_access_token_url** (string, optional) - OAuth2 access token URL if `authen_type` is 'OAuth2.0'. - **meta** (object) - Metadata about the response, including pagination information. #### Response Example ```json { "status": "success", "data": [ { "id": 23, "bank_account_id": 19, "name": "Tích hợp với shop online", "event_type": "In_only", "authen_type": "Api_Key", "webhook_url": "https://example.com/webhook/payment", "is_verify_payment": true, "skip_if_no_code": true, "retry_conditions": { "non_2xx_status_code": 0 }, "only_va": true, "active": true, "created_at": "2025-02-15 14:23:56", "api_key": "a7c3b4e5f6a7b8c9d0e1f2a3b4c5d6e7", "request_content_type": "Json", "bank_sub_account_ids": [25, 26] }, { "id": 22, "bank_account_id": 18, "name": "Tích hợp với CRM", "event_type": "All", "authen_type": "OAuth2.0", "webhook_url": "https://crm.example.com/webhook/transactions", "is_verify_payment": false, "skip_if_no_code": false, "retry_conditions": { "non_2xx_status_code": 0 }, "only_va": false, "active": true, "created_at": "2025-02-10 09:45:32", "oauth2_client_id": "client_id_example", "oauth2_client_secret": "client_secret_example", "oauth2_access_token_url": "https://crm.example.com/oauth/token" } ], "meta": { "pagination": { "total": 5, "per_page": 20, "current_page": 1, "last_page": 1 } } } ``` ``` -------------------------------- ### GET /api/v1/me Source: https://docs.sepay.vn/oauth2/api-nguoi-dung Retrieves the authenticated user's information. This endpoint requires the 'profile' scope. ```APIDOC ## GET /api/v1/me ### Description This endpoint returns the information of the current user authenticated via OAuth2. Requires the `profile` scope. ### Method GET ### Endpoint /api/v1/me ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` GET /api/v1/me Authorization: Bearer {YOUR_ACCESS_TOKEN} ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the response, e.g., "success". - **data** (object) - Contains the user's information. - **id** (integer) - The user's unique identifier. - **first_name** (string) - The user's first name. - **last_name** (string) - The user's last name. - **email** (string) - The user's email address. - **phone** (string) - The user's phone number. - **avatar** (string) - URL of the user's avatar from Gravatar. #### Response Example ```json { "status": "success", "data": { "id": 1234, "first_name": "Nguyễn", "last_name": "Văn A", "email": "nguyen.van.a@example.com", "phone": "0901234567", "avatar": "https://www.gravatar.com/avatar/0bc83cb571cd1c50ba6f3e8a78ef1346" } } ``` #### Error Handling - **401 Unauthorized**: Invalid or expired token. - **403 Forbidden**: Insufficient permissions to access the resource. ``` -------------------------------- ### Making SePay API Requests with Laravel HTTP Client Source: https://docs.sepay.vn/oauth2/access-token Illustrates how to use Laravel's `Http` facade to make a GET request to the SePay API, including bearer token authentication. It demonstrates checking if the request was successful and handling responses. ```php use Illuminate\Support\Facades\Http; $response = Http::withToken('ACCESS_TOKEN')->get('https://my.sepay.vn/api/v1/bank-accounts'); if ($response->ok()) { $data = $response->json(); dd($data); } else { dd($response->status(), $response->body()); } ``` -------------------------------- ### Get List of Webhooks (HTTP) Source: https://docs.sepay.vn/oauth2/api-webhooks Retrieves a list of webhooks for your company with filtering options. Requires 'webhook:read' scope and user permission to view webhooks. Supports filtering by webhook URL, API key, and active status, with pagination. ```http GET /api/v1/webhooks?active=1 Authorization: Bearer {YOUR_ACCESS_TOKEN} ``` -------------------------------- ### Get Webhook Details (HTTP) Source: https://docs.sepay.vn/oauth2/api-webhooks Fetches detailed information about a specific webhook using its ID. Requires 'webhook:read' scope and user permission to view webhooks. The webhook ID is provided as a path parameter. ```http GET /api/v1/webhooks/23 Authorization: Bearer {YOUR_ACCESS_TOKEN} ``` -------------------------------- ### Retrieve Company Information using cURL Source: https://docs.sepay.vn/oauth2/api-cong-ty This cURL command demonstrates how to retrieve company information from the Sepay.vn API. It uses the GET method and requires an authorization token. Ensure you replace 'YOUR_ACCESS_TOKEN' with your actual API key. ```bash # Lấy thông tin công ty curl -X GET "https://my.sepay.vn/api/v1/company" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" ``` -------------------------------- ### GET /api/v1/company Source: https://docs.sepay.vn/oauth2/api-cong-ty Retrieves the current company's information and related configurations. This endpoint is accessible to users with Admin or SuperAdmin roles and requires the 'company' scope. ```APIDOC ## GET /api/v1/company ### Description Retrieves the current company's information and related configurations. ### Method GET ### Endpoint /api/v1/company ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` GET /api/v1/company Authorization: Bearer {YOUR_ACCESS_TOKEN} ``` ### Response #### Success Response (200) - **id** (integer) - ID of the company - **full_name** (string) - Full name of the company - **short_name** (string) - Short name of the company - **role** (string) - Role of the user within the company - **status** (string) - Status of the company (e.g., active, inactive) - **subscription** (string) - Company's subscription plan - **begin_date** (string) - Subscription start date - **end_date** (string) - Subscription end date - **configurations** (object) - Company configurations - **bank_sub_account** (boolean) - Bank sub-account configuration - **paycode** (boolean) - Payment code feature toggle - **data_storage_time** (string) - Data storage time in days - **payment_code_formats** (array) - List of payment code formats - **prefix** (string) - Prefix of the payment code - **suffix_from** (integer) - Minimum length of the suffix - **suffix_to** (integer) - Maximum length of the suffix - **character_type** (string) - Type of characters allowed in the suffix (NumberOnly, NumberAndLetter) - **is_active** (boolean) - Whether this format is active #### Response Example ```json { "status": "success", "data": { "id": 123, "full_name": "Công ty TNHH Một Thành Viên ABC", "short_name": "ABC Corp", "role": "Admin", "status": "active", "subscription": "Premium", "begin_date": "2023-01-01", "end_date": "2023-12-31", "configurations": { "bank_sub_account": true, "paycode": true, "data_storage_time": "90", "payment_code_formats": [ { "prefix": "DH", "suffix_from": 6, "suffix_to": 8, "character_type": "NumberOnly", "is_active": true }, { "prefix": "HD", "suffix_from": 4, "suffix_to": 6, "character_type": "NumberAndLetter", "is_active": true } ] } } } ``` ``` -------------------------------- ### Sepay.vn API Successful Response Example Source: https://docs.sepay.vn/oauth2/api-cong-ty This JSON object represents a successful response from the Sepay.vn API. It indicates the status of the operation and contains detailed data regarding payment code formats and configuration. This response is typically returned after a successful API request. ```json { "status": "success", "data": { "status": true, "data": { "bank_sub_account": true, "paycode": true, "data_storage_time": "90", "payment_code_formats": [ { "prefix": "DH", "suffix_from": 6, "suffix_to": 8, "character_type": "NumberOnly", "is_active": true }, { "prefix": "HD", "suffix_from": 4, "suffix_to": 6, "character_type": "NumberAndLetter", "is_active": true } ] } } } ``` -------------------------------- ### Create Additional VA API - HTTP Source: https://docs.sepay.vn/api-va-theo-don-hang-bidv Creates a new Virtual Account (VA) for an existing order. Supports specifying amount, holder name, and duration. Requires an authentication token and JSON payload. ```HTTP POST /orders/{order_id}/va POST https://my.sepay.vn/userapi/bidv/123456/orders/b64247d3-c343-11ef-9c27-52c7e9b4f41b/va Authorization: Bearer {token} Content-Type: application/json { "amount": 100000, "va_holder_name": "NGO QUOC DAT", "duration": 300 } HTTP/1.1 200 OK Content-Type: application/json { "status": "success", "message": "VA created successfully", "data": { "va_number": "963NQDORD8DTYFPW5MV", "va_holder_name": "NGO QUOC DAT", "amount": 2000, "status": "Unpaid", "expired_at": "2024-12-26 11:55:55" } } ``` -------------------------------- ### Create Sepay.vn Webhook (JSON) Source: https://docs.sepay.vn/oauth2/api-webhooks This snippet demonstrates how to create a new webhook using the Sepay.vn API. It requires various parameters such as bank account ID, name, event type, authentication type, webhook URL, and payment verification status. Additional parameters depend on the chosen authentication type and payment scenarios. ```json { "bank_account_id": 19, "name": "Tích hợp với shop online", "event_type": "In_only", "authen_type": "Api_Key", "webhook_url": "https://example.com/webhook/payment", "is_verify_payment": 1, "skip_if_no_code": 1, "active": 1, "only_va": 1, "bank_sub_account_ids": [25, 26], "retry_conditions": { "non_2xx_status_code": 1 }, "api_key": "a7c3b4e5f6a7b8c9d0e1f2a3b4c5d6e7", "request_content_type": "Json" } ``` -------------------------------- ### Get Sub-Accounts List - HTTP Request Source: https://docs.sepay.vn/oauth2/api-tai-khoan-ngan-hang This snippet illustrates how to retrieve a list of sub-accounts linked to a specific bank account. The request is an HTTP GET to `/api/v1/bank-accounts/{id}/sub-accounts`, where `{id}` is the parent bank account's ID. Pagination parameters `page` and `limit` are supported. An `Authorization` header with a Bearer token is required. ```http GET /api/v1/bank-accounts/19/sub-accounts Authorization: Bearer {YOUR_ACCESS_TOKEN} ``` -------------------------------- ### Create Webhook Source: https://docs.sepay.vn/oauth2/api-webhooks Creates a new webhook to receive event notifications. This endpoint requires detailed configuration including authentication and event types. ```APIDOC ## POST /api/v1/webhooks ### Description Creates a new webhook to receive event notifications. This endpoint requires detailed configuration including authentication and event types. ### Method POST ### Endpoint /api/v1/webhooks ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **bank_account_id** (integer) - Required - ID of the bank account. - **name** (string) - Required - Name of the webhook. - **event_type** (string) - Required - Type of event (`All`, `In_only`, `Out_only`). - **authen_type** (string) - Required - Authentication type (`No_Authen`, `OAuth2.0`, `Api_Key`). - **webhook_url** (string) - Required - URL to receive webhooks. - **is_verify_payment** (integer) - Required - Whether to verify payment (0: no, 1: yes). - **skip_if_no_code** (integer) - Optional - Skip if no payment code (0: no, 1: yes). - **active** (integer) - Optional - Activity status (0: inactive, 1: active). - **retry_conditions** (array) - Optional - Retry conditions upon error. - **only_va** (integer) - Optional - Only receive transactions from virtual accounts (0: no, 1: yes). - **bank_sub_account_ids** (array) - Required if `only_va` is 1 - List of virtual account IDs. - **oauth2_access_token_url** (string) - Required if `authen_type` is `OAuth2.0` - URL to get access token. - **oauth2_client_id** (string) - Required if `authen_type` is `OAuth2.0` - Client ID. - **oauth2_client_secret** (string) - Required if `authen_type` is `OAuth2.0` - Client Secret. - **api_key** (string) - Required if `authen_type` is `Api_Key` - API Key. - **request_content_type** (string) - Required if `authen_type` is `Api_Key` or `No_Authen` - Request content type (`Json`, `multipart_form-data`). ### Request Example ```json { "bank_account_id": 19, "name": "Tich hop voi shop online", "event_type": "In_only", "authen_type": "Api_Key", "webhook_url": "https://example.com/webhook/payment", "is_verify_payment": 1, "skip_if_no_code": 1, "active": 1, "only_va": 1, "bank_sub_account_ids": [25, 26], "retry_conditions": { "non_2xx_status_code": 1 }, "api_key": "a7c3b4e5f6a7b8c9d0e1f2a3b4c5d6e7", "request_content_type": "Json" } ``` ### Response #### Success Response (200) - **message** (string) - Success message. - **id** (integer) - ID of the created webhook. #### Response Example ```json { "message": "Them WebHooks thanh cong", "id": 23 } ``` ``` -------------------------------- ### Count Transactions Source: https://docs.sepay.vn/api-giao-dich Get the total number of transactions recorded. ```APIDOC ## GET /userapi/transactions/count ### Description Retrieves the total count of all transactions. ### Method GET ### Endpoint `https://my.sepay.vn/userapi/transactions/count` ### Parameters None ### Request Example ``` GET https://my.sepay.vn/userapi/transactions/count ``` ### Response #### Success Response (200) - **count** (integer) - The total number of transactions. #### Response Example ```json { "status": 200, "error": null, "messages": { "success": true }, "count": 15000 } ``` ``` -------------------------------- ### Lọc giao dịch Sepay VN API với JavaScript Source: https://docs.sepay.vn/oauth2/api-giao-dich Ví dụ mã JavaScript sử dụng `async/await` và `fetch` API để tương tác với Sepay VN API. Mã này cho phép lấy danh sách giao dịch với các bộ lọc khác nhau, bao gồm ID tài khoản ngân hàng, khoảng thời gian và số tiền vào. Hàm `getTransactions` xử lý việc tạo query string và gọi API, với cơ chế xử lý lỗi cơ bản. ```javascript const accessToken = 'YOUR_ACCESS_TOKEN'; const baseUrl = 'https://my.sepay.vn/api/v1/transactions'; // Hàm lấy danh sách giao dịch với các tham số lọc async function getTransactions(filters = {}) { try { // Tạo query string từ các tham số lọc const queryParams = new URLSearchParams(); for (const [key, value] of Object.entries(filters)) { if (value !== undefined && value !== null) { queryParams.append(key, value); } } // Tạo URL với query string const url = queryParams.toString() ? `${baseUrl}?${queryParams.toString()}` : baseUrl; // Gọi API const response = await fetch(url, { headers: { 'Authorization': `Bearer ${accessToken}` } }); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const data = await response.json(); return data; } catch (error) { console.error('Error fetching transactions:', error.message); throw error; } } // Sử dụng với các bộ lọc khác nhau async function fetchTransactionsExamples() { try { // Tất cả giao dịch const allTransactions = await getTransactions(); console.log('All transactions:', allTransactions); // Giao dịch của một tài khoản ngân hàng cụ thể const bankAccountTransactions = await getTransactions({ bank_account_id: 19 }); console.log('Bank account transactions:', bankAccountTransactions); // Giao dịch trong một khoảng thời gian const dateRangeTransactions = await getTransactions({ from_date: '2025-02-01', to_date: '2025-02-28' }); console.log('Date range transactions:', dateRangeTransactions); // Giao dịch với số tiền vào cụ thể const amountInTransactions = await getTransactions({ amount_in: 18067000 }); console.log('Amount in transactions:', amountInTransactions); } catch (error) { console.error('Failed to fetch examples:', error); } } fetchTransactionsExamples(); ``` -------------------------------- ### GET /api/v1/bank-accounts Source: https://docs.sepay.vn/oauth2/api-tai-khoan-ngan-hang Retrieves a list of all bank accounts associated with your company. ```APIDOC ## GET /api/v1/bank-accounts ### Description This endpoint returns a list of bank accounts belonging to your company. ### Method GET ### Endpoint /api/v1/bank-accounts #### Query Parameters - **page** (integer) - Optional - The page number, starting from 1. - **limit** (integer) - Optional - The number of results per page. ### Request Example ``` GET /api/v1/bank-accounts Authorization: Bearer {YOUR_ACCESS_TOKEN} ``` ### Response #### Success Response (200) - **status** (string) - Indicates the status of the response ('success' or 'error'). - **data** (array) - An array of bank account objects. - **id** (integer) - The unique identifier for the bank account. - **label** (string) - A custom label for the bank account (can be null). - **account_holder_name** (string) - The name of the account holder. - **account_number** (string) - The bank account number. - **accumulated** (float) - The accumulated balance of the account. - **active** (boolean) - Indicates if the account is active. - **created_at** (string) - The timestamp when the account was created. - **bank** (object) - An object containing details about the bank. - **short_name** (string) - The short name of the bank. - **full_name** (string) - The full name of the bank. - **code** (string) - The bank code. - **bin** (string) - The bank identification number. - **icon_url** (string) - URL for the bank's icon. - **logo_url** (string) - URL for the bank's logo. - **meta** (object) - Metadata for pagination. - **pagination** (object) - **total** (integer) - The total number of bank accounts. - **per_page** (integer) - The number of results per page. - **current_page** (integer) - The current page number. - **last_page** (integer) - The last page number. #### Response Example ```json { "status": "success", "data": [ { "id": 19, "label": "Cty Demo", "account_holder_name": "CONG TY TNHH DEMO", "account_number": "0071000888888", "accumulated": 1777283273.00, "active": true, "created_at": "2025-02-12 21:09:49", "bank": { "short_name": "Vietcombank", "full_name": "Ngân hàng TMCP Ngoại Thương Việt Nam", "code": "VCB", "bin": "970436", "icon_url": "https://my.sepay.vn/assets/images/banklogo/vietcombank-icon.png", "logo_url": "https://my.sepay.vn/assets/images/banklogo/vietcombank.png" } }, { "id": 18, "label": null, "account_holder_name": "NGUYEN VAN A", "account_number": "0071000899999", "accumulated": 2625076186.00, "active": true, "created_at": "2025-02-12 20:05:47", "bank": { "short_name": "Vietcombank", "full_name": "Ngân hàng TMCP Ngoại Thương Việt Nam", "code": "VCB", "bin": "970436", "icon_url": "https://my.sepay.vn/assets/images/banklogo/vietcombank-icon.png", "logo_url": "https://my.sepay.vn/assets/images/banklogo/vietcombank.png" } } ], "meta": { "pagination": { "total": 2, "per_page": 20, "current_page": 1, "last_page": 1 } } } ``` ``` -------------------------------- ### GET /api/v1/webhooks/{id} Source: https://docs.sepay.vn/oauth2/api-webhooks Retrieves detailed information about a specific webhook using its ID. ```APIDOC ## GET /api/v1/webhooks/{id} ### Description Retrieves detailed information for a specific webhook based on its ID. ### Method GET ### Endpoint `/api/v1/webhooks/{id}` ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the webhook. ### Request Example ```APIDOC GET /api/v1/webhooks/23 Authorization: Bearer {YOUR_ACCESS_TOKEN} ``` ### Response #### Success Response (200) - **status** (string) - The status of the response ('success' or 'error'). - **data** (object) - The webhook object containing detailed information. - **id** (integer) - The unique identifier for the webhook. - **bank_account_id** (integer) - The ID of the associated bank account. - **name** (string) - The name of the webhook. - **event_type** (string) - The type of event that triggers the webhook. - **authen_type** (string) - The authentication type used for the webhook. - **webhook_url** (string) - The URL where the webhook notifications will be sent. - **is_verify_payment** (boolean) - Whether payment verification is enabled. - **skip_if_no_code** (boolean) - Whether to skip if no code is provided. - **retry_conditions** (object) - Conditions for retrying webhook delivery. - **only_va** (boolean) - Whether the webhook is only for VA transactions. - **active** (boolean) - Whether the webhook is active. - **created_at** (string) - The timestamp when the webhook was created. - **api_key** (string, optional) - The API key for authentication if `authen_type` is 'Api_Key'. - **request_content_type** (string) - The content type of the request. - **bank_sub_account_ids** (array, optional) - List of bank sub-account IDs. - **oauth2_client_id** (string, optional) - OAuth2 client ID if `authen_type` is 'OAuth2.0'. - **oauth2_client_secret** (string, optional) - OAuth2 client secret if `authen_type` is 'OAuth2.0'. - **oauth2_access_token_url** (string, optional) - OAuth2 access token URL if `authen_type` is 'OAuth2.0'. #### Response Example ```json { "status": "success", "data": { "id": 23, "bank_account_id": 19, "name": "Tích hợp với shop online", "event_type": "In_only", "authen_type": "Api_Key", "webhook_url": "https://example.com/webhook/payment", "is_verify_payment": true, "skip_if_no_code": true, "retry_conditions": { "non_2xx_status_code": 0 }, "only_va": true, "active": true, "created_at": "2025-02-15 14:23:56", "api_key": "a7c3b4e5f6a7b8c9d0e1f2a3b4c5d6e7", "request_content_type": "Json", "bank_sub_account_ids": [25, 26] } } ``` ``` -------------------------------- ### POST /userapi/bidv/{id}/orders Source: https://docs.sepay.vn/api-va-theo-don-hang-bidv Create an order with unlimited payment amount and duration by setting 'amount' and 'duration' to null. ```APIDOC ## POST /userapi/bidv/{id}/orders ### Description Allows creation of orders with unlimited payment amount and duration. To achieve this, set the `amount` field to `null` for unlimited payment attempts and the `duration` field to `null` for unlimited payment time. ### Method POST ### Endpoint `/userapi/bidv/{id}/orders` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier for the BIDV account. #### Query Parameters None #### Request Body - **amount** (number | null) - Required - The order amount. Set to `null` for unlimited amount. - **duration** (number | null) - Required - The payment duration in minutes. Set to `null` for unlimited duration. ### Request Example ```json { "amount": null, "duration": null } ``` ### Response #### Success Response (200) This endpoint does not explicitly define a success response body structure in the provided text, but a successful creation would typically return order details or a confirmation. #### Response Example (No example provided in the source text) ``` -------------------------------- ### GET /userapi/bankaccounts/details/{bankAccountId} Source: https://context7.com/context7/sepay_vn/llms.txt Retrieves detailed information for a specific bank account using its ID. ```APIDOC ## GET /userapi/bankaccounts/details/{bankAccountId} ### Description Retrieves detailed information for a specific bank account. ### Method GET ### Endpoint https://my.sepay.vn/userapi/bankaccounts/details/{bankAccountId} ### Parameters #### Path Parameters - **bankAccountId** (integer) - Required - The unique identifier of the bank account whose details are to be retrieved. ### Request Example ```bash curl -X GET "https://my.sepay.vn/userapi/bankaccounts/details/18" \ -H "Authorization: Bearer YOUR_API_TOKEN" ``` ### Response #### Success Response (200) - **bankaccount** (object) - An object containing the details of the bank account. - **id** (integer) - The unique identifier for the bank account. - **bank_short_name** (string) - The short name of the bank. - **account_number** (string) - The bank account number. - **accumulated** (integer) - The current accumulated balance of the account in VND. - **account_holder_name** (string) - The name of the account holder. - **last_transaction** (string) - The timestamp of the last transaction. #### Response Example ```json { "bankaccount": { "id": 18, "bank_short_name": "VCB", "account_number": "0987654321", "accumulated": 500000, "account_holder_name": "Jane Doe", "last_transaction": "2023-10-26T15:30:00Z" } } ``` ``` -------------------------------- ### Tạo đơn hàng không giới hạn số tiền và thời gian (API) Source: https://docs.sepay.vn/api-va-theo-don-hang-bidv Ví dụ yêu cầu API POST để tạo đơn hàng với số tiền và thời gian thanh toán không giới hạn. Bằng cách đặt 'amount' và 'duration' thành 'null', đơn hàng sẽ không có giới hạn về số lần thanh toán hoặc thời gian thanh toán. Yêu cầu này cần có tiêu đề Authorization và Content-Type. ```HTTP POST https://my.sepay.vn/userapi/bidv/123456/orders Authorization: Bearer {token} Content-Type: application/json { "amount": null, "duration": null } ```