### List Installment Plans - Node.js Example Source: https://developers.paymongo.com/reference/card-installment-plans Example of how to fetch card installment plans using Node.js with the 'axios' library. This code sends a GET request to the PayMongo API and logs the response data. ```javascript const axios = require('axios'); const options = { method: 'GET', url: 'https://api.paymongo.com/v1/card_installment_plans', headers: { accept: 'application/json' } }; axios .request(options) .then(function (response) { console.log(response.data); }) .catch(function (error) { console.error(error); }); ``` -------------------------------- ### List Installment Plans - Ruby Example Source: https://developers.paymongo.com/reference/card-installment-plans This Ruby code snippet demonstrates how to list card installment plans using the PayMongo API via an HTTP GET request. It utilizes the 'net/http' library. ```ruby require 'uri' require 'net/http' url = URI("https://api.paymongo.com/v1/card_installment_plans") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request['accept'] = 'application/json' response = http.request(request) puts response.read_body ``` -------------------------------- ### List Installment Plans - PHP Example Source: https://developers.paymongo.com/reference/card-installment-plans A PHP example using cURL to fetch card installment plans from the PayMongo API. This code sets up the cURL request and outputs the response. ```php ``` -------------------------------- ### List Payment Methods - Ruby Example Source: https://developers.paymongo.com/reference/merchant-capabilities A Ruby example for listing available payment methods using the PayMongo API. This code uses the 'net/http' library to send the GET request. ```ruby require 'uri' require 'net/http' url = URI("https://api.paymongo.com/v1/merchants/capabilities/payment_methods") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["accept"] = "application/json" response = http.request(request) puts response.read_body ``` -------------------------------- ### cURL Request Example Source: https://developers.paymongo.com/reference-link/onboarding-update-a-related-consumer Example of a cURL request to update a consumer. ```APIDOC ```bash curl --request PATCH \ --url https://api.paymongo.com/v1/consumers/consumer_id \ --header 'accept: application/json' \ --header 'content-type: application/json' ``` ``` -------------------------------- ### Onboarding API - Initiate Onboarding Source: https://developers.paymongo.com/docs/onboarding-api Initiate the onboarding process for either a child merchant or a consumer. This is the first step in the onboarding flow and requires authentication with a live secret key. You can choose to onboard a child merchant or a consumer by selecting the appropriate endpoint. ```APIDOC ## Onboarding API - Initiate Onboarding ### Description Initiates the onboarding process for either a child merchant or a consumer. This is the first step in the onboarding flow and requires authentication with a live secret key. You can choose to onboard a child merchant or a consumer by selecting the appropriate endpoint. ### Method POST ### Endpoint * `/onboarding/child_merchants` (for Child Merchants) * `/onboarding/consumers` (for Consumers) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body **For Child Merchants:** - `business.trade_name` (string) - Required - The trade name of the business. - `business.type` (string) - Required - The type of business. - `features` (array) - Required - A list of features to enable. **For Consumers:** - `email_address` (string) - Required - The email address of the consumer. - `features` (array) - Required - A list of features to enable. - `first_name` (string) - Required - The first name of the consumer. - `last_name` (string) - Required - The last name of the consumer. - `mobile_number` (string) - Required - The mobile number of the consumer. ### Request Example **Initiating onboarding for a Child Merchant:** ```json { "business": { "trade_name": "Example Corp", "type": "Sole Proprietorship" }, "features": ["uat", "uat_2"] } ``` **Initiating onboarding for a Consumer:** ```json { "email_address": "consumer@example.com", "features": ["uat", "uat_2"], "first_name": "John", "last_name": "Doe", "mobile_number": "+639171234567" } ``` ### Response #### Success Response (200) - `id` (string) - The unique identifier for the initiated onboarding process. - `type` (string) - The type of entity onboarded (e.g., `child_merchant`, `consumer`). - `status` (string) - The current status of the onboarding process. #### Response Example ```json { "id": "evt_xxxxxxxxxxxxxx", "type": "child_merchant", "status": "pending_requirements" } ``` ``` -------------------------------- ### POST /v1/consumers Source: https://developers.paymongo.com/reference/onboarding-create-a-related-consumer Initiates the onboarding process for a new consumer child account. This endpoint requires a live secret key and is intended for use by a parent account. ```APIDOC ## POST /v1/consumers ### Description Initiates the onboarding process for a new consumer child account, allowing the parent account to provide initial details for the consumer. This endpoint is intended for use by a parent account and requires your Live Secret Key. All actions performed via this endpoint will affect live data. ### Method POST ### Endpoint `/v1/consumers` ### Parameters #### Request Body - **data** (object) - Required - The data object for the consumer. - **attributes** (object) - Required - The attributes of the consumer. - **accepted_terms_and_conditions** (boolean) - Required - Indicates whether the consumer has accepted the terms and conditions. The value is true if accepted, otherwise false. (Default: true) - **features** (array) - Required - List of features available for the consumer. Possible values are `basic_wallet`, `fully_verified_standard_wallet`. (Default: `["basic_wallet"]`) - **email_address** (string) - Required - Email address of the consumer. - **first_name** (string) - Required - First name of the consumer. - **last_name** (string) - Required - Last name of the consumer. - **mobile_number** (string) - Required - Mobile number of the consumer. ### Request Example ```json { "data": { "attributes": { "accepted_terms_and_conditions": true, "features": [ "basic_wallet" ], "email_address": "jane.doe@example.com", "first_name": "Jane", "last_name": "Doe", "mobile_number": "+1234567890" } } } ``` ### Response #### Success Response (200) - **(object)** - An empty object indicating success. (Note: The provided OpenAPI spec returns an empty object for success. Actual response might contain consumer details.) #### Response Example ```json { "data": { "id": "con_abcdefghijklmnopqrstuvw", "type": "consumer", "attributes": { "created_at": 1678886400, "updated_at": 1678886400, "email_address": "jane.doe@example.com", "first_name": "Jane", "last_name": "Doe", "mobile_number": "+1234567890", "created_method": "api", "source": "api", "live_mode": true, "accepted_terms_and_conditions": true, "status": "active", "version": 1, "reference_id": null, "metadata": {}, "one_time_use_action": null, "disable_three_d_secure": false, "is_follower": false, "default_payment_method": null, "beneficiary": null } }, "_links": { "self": "https://api.paymongo.com/v1/consumers/con_abcdefghijklmnopqrstuvw" } } ``` ``` -------------------------------- ### Create Product - Go Example Source: https://developers.paymongo.com/reference/create-a-product Illustrates creating a product using the PayMongo API in Go. This example utilizes the standard `net/http` package to construct and send a POST request with JSON data. ```go package main import ( "bytes" "fmt" "net/http" "io/ioutil" ) func main() { url := "https://api.paymongo.com/v1/products" payload := []byte(`{ "external_code": "sku_001", "name": "laptop", "description": "cool looking laptop", "type": "physical", "status": "active", "images": [ "file_123123" ], "metadata": { "clock_speed": 1.23, "cores": 100, "cpu": "intel i9-9999k" } }`) req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload)) if err != nil { panic(err) } req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer YOUR_TOKEN") client := &http.Client{} res, err := client.Do(req) if err != nil { panic(err) } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { panic(err) } fmt.Println(string(body)) } ``` -------------------------------- ### List Installment Plans - Python Example Source: https://developers.paymongo.com/reference/card-installment-plans This Python snippet shows how to retrieve card installment plans from the PayMongo API using the 'requests' library. It makes a GET request and prints the JSON response. ```python import requests url = "https://api.paymongo.com/v1/card_installment_plans" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) print(response.text) ``` -------------------------------- ### Websites API Documentation Source: https://developers.paymongo.com/reference/onboarding-update-a-related-consumer This section details the API endpoints related to website management within PayMongo. ```APIDOC ## GET /websites/{id} ### Description Retrieves details for a specific website associated with your PayMongo account. ### Method GET ### Endpoint /websites/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the website. ### Response #### Success Response (200) - **website_details** (object) - An object containing the website's configuration and settings. #### Response Example ```json { "id": "web_abcdef123456", "name": "My Awesome Store", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:05:00Z" } ``` ## POST /websites ### Description Creates a new website entry in your PayMongo account. ### Method POST ### Endpoint /websites ### Parameters #### Request Body - **name** (string) - Required - The desired name for the website. ### Request Example ```json { "name": "New Online Shop" } ``` ### Response #### Success Response (201) - **website_details** (object) - An object containing the newly created website's details. #### Response Example ```json { "id": "web_ghijkl789012", "name": "New Online Shop", "created_at": "2023-10-27T10:10:00Z", "updated_at": "2023-10-27T10:10:00Z" } ``` ``` -------------------------------- ### List Installment Plans - cURL Request Source: https://developers.paymongo.com/reference/card-installment-plans This snippet demonstrates how to make a GET request to the PayMongo API to retrieve a list of all card installment plans using cURL. It includes the endpoint URL and the necessary 'accept' header. ```shell curl --request GET \ --url https://api.paymongo.com/v1/card_installment_plans \ --header 'accept: application/json' ``` -------------------------------- ### Create Product - Python Example Source: https://developers.paymongo.com/reference/create-a-product Shows how to create a product using the PayMongo API with Python. This example utilizes the `requests` library to send a POST request, including the JSON body and authentication. ```python import requests import json url = "https://api.paymongo.com/v1/products" payload = json.dumps({ "external_code": "sku_001", "name": "laptop", "description": "cool looking laptop", "type": "physical", "status": "active", "images": [ "file_123123" ], "metadata": { "clock_speed": 1.23, "cores": 100, "cpu": "intel i9-9999k" } }) headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_TOKEN' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) ``` -------------------------------- ### consumer.activated Webhook Example (JSON) Source: https://developers.paymongo.com/docs/onboarding-webhooks Example JSON payload for the 'consumer.activated' webhook event. This event fires when a related consumer is activated, including their details, activation status, and any associated wallet information. ```json { "data": { "id": "evt_xxxx", "type": "event", "attributes": { "type": "consumer.activated", "livemode": true, "data": { "consumer_id": "org_xxxx", "account": { "first_name": "John", "last_name": "Doe", "email_address": "john.doe@mail.com" }, "activation_status": "activated", "features": [ "fully_verified_standard_wallet" ], "wallet": { "id": "wallet_xxxx", "account_number": "1234567890", "keys": { "sk_live": "sk_live_xxxx", "sk_test": "sk_test_xxxx" }, "status": "activated", "type": "fully_verified_standard" } }, "previous_data": {}, "created_at": 1746675190, "updated_at": 1746675190 } } } ``` -------------------------------- ### GET /plans_and_issuers Source: https://developers.paymongo.com/docs/card-installments-api Retrieves available installment plans and issuer information. This data is required for displaying processing fees and terms and conditions on the checkout page. ```APIDOC ## GET /plans_and_issuers ### Description Retrieves a list of available installment plans and associated issuer details. This endpoint provides the necessary information to display processing fees and terms and conditions to the customer during checkout. ### Method GET ### Endpoint /plans_and_issuers ### Parameters #### Query Parameters None ### Request Example ``` GET /plans_and_issuers ``` ### Response #### Success Response (200) - **plans** (array) - A list of available installment plans. - **issuers** (array) - A list of associated issuers for the installment plans. #### Response Example ```json { "plans": [ { "id": "plan_xyz123", "name": "3-Month Installment", "minimum_amount": 50000, "maximum_amount": 200000, "interest_rate": 0.0, "processing_fee": 0.02, "terms_and_conditions": "These terms govern the use of Pay Later Instalment Payment Plans. By using Pay Later Instalment Payment Plans ,Pay Later you are deemed to have read and agree to be bound by these Terms and Conditions , visit:https://www.dbs.com" } ], "issuers": [ { "id": "issuer_abc789", "name": "Sample Bank" } ] } ``` ``` -------------------------------- ### Consumer Resource Details Source: https://developers.paymongo.com/reference/onboarding-consumer-resource Provides detailed information about the consumer resource, including its attributes and their respective types and descriptions. ```APIDOC ## Consumer Resource Details ### Description This section details the structure of a consumer resource, outlining all available fields, their data types, and descriptions. ### Method GET ### Endpoint /websites/developers_paymongo/consumers/{id} ### Parameters #### Path Parameters - **id** (string) - Required - A system-generated unique identifier of the consumer resource. ### Response #### Success Response (200) - **data** (object) - Contains the consumer resource object. - **id** (string) - A system-generated unique identifier of the resource. - **type** (string) - Represents the resource type. Value is always `consumer`. - **attributes** (object) - Contains the attributes of the consumer. - **activation_status** (string) - The current activation status of the consumer. Possible values include `pending`, `under_review`, `activated`, and `declined`. - **address** (object) - Current address details of the consumer. - **line1** (string) - First line of the consumer's current address. - **line2** (string) - Second line of the consumer's current address. - **city** (string) - City of the consumer’s current address. - **postal_code** (string) - Postal code of the consumer’s current address. - **state** (string) - State of the consumer's current address. - **date_of_birth** (object) - Date of the consumer’s date of birth. - **day** (integer) - Day of the consumer’s date of birth (1-31). - **month** (integer) - Month of the consumer’s date of birth (1-12). - **year** (integer) - Year of the consumer’s date of birth. The representative must be of legal age. - **email_address** (string) - Email address of the consumer. - **features** (array of string) - List of features available for the child merchant. Possible values are `basic_wallet`,`fully_verified_standard_wallet`. - **first_name** (string) - First name of the consumer. - **intended_use** (string) - The intended use for the consumer account. Possible values are `bills_payment`, `fund_transfer`, and `store_value`. - **last_name** (string) - Last name of the consumer. - **mobile_number** (string) - Mobile number of the consumer. - **nationality** (string) - Nationality of the consumer. - **nature_of_work** (string) - Nature of work of the consumer. - **onboarding_url** (string) - URL for the consumer onboarding process. - **permanent_address** (object) - Permanent address details of the consumer. - **line1** (string) - First line of the consumer's permanent address. - **line2** (string) - Second line of the consumer's permanent address. - **city** (string) - City of the consumer’s permanent address. - **state** (string) - State of the consumer's permanent address. - **postal_code** (string) - Postal code of the consumer’s permanent address. - **place_of_birth** (object) - Place of birth details of the consumer. - **city** (string) - City of the consumer's place of birth. - **country** (string) - Country of the consumer's place of birth. - **source_of_funds** (string) - Source of funds for the consumer. - **source_of_funds_other** (string) - Other source of funds if applicable. - **source_of_funds_salary** (string) - Specific details if source of funds is salary. - **tin** (string) - Tax Identification Number of the consumer. - **created_at** (integer) - Timestamp when the consumer was created. - **terms_and_conditions_consented_at** (integer) - Timestamp when the terms and conditions were consented to. - **updated_at** (integer) - Timestamp when the consumer was last updated. #### Response Example ```json { "data": { "id": "org_xxxxxxxxxxxxxxxxxxxxxxx", "type": "consumer", "attributes": { "activation_status": "pending", "address": { "line1": "Line1", "line2": "Line2", "city": "City", "postal_code": "1234", "state": "PH-MNL" }, "date_of_birth": { "day": 1, "month": 1, "year": 2000 }, "email_address": "jose.rizal@sample.com", "features": [ "fully_verified_standard_wallet" ], "first_name": "Jose", "intended_use": "store_value", "last_name": "Rizal", "mobile_number": "+639569999999", "nationality": "PHL", "nature_of_work": "employed_locally", "onboarding_url": "https://seeds-onboarding.paymongo.com/onboarding/consumers/org_xxxx", "permanent_address": { "line1": "Line1111", "line2": "Line2", "city": "City", "state": "PH-MNL", "postal_code": "1234" }, "place_of_birth": { "city": "PH-MNL", "country": "PH" }, "source_of_funds": "salary", "source_of_funds_other": null, "source_of_funds_salary": "My company", "tin": "123456000000", "created_at": 1724900813, "terms_and_conditions_consented_at": 1724900813, "updated_at": 1724900819 } } } ``` ``` -------------------------------- ### Onboarding API - Retrieve Requirements Source: https://developers.paymongo.com/docs/onboarding-api Retrieve the list of requirements needed to complete the onboarding process for either a child merchant or a consumer. The requirements may vary based on the selected features and business type. ```APIDOC ## Onboarding API - Retrieve Requirements ### Description Retrieve the list of requirements needed to complete the onboarding process for either a child merchant or a consumer. The requirements may vary based on the selected features and business type. ### Method GET ### Endpoint * `/onboarding/child_merchants/{id}/requirements` (for Child Merchants) * `/onboarding/consumers/{id}/requirements` (for Consumers) ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the onboarding process. #### Query Parameters None #### Request Body None ### Request Example **Retrieving requirements for a Child Merchant:** ``` GET /onboarding/child_merchants/evt_xxxxxxxxxxxxxx/requirements ``` **Retrieving requirements for a Consumer:** ``` GET /onboarding/consumers/evt_xxxxxxxxxxxxxx/requirements ``` ### Response #### Success Response (200) - `data` (array) - A list of requirement objects. - `attribute` (string) - The name of the attribute required. - `required` (boolean) - Whether the attribute is required. - `type` (string) - The type of the attribute. #### Response Example ```json { "data": [ { "attribute": "business_registration_number", "required": true, "type": "string" }, { "attribute": "proof_of_address", "required": false, "type": "file" } ] } ``` ``` -------------------------------- ### Get Wallet Quote by ID (OpenAPI) Source: https://developers.paymongo.com/reference/get-rate This OpenAPI definition describes how to retrieve a specific wallet quote by its unique ID. It specifies the HTTP GET method for the '/v1/wallets/quotes/{id}' endpoint, detailing the path parameter 'id' and providing example JSON responses for success (200) and error (400) scenarios. The success response includes a detailed schema for the quote object, encompassing client information, currency details, pricing, and timestamps. ```json { "openapi": "3.1.0", "info": { "title": "paymongo-api", "version": "2" }, "servers": [ { "url": "https://api.paymongo.com" } ], "components": { "securitySchemes": { "sec0": { "type": "http", "scheme": "basic" } } }, "security": [ { "sec0": [] } ], "paths": { "/v1/wallets/quotes/{id}": { "get": { "summary": "Get Quote", "description": "", "operationId": "get-quote", "parameters": [ { "name": "id", "in": "path", "description": "The ID of the quote you want to retrieve", "schema": { "type": "string" }, "required": true } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "{\n \"data\": {\n \"id\": \"qt_123sampleid\",\n \"type\": \"quote\",\n \"attributes\": {\n \"client_id\": \"client_123sampleid\",\n \"external_id\": \"01sample-0fid-7ff9-bab3-805dsampleid\",\n \"base_currency\": \"PHP\",\n \"target_currency\": \"USDC\",\n \"provider\": \"PDAX\",\n \"side\": \"buy\",\n \"quantity\": \"17.26\",\n \"price\": \"57.924\",\n \"total_amount\": \"1000.0\",\n \"expires_at\": \"2025-03-19T05:28:55.205Z\",\n \"created_at\": 1742362120,\n \"updated_at\": 1742362120\n }\n }\n}" } }, "schema": { "type": "object", "properties": { "data": { "type": "object", "properties": { "id": { "type": "string", "example": "qt_123sampleid" }, "type": { "type": "string", "example": "quote" }, "attributes": { "type": "object", "properties": { "client_id": { "type": "string", "example": "client_123sampleid" }, "external_id": { "type": "string", "example": "01sample-0fid-7ff9-bab3-805dsampleid" }, "base_currency": { "type": "string", "example": "PHP" }, "target_currency": { "type": "string", "example": "USDC" }, "provider": { "type": "string", "example": "PDAX" }, "side": { "type": "string", "example": "buy" }, "quantity": { "type": "string", "example": "17.26" }, "price": { "type": "string", "example": "57.924" }, "total_amount": { "type": "string", "example": "1000.0" }, "expires_at": { "type": "string", "example": "2025-03-19T05:28:55.205Z" }, "created_at": { "type": "integer", "example": 1742362120, "default": 0 }, "updated_at": { "type": "integer", "example": 1742362120, "default": 0 } } } } } } } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } } } } } } } } } } ``` -------------------------------- ### Retrieve Child Merchant Requirements (Python) Source: https://developers.paymongo.com/docs/onboarding-retrieve-child-merchant-requirements Example of retrieving child merchant requirements using Python and the PayMongo API. This snippet would typically use the 'requests' library to make the GET request. ```python # Python example would go here, likely using the 'requests' library # GET https://api.paymongo.com/v1/merchants/children/{child_merchant_id}/requirements ``` -------------------------------- ### Create Product - Node.js Example Source: https://developers.paymongo.com/reference/create-a-product Provides a Node.js example for creating a product using the PayMongo API. It demonstrates sending a POST request with JSON data and an Authorization header. ```javascript const axios = require('axios'); const data = JSON.stringify({ "external_code": "sku_001", "name": "laptop", "description": "cool looking laptop", "type": "physical", "status": "active", "images": [ "file_123123" ], "metadata": { "clock_speed": 1.23, "cores": 100, "cpu": "intel i9-9999k" } }); const config = { method: 'post', url: 'https://api.paymongo.com/v1/products', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_TOKEN' }, data : data }; axios(config) .then(function (response) { console.log(JSON.stringify(response.data)); }) .catch(function (error) { console.log(error); }); ``` -------------------------------- ### POST /v1/consumers Source: https://developers.paymongo.com/reference-link/onboarding-create-a-related-consumer This endpoint initiates the onboarding process for a new consumer child account, allowing the parent account to provide initial details for the consumer. It requires your Live Secret Key and all actions performed via this endpoint will affect live data. ```APIDOC ## POST /v1/consumers ### Description Initiates the onboarding process for a new consumer child account, allowing the parent account to provide initial details for the consumer. Requires Live Secret Key. ### Method POST ### Endpoint https://api.paymongo.com/v1/consumers ### Parameters #### Request Body - **data** (object) - Required - The data object containing consumer attributes. - **attributes** (object) - Required - The attributes for the new consumer. - **accepted_terms_and_conditions** (boolean) - Required - Indicates if the terms and conditions have been accepted. - **features** (array of strings) - Optional - A list of features to enable for the consumer. ### Request Example ```json { "data": { "attributes": { "accepted_terms_and_conditions": true, "features": [ "basic_wallet" ] } } } ``` ### Response #### Success Response (200) - **response** (object) - The response body upon successful creation. #### Response Example ```json { "data": { "type": "consumer", "id": "con_...", "attributes": { "created_at": "2023-10-27T10:00:00.123456Z", "updated_at": "2023-10-27T10:00:00.123456Z", "reference_number": null, "default_description": null, "accepted_terms_and_conditions": true, "accepted_at": "2023-10-27T10:00:00.123456Z", "individual": null, "organization": null, "livemode": true } } } ``` ``` -------------------------------- ### Enable QR Ph in Payment Intent Creation Source: https://developers.paymongo.com/docs/qr-ph-api To enable QR Ph as a payment method, include 'qrph' within the `payment_method_allowed` array when creating a Payment Intent. This example shows the JSON structure for such a request. ```json { "data": { "attributes": { "amount": 10000, "payment_method_allowed": [ "card", "dob", "paymaya", "qrph" ], "# ..." } } } ``` -------------------------------- ### Product Resource JSON Example Source: https://developers.paymongo.com/reference/product This JSON object demonstrates the structure of a Product resource. It includes details such as the product's ID, name, description, type, status, associated images, metadata, and pricing information. ```json { "data": { "id": "prdct_a0198f3927353ba99af2f135", "account_id": "acct_1234567890", "external_code": "sku_001", "name": "laptop", "description": "cool looking laptop", "type": "physical_good", "status": "active", "images": [ "file_123123" ], "metadata": { "clock_speed": 1.23, "cores": 100, "cpu": "intel i9-9999k" }, "prices": null, "created_at": 1755078183, "updated_at": 1755078183 } } ``` -------------------------------- ### List Child Merchant File Records (Python) Source: https://developers.paymongo.com/reference-link/onboarding-child-merchant-list-file-records Python example for listing file records of a child merchant using the requests library. It sends a GET request to the specified PayMongo API endpoint. ```python import requests url = "https://api.paymongo.com/v1/merchants/children/{child_merchant_id}/documents" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) print(response.text) ``` -------------------------------- ### List Child Merchant File Records (PHP) Source: https://developers.paymongo.com/reference-link/onboarding-child-merchant-list-file-records PHP code snippet to retrieve a list of file records for a child merchant. This example uses cURL to send a GET request to the PayMongo API. ```php $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://api.paymongo.com/v1/merchants/children/{child_merchant_id}/documents"); curl_setopt($curl, CURLOPT_HTTPHEADER, [ 'accept: application/json', ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #" . $err; } else { echo $response; } ``` -------------------------------- ### List Child Merchant File Records (Node.js) Source: https://developers.paymongo.com/reference-link/onboarding-child-merchant-list-file-records Example for retrieving a list of file records for a child merchant using Node.js. This typically involves making an HTTP GET request to the PayMongo API. ```javascript const options = { method: 'GET', url: 'https://api.paymongo.com/v1/merchants/children/{child_merchant_id}/documents', headers: { accept: 'application/json' } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); ``` -------------------------------- ### Create Product - Java Example Source: https://developers.paymongo.com/reference/create-a-product Illustrates creating a new product via the PayMongo API using Java. This example utilizes the OkHttp client to send a POST request with JSON payload and authentication. ```java OkHttpClient client = new OkHttpClient().newBuilder().build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\"external_code\": \"sku_001\", \"name\": \"laptop\", \"description\": \"cool looking laptop\", \"type\": \"physical\", \"status\": \"active\", \"images\": [ \"file_123123\" ], \"metadata\": { \"clock_speed\": 1.23, \"cores\": 100, \"cpu\": \"intel i9-9999k\" }}"); Request request = new Request.Builder() .url("https://api.paymongo.com/v1/products") .method("POST", body) .addHeader("Content-Type", "application/json") .addHeader("Authorization", "Bearer YOUR_TOKEN") .build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Retrieve Child Merchant Requirements (Ruby) Source: https://developers.paymongo.com/docs/onboarding-retrieve-child-merchant-requirements Example of retrieving child merchant requirements using Ruby and the PayMongo API. This snippet would typically involve an HTTP client library to make the GET request. ```ruby # Ruby example would go here, likely using Net::HTTP or Faraday # GET https://api.paymongo.com/v1/merchants/children/{child_merchant_id}/requirements ``` -------------------------------- ### Retrieve Child Merchant Requirements (Node.js) Source: https://developers.paymongo.com/docs/onboarding-retrieve-child-merchant-requirements Example of retrieving child merchant requirements using Node.js and the PayMongo API. This snippet would typically involve an HTTP client library to make the GET request. ```javascript // Node.js example would go here, likely using fetch or axios // GET https://api.paymongo.com/v1/merchants/children/{child_merchant_id}/requirements ``` -------------------------------- ### List Consumer File Records (PHP) Source: https://developers.paymongo.com/reference-link/onboarding-consumer-list-of-file-records A PHP example for fetching consumer file records using cURL or a similar HTTP client. This code sends a GET request to the specified PayMongo API endpoint. ```php // PHP example (conceptual) // function list_consumer_documents($consumer_id) { // $url = "https://api.paymongo.com/v1/consumers/".$consumer_id."/documents"; // // $ch = curl_init(); // curl_setopt($ch, CURLOPT_URL, $url); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // curl_setopt($ch, CURLOPT_HTTPHEADER, array( // 'Accept: application/json' // )); // // $response = curl_exec($ch); // $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); // curl_close($ch); // // if ($http_status >= 200 && $http_status < 300) { // return json_decode($response, true); // } else { // // Handle error // return null; // } // } ``` -------------------------------- ### Create Payment Request Examples (Multiple Languages) Source: https://developers.paymongo.com/v2/reference/create-a-payment Provides examples for creating a payment using the PayMongo API in different programming languages. These snippets illustrate how to structure the request, including the endpoint, headers, and JSON payload for the payment amount. ```shell curl --request POST \ --url https://api.paymongo.com/v1/payments \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "data": { "attributes": { "amount": 2000 } } }' ``` ```javascript const url = 'https://api.paymongo.com/v1/payments'; const data = { "data": { "attributes": { "amount": 2000 } } }; fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.paymongo.com/v1/payments") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Accept"] = "application/json" request["Content-Type"] = "application/json" request.body = JSON.dump({ "data": { "attributes": { "amount": 2000 } } }) response = http.request(request) puts response.read_body ``` ```php $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://api.paymongo.com/v1/payments"); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode([ "data" => [ "attributes" => [ "amount" => 2000 ] ] ])); curl_setopt($curl, CURLOPT_HTTPHEADER, [ 'Accept: application/json', 'Content-Type: application/json' ]); $response = curl_exec($curl); if (curl_errno($curl)) { echo 'Error:' . curl_error($curl); } c_l_close($curl); echo $response; ``` ```python import requests import json url = "https://api.paymongo.com/v1/payments" data = { "data": { "attributes": { "amount": 2000 } } } headers = { "Content-Type": "application/json", "Accept": "application/json" } response = requests.post(url, headers=headers, data=json.dumps(data)) print(response.json()) ``` -------------------------------- ### Retrieve Child Merchant Requirements (PHP) Source: https://developers.paymongo.com/docs/onboarding-retrieve-child-merchant-requirements Example of retrieving child merchant requirements using PHP and the PayMongo API. This snippet would typically involve cURL or a Guzzle HTTP client to make the GET request. ```php // PHP example would go here, likely using cURL or Guzzle // GET https://api.paymongo.com/v1/merchants/children/{child_merchant_id}/requirements ``` -------------------------------- ### merchant.activated Webhook Example (JSON) Source: https://developers.paymongo.com/docs/onboarding-webhooks Example JSON payload for the 'merchant.activated' webhook event. This event triggers when a child merchant is activated and includes details about the merchant's account and features. It can optionally include wallet information. ```json { "data": { "id": "evt_xxxxxxxxxxxxxxxxxxxxxxxx", "type": "event", "attributes": { "type": "merchant.activated", "livemode": true, "data": { "merchant_id": "org_xxxxxxxx", "account": { "legal_name": "Staff Merchant", "trade_name": "PayMongo Test Account", "type": "individual" }, "activation_status": "activated", "features": [ "payment_gateway" ], "keys": { "pk_live": "pk_live_xxxxxxxxr", "pk_test": "pk_test_xxxxxxxx", "sk_live": "sk_live_xxxxxxxx", "sk_test": "sk_test_xxxxxxxx" } }, "previous_data": {}, "created_at": 1746755984, "updated_at": 1746755984 } } } ``` ```json { "data": { "id": "evt_xxxxxxxxxxxxxxxxxxxxxxxx", "type": "event", "attributes": { "type": "merchant.activated", "livemode": true, "data": { "merchant_id": "org_xxxxxxxx", "account": { "legal_name": "Legal Name", "trade_name": "PayMongo Test Account", "type": "partnership" }, "activation_status": "activated", "features": [ "standard_wallet" ], "wallet": { "id": "wallet_xxxxxxxx", "account_number": "123456789101", "keys": { "sk_live": "sk_live_xxxxxxxx", "sk_test": "sk_test_xxxxxxxx" }, "status": "activated", "type": "standard" } }, "previous_data": {}, "created_at": 1746755984, "updated_at": 1746755984 } } } ``` -------------------------------- ### List Consumer File Records (Node.js) Source: https://developers.paymongo.com/reference/onboarding-consumer-file-reocrds This Node.js example demonstrates how to fetch a list of consumer file records using the PayMongo API. It involves making a GET request to the specified endpoint with the consumer ID and appropriate headers. ```javascript // Node.js example (implementation details would vary based on HTTP client used, e.g., axios, fetch) // const consumerId = 'your_consumer_id'; // fetch(`https://api.paymongo.com/v1/consumers/${consumerId}/documents`, { // method: 'GET', // headers: { // 'accept': 'application/json' // } // }) // .then(response => response.json()) // .then(data => console.log(data)) // .catch(error => console.error('Error:', error)); ```