### Install Moneroo Laravel SDK Source: https://docs.moneroo.io/sdks/laravel Install the Moneroo Laravel SDK using Composer. This command fetches the package and its dependencies. ```bash composer require moneroo/moneroo-laravel ``` -------------------------------- ### API Key Authentication Example Source: https://docs.moneroo.io/introduction/authentication This example demonstrates how to authenticate an API request using a secret key in the Authorization header. It shows a GET request to retrieve a payment by its ID. ```APIDOC ## GET /v1/payments/{payment_id} ### Description Retrieves a specific payment using its unique identifier. ### Method GET ### Endpoint `/v1/payments/{payment_id}` ### Parameters #### Path Parameters - **payment_id** (string) - Required - The unique identifier of the payment to retrieve. ### Request Example ```bash curl https://api.moneroo.io/v1/payments/test_yyfbwekjnsd \ -H "Authorization: Bearer YOUR_SECRET_KEY" \ -X GET ``` ### Response #### Success Response (200) - **payment_id** (string) - The ID of the payment. - **amount** (number) - The amount of the payment. - **currency** (string) - The currency of the payment. #### Response Example ```json { "payment_id": "test_yyfbwekjnsd", "amount": 100.50, "currency": "USD" } ``` ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.moneroo.io/payouts/initialize-payout Perform an HTTP GET request to the documentation URL with the 'ask' query parameter to get dynamic answers. The question should be specific and self-contained. ```http GET https://docs.moneroo.io/payouts/initialize-payout.md?ask= ``` -------------------------------- ### Query Documentation with GET Request Source: https://docs.moneroo.io/introduction/webhooks To get additional information not directly on the page, perform an HTTP GET request to the current page URL with the `ask` query parameter. The question should be specific and in natural language. Use this for clarifications or to retrieve related documentation. ```http GET https://docs.moneroo.io/introduction/webhooks.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.moneroo.io/payments/standard-integration Perform an HTTP GET request to a documentation URL with the `ask` query parameter to get specific answers. The question should be natural language, self-contained, and specific. ```http GET https://docs.moneroo.io/payments/standard-integration.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.moneroo.io/payouts/testing Perform an HTTP GET request on the current page URL with the `ask` query parameter to dynamically query the documentation. The question should be specific and in natural language. Use this when information is not explicitly present or clarification is needed. ```http GET https://docs.moneroo.io/payouts/testing.md?ask= ``` -------------------------------- ### Verify Transaction with JavaScript (Node.js) Source: https://docs.moneroo.io/payments/transaction-verification This Node.js example uses the 'axios' library to send a GET request for transaction verification. Ensure 'axios' is installed. ```javascript const axios = require("axios"); const paymentId = "your_payment_id"; const token = "your_token"; axios .get(`https://api.moneroo.io/v1/payments/${paymentId}/verify`, { headers: { Authorization: `Bearer ${token}`, }, }) .then((response) => { if (response.status === 200) { // Handle successful response } else { // Handle error response } }) .catch((error) => { // Handle error }); ``` -------------------------------- ### Publish Moneroo Configuration Source: https://docs.moneroo.io/sdks/laravel Run this Artisan command after installing the package to publish the configuration file and update your .env file with necessary keys. ```bash php artisan moneroo:install ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://docs.moneroo.io/payments/transaction-verification Perform an HTTP GET request to the current page URL with the `ask` query parameter to ask specific questions about the documentation. The question should be self-contained and in natural language. ```http GET https://docs.moneroo.io/payments/transaction-verification.md?ask= ``` -------------------------------- ### Query Moneroo Documentation Dynamically Source: https://docs.moneroo.io/introduction/testing To get more information not present on the current page, make an HTTP GET request to the page URL with the `ask` query parameter. The question should be specific and in natural language. ```http GET https://docs.moneroo.io/introduction/testing.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.moneroo.io/payments/initialize-payment Perform an HTTP GET request to query documentation dynamically. Use the 'ask' query parameter with a specific question. The response includes an answer and relevant excerpts. ```http GET https://docs.moneroo.io/payments/initialize-payment.md?ask= ``` -------------------------------- ### Initialize Payment with JavaScript (Node.js) Source: https://docs.moneroo.io/payments/standard-integration This Node.js example uses the axios library to initialize a payment. Replace YOUR_SECRET_KEY with your actual secret key. It sends a POST request and prepares to handle the response. ```javascript const axios = require('axios'); const data = { "amount": 100, "currency": "USD", "description": "Payment for order #123", "customer": { "email": "john@example.com", "first_name": "John", "last_name": "Doe" }, "return_url": "https://example.com/payments/thank-you", "metadata": { "order_id": "123", "customer_id": "123", }, "methods": ["qr_ngn", "bank_transfer_ngn"] }; const options = { headers: { ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.moneroo.io/integrations Use this GET request to query the documentation dynamically with a specific question. The response includes a direct answer and relevant excerpts. ```http GET https://docs.moneroo.io/integrations.md?ask= ``` -------------------------------- ### Perform Dynamic Documentation Query Source: https://docs.moneroo.io/payouts/available-methods To get additional information not directly present on a page, perform an HTTP GET request with the `ask` query parameter. The question should be specific and in natural language. ```http GET https://docs.moneroo.io/payouts/available-methods.md?ask= ``` -------------------------------- ### Perform HTTP GET Request with 'ask' Parameter Source: https://docs.moneroo.io/payments/available-methods Use this method to query the documentation dynamically when information is not explicitly present. The question should be specific and self-contained. ```http GET https://docs.moneroo.io/payments/available-methods.md?ask= ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.moneroo.io/payments/status Perform an HTTP GET request to query the documentation dynamically using the `ask` query parameter. This is useful for retrieving specific information not explicitly present on the page. ```http GET https://docs.moneroo.io/payments/status.md?ask= ``` -------------------------------- ### Authenticate API Requests with Bearer Token Source: https://docs.moneroo.io/introduction/authentication Include your API key or token in the Authorization header using the Bearer method for all API requests. This example shows the format for a GET request. ```bash curl https://api.moneroo.io/v1/payments/test_yyfbwekjnsd -H "Authorization: Bearer YOUR_SECRET_KEY" -X GET ``` -------------------------------- ### Querying Documentation with 'ask' Parameter Source: https://docs.moneroo.io/introduction/errors To get information not explicitly on the page, make an HTTP GET request to the current URL with the `ask` query parameter. The question should be specific and in natural language. ```http GET https://docs.moneroo.io/introduction/errors.md?ask= ``` -------------------------------- ### Get Available Payout Methods Source: https://docs.moneroo.io/payouts/available-methods You can retrieve an up-to-date list of all available payout methods by making a GET request to the /utils/payout/methods endpoint. ```APIDOC ## GET /utils/payout/methods ### Description Retrieves a list of all available payout methods supported by the Moneroo platform. ### Method GET ### Endpoint /utils/payout/methods ### Query Parameters None ### Request Example ```bash GET /utils/payout/methods HTTP/1.1 Host: https://api.moneroo.io Accept: application/json ``` ### Response #### Success Response (200) Returns a JSON object containing a list of payout methods. Each method includes its name, code, currency, and supported countries. Example Response Structure: ```json [ { "name": "Airtel Congo", "code": "airtel_cd", "currency": "CDF", "countries": ["CD"] }, { "name": "M-Pesa Kenya", "code": "mpesa_ke", "currency": "KES", "countries": ["KE"] } ] ``` ``` -------------------------------- ### Get Available Payment Methods Source: https://docs.moneroo.io/payments/available-methods You can retrieve an up-to-date list of all available payment methods by calling the GET /utils/payment/methods endpoint. ```APIDOC ## GET /utils/payment/methods ### Description Retrieves a list of all available payment methods supported by the system. ### Method GET ### Endpoint /utils/payment/methods ### Parameters #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **name** (string) - The name of the payment method. - **code** (string) - A unique code representing the payment method. - **currency** (string) - The currency associated with the payment method. - **countries** (array of strings) - A list of countries where the payment method is available. #### Response Example ```json [ { "name": "Airtel Congo", "code": "airtel_cd", "currency": "CDF", "countries": ["CD"] }, { "name": "Airtel Money Malawi", "code": "airtel_mw", "currency": "MWK", "countries": ["MW"] } ] ``` ``` -------------------------------- ### Verify Transaction with Go Source: https://docs.moneroo.io/payments/transaction-verification This Go program shows how to make an HTTP GET request to verify a transaction. It handles potential errors during the request. ```go package main import ( "fmt" "net/http" ) func main() { paymentId := "your_payment_id" token := "your_token" url := fmt.Sprintf("https://api.moneroo.io/v1/payments/%s/verify", paymentId) req, err := http.NewRequest("GET", url, nil) if err != nil { // Handle error } req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) client := &http.Client{} resp, err := client.Do(req) if err != nil { // Handle error } defer resp.Body.Close() if resp.StatusCode == 200 { // Handle successful response } else { // Handle error response } } ``` -------------------------------- ### Query Documentation Dynamically Source: https://docs.moneroo.io/payouts/verify-payout Perform an HTTP GET request to the current page URL with the 'ask' query parameter to retrieve specific information. The question should be self-contained and in natural language. Use this for clarifications or to retrieve related documentation sections. ```HTTP GET https://docs.moneroo.io/payouts/verify-payout.md?ask= ``` -------------------------------- ### Example Payment Success Webhook Payload Source: https://docs.moneroo.io/introduction/webhooks This is an example JSON payload for a 'payment.success' event sent by Moneroo. Use the 'event' field to determine the type of notification. ```json { "event": "payment.success", "data": { "id": "123456", "amount": 100, "currency": "USD", "status": "success" } } ``` -------------------------------- ### Install Moneroo PHP SDK via Composer Source: https://docs.moneroo.io/sdks/php Use Composer to add the Moneroo PHP SDK to your project. Ensure you are running PHP 7.4 or later. ```bash composer require moneroo/moneroo-php ``` -------------------------------- ### Verify Transaction with Python Source: https://docs.moneroo.io/payments/transaction-verification This Python script uses the 'requests' library to verify a transaction. Make sure to install the library if you haven't already. ```python import requests paymentId = 'your_payment_id' token = 'your_token' headers = { 'Authorization': f'Bearer {token}' } response = requests.get(f'https://api.moneroo.io/v1/payments/{paymentId}/verify', headers=headers) if response.status_code == 200: # Handle successful response else: # Handle error response ``` -------------------------------- ### Payout Verification Response Example Source: https://docs.moneroo.io/payouts/verify-payout This JSON structure represents a successful payout verification response. It includes transaction details, status, and timestamps. Use this to understand the expected format of a successful verification. ```json { "data": { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "status": "success", "is_processed": true, "processed_at": "2023-12-26T22:04:50.000000Z", "amount": 1000, "currency": "USD", "amount_formatted": "$10.00", "description": "Payment for services", "return_url": "https://example.com/return", "environment": "sandbox", "initiated_at": "2023-12-26T22:04:49.000000Z", "checkout_url": "https://sandbox.moneroo.io/pay/a1b2c3d4-e5f6-7890-1234-567890abcdef", "app": { "id": "app_12345", "name": "My Awesome App" }, "customer": { "id": "cust_67890", "name": "John Doe", "email": "john.doe@example.com", "phone_number": "+1234567890" }, "method": "card", "gateway": { "name": "Stripe", "transaction_id": "pi_123abc456def789ghi" }, "metadata": { "order_id": "#98765" }, "context": { "ip_address": "192.168.1.1" } }, "errors": null } ``` -------------------------------- ### Verify Payout Transaction with JavaScript (Node.js) Source: https://docs.moneroo.io/payouts/verify-payout This Node.js example uses the 'axios' library to verify a payout transaction. Remember to replace 'your_payment_id' and 'your_token' with your specific API details. The promise-based approach handles success and error responses. ```javascript const axios = require("axios"); const paymentId = "your_payment_id"; const token = "your_token"; axios .get(`https://api.moneroo.io/v1/payments/${paymentId}/verify`, { headers: { Authorization: `Bearer ${token}`, }, }) .then((response) => { if (response.status === 200) { // Handle successful response } else { // Handle error response } }) .catch((error) => { // Handle error }); ``` -------------------------------- ### Initialize Payment with Go Source: https://docs.moneroo.io/payments/standard-integration This Go program initializes a payment using the standard http package. Replace YOUR_SECRET_KEY with your actual secret key. It sends a POST request and prints the checkout URL upon success. ```go package main import ( "bytes" "encoding/json" "net/http" "fmt" ) func main() { data := map[string]interface{}{ "amount": 100, "currency": "USD", "description": "Payment for order #123", "customer": map[string]string{ "email": "john@example.com", "first_name": "John", "last_name": "Doe", }, "return_url": "https://example.com/payments/thank-you", "metadata": map[string]string{ "order_id": "123", "customer_id": "123", }, "methods": []string{"qr_ngn", "bank_transfer_ngn"}, } bytesRepresentation, _ := json.Marshal(data) req, _ := http.NewRequest("POST", "https://api.moneroo.io/v1/payments/initialize", bytes.NewBuffer(bytesRepresentation)) req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer YOUR_SECRET_KEY") req.Header.Set("Accept", "application/json") client := &http.Client{} response, _ := client.Do(req) defer response.Body.Close() var result map[string]interface{} json.NewDecoder(response.Body).Decode(&result) if response.StatusCode != 201 { panic(fmt.Sprintf("Request failed with status %d", response.StatusCode)) } fmt.Printf("Redirect to: %s", result["checkout_url"]) } ``` -------------------------------- ### Initialize a Payment with Moneroo PHP SDK Source: https://docs.moneroo.io/sdks/php Create a new payment by passing an array of payment details to the `init` method. Redirect customers to the returned checkout URL. Required fields include amount, currency, customer details, and return URL. ```php $paymentData = [ 'amount' => 100, 'currency' => 'USD', 'customer' => [ 'email' => 'john.doe@example.com', 'first_name' => 'John', 'last_name' => 'Doe', 'phone' => '123456789', 'address' => '123 Main St', 'city' => 'Los Angeles', 'state' => 'CA', 'country' => 'USA', 'zip' => '90001', ], 'description' => 'Payment for order #123', 'return_url' => 'https://yourwebsite.com/thanks', 'metadata' => [ 'order_id' => '123', 'customer_id' => '456', ], 'methods' => ['card', 'orange_ci'], ]; $monerooPayment = new \Moneroo\Payment($secretKey); $payment = $monerooPayment->init($paymentData); // Redirect the customer to the Checkout URL header('Location: ' . $payment->checkout_url); ``` -------------------------------- ### Retrieve Payment Source: https://docs.moneroo.io/sdks/php To get details of a payment, use the `get` method with the transaction ID. ```APIDOC ## Retrieve Payment ### Description Retrieves detailed information about a specific payment using its transaction ID. ### Method ```php $payment = $monerooPayment->get($transactionId); ``` ### Parameters - **transactionId** (string) - Required - The unique identifier of the payment to retrieve. ``` -------------------------------- ### Initialize Payment with Moneroo SDK Source: https://docs.moneroo.io/sdks/laravel Use this to create a new payment by passing an array of payment data. Ensure all required fields like amount, currency, customer details, and return URL are included. The method returns a payment object with a checkout URL for redirection. ```php $paymentData = [ 'amount' => 100, 'currency' => 'USD', 'customer' => [ 'email' => 'john.doe@example.com', 'first_name' => 'John', 'last_name' => 'Doe', 'phone' => '123456789', 'address' => '123 Main St', 'city' => 'Los Angeles', 'state' => 'CA', 'country' => 'USA', 'zip' => '90001', ], 'description' => 'Payment for order #123', 'return_url' => 'https://yourwebsite.com/thanks', 'metadata' => [ 'order_id' => '123', 'customer_id' => '456', ], 'methods' => ['card', 'orange_ci'], ]; $monerooPayment = new Moneroo\Payment(); $payment = $monerooPayment->init($paymentData); // Redirect the customer to the Checkout URL header('Location: ' . $payment->checkout_url); ``` -------------------------------- ### Retrieve Payment Details with Moneroo SDK Source: https://docs.moneroo.io/sdks/laravel Get detailed information about a specific payment by providing its transaction ID to the `get` method. ```php $transactionId = 'your-payment-transaction-id'; $monerooPayment = new Moneroo\Payment(); $payment = $monerooPayment->get($transactionId); ``` -------------------------------- ### Get Available Payment Methods API Source: https://docs.moneroo.io/payments/available-methods Retrieve an up-to-date list of all available payment methods by calling the GET /utils/payment/methods endpoint. ```http GET /utils/payout/methods HTTP/1.1 Host: https://api.moneroo.io Accept: application/json ``` -------------------------------- ### Initialize Payment with cURL Source: https://docs.moneroo.io/payments/standard-integration Use this cURL command to initialize a payment. Ensure you replace YOUR_SECRET_KEY with your actual secret key. This request should be executed in the backend. ```bash curl -X POST https://api.moneroo.io/v1/payments/initialize \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_SECRET_KEY" \ -H "Accept: application/json" \ -d '{ "amount": 100, "currency": "USD", "description": "Payment for order #123", "customer": { "email": "john@example.com", "first_name": "John", "last_name": "Doe" }, "return_url": "https://example.com/payments/thank-you", "metadata": { "order_id": "123", "customer_id": "123" }, "methods": ["qr_ngn", "bank_transfer_ngn"] }' ``` -------------------------------- ### Initialize Payment with Python Source: https://docs.moneroo.io/payments/standard-integration This Python script uses the requests library to initialize a payment. Replace YOUR_SECRET_KEY with your actual secret key. It handles the API request and prints the checkout URL. ```python import requests import json url = 'https://api.moneroo.io/v1/payments/initialize' headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_SECRET_KEY' 'Accept': 'application/json' } data = { "amount": 100, "currency": "USD", "description": "Payment for order #123", "customer": { "email": "john@example.com", "first_name": "John", "last_name": "Doe" }, "return_url": "https://example.com/payments/thank-you", "metadata": { "order_id": "123", "customer_id": "123", }, "methods": ["qr_ngn", "bank_transfer_ngn"] } response = requests.post(url, headers=headers, data=json.dumps(data)) if response.status_code != 201: raise Exception(f"Request failed with status {response.status_code}") checkout_url = response.json()['checkout_url'] print(f"Redirect to: {checkout_url}") ``` -------------------------------- ### Retrieve Payment Details Source: https://docs.moneroo.io/sdks/php Fetch detailed information about a specific payment by providing its transaction ID to the `get` method. ```php $transactionId = 'your-payment-transaction-id'; $monerooPayment = new \Moneroo\Payment($secretKey); $payment = $monerooPayment->get($transactionId); ``` -------------------------------- ### Retrieve Payout Source: https://docs.moneroo.io/sdks/php Get details of a payout using its transaction ID. This method retrieves comprehensive information about a specific payout. ```APIDOC ## Retrieve Payout ### Description To get details of a payout, use the `get` method with the transaction ID. ### Parameters #### Path Parameters - **transactionId** (string) - Required - The unique identifier for the payout transaction. ### Request Example ```php $transactionId = 'your-payout-transaction-id'; $payout = new \Moneroo\Payout($secretKey); $payout = $payout->get($transactionId); ``` ### Response #### Success Response (200) The `get` method returns an object containing the detailed information of the specified payout. ``` -------------------------------- ### Initialize a Payout with PHP Source: https://docs.moneroo.io/sdks/php Pass an array of payout data, including amount, currency, customer details, method, and recipient-specific fields, to initialize a payout. Ensure all required fields for the chosen payout method are included. ```php $payoutData = [ 'amount' => 100, 'currency' => 'USD', 'customer' => [ 'email' => 'john.doe@example.com', 'first_name' => 'John', 'last_name' => 'Doe', // other customer details... ], 'description' => 'Salary payment', 'method' => 'mtn_bj', 'recipient' => [ 'msisdn' => '22912345678', // required field for mtn_bj payout method ], 'metadata' => [ 'payout_id' => '123', 'customer_id' => '456', ], ]; $monerooPayout = new Moneroo\Payout($secretKey); $payout = $monerooPayout->init($payoutData); ``` -------------------------------- ### Initialize Payment Source: https://docs.moneroo.io/payments/standard-integration This snippet shows how to initialize a payment by sending a POST request to the /v1/payments/initialize endpoint. It includes setting up request headers and handling the response, particularly extracting the checkout URL for redirection. ```APIDOC ## POST /v1/payments/initialize ### Description Initializes a payment transaction. This endpoint is used to create a new payment request and typically returns a URL to redirect the user to complete the payment. ### Method POST ### Endpoint https://api.moneroo.io/v1/payments/initialize ### Request Body - **amount** (number) - Required - The amount to be paid. - **currency** (string) - Required - The currency of the payment (e.g., 'USD', 'EUR'). - **reference** (string) - Optional - A unique reference for the payment. - **metadata** (object) - Optional - Additional data to be associated with the payment. ### Request Example ```json { "amount": 100.50, "currency": "USD", "reference": "ORDER12345", "metadata": { "customer_id": "cust_abc", "product": "Widget" } } ``` ### Headers - **Content-Type**: application/json - **Authorization**: Bearer YOUR_SECRET_KEY - **Accept**: application/json ### Response #### Success Response (201 Created) - **id** (string) - The unique identifier for the payment. - **checkout_url** (string) - The URL where the user can complete the payment. - **status** (string) - The current status of the payment. #### Response Example ```json { "id": "pay_12345abcde", "checkout_url": "https://checkout.moneroo.io/pay/xyz789", "status": "pending" } ``` ``` -------------------------------- ### Initialize Payout Request - Bash Source: https://docs.moneroo.io/payouts/initialize-payout Send a POST request to the Moneroo API to initialize a payout. Ensure you include all required fields such as amount, currency, description, customer details, method, and recipient-specific information. Authorize your request with your secret key. ```bash POST /v1/payouts/initialize Host: https://api.moneroo.io Authorization: Bearer YOUR_SECRET_KEY Content-Type: application/json Accept: application/json { "amount": 1000, "currency": "XOF", "description": "Order refund", "customer": { "email": "john@example.com", "first_name": "John", "last_name": "Doe" }, "metadata": { "payout_request": "123", "customer_id": "123" }, "method": "mtn_bj", "recipient" : { "msisdn" : "22951345020" } } ``` -------------------------------- ### Initialize Payout Request using cURL Source: https://docs.moneroo.io/payouts/initialize-payout Use this cURL command to send a POST request to initialize a payout. Ensure you replace YOUR_SECRET_KEY with your actual secret key. This request should be made from your backend. ```bash curl -X POST https://api.moneroo.io/v1/payouts/initialize \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_SECRET_KEY" \ -H "Accept: application/json" \ -d '{ "amount": 1000, "currency": "XOF", "description": "Order refund", "customer": { "email": "john@example.com", "first_name": "John", "last_name": "Doe" }, "metadata": { "payout_request": "123", "customer_id": "123" }, "method": "mtn_bj", "recipient" : { "msisdn" : "22951345020" } }' ``` -------------------------------- ### Webhook Payload Structure Source: https://docs.moneroo.io/introduction/webhooks This is an example of a typical webhook payload structure sent by Moneroo. It includes the event type and associated data, such as transaction details. ```json { "event": "payment.success", "data": { "id": "123456", "amount": 100, "currency": "USD", "status": "success", "customer": { "id": "123456", "email": "hello@example.com", "firstName": "John", "lastName": "Doe", "phone": "+1 555 555 5555" } } } ``` -------------------------------- ### Initialize Payment with Axios Source: https://docs.moneroo.io/payments/standard-integration Use this snippet to initialize a payment by sending a POST request to the Moneroo API. Ensure your secret key is correctly set in the Authorization header. Handles successful responses and errors. ```javascript const options = { headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_SECRET_KEY', 'Accept': 'application/json' } }; axios.post('https://api.moneroo.io/v1/payments/initialize', data, options) .then((response) => { if (response.status !== 201) { throw new Error(`Request failed with status ${response.status}`); } console.log(`Redirect to: ${response.data.checkout_url}`); }) .catch((error) => { console.error(error); }); ``` -------------------------------- ### Payment Transaction Response Example Source: https://docs.moneroo.io/payments/retrieve-payment This JSON object represents a successful response when fetching a payment transaction. The 'data' field contains the specific details of the transaction. ```json { "success": true, "message": "Payment transaction fetched successfully", "data": { "id": "abc123", "status": "success", "is_processed": true, "processed_at": "2023-05-21T12:00:00Z", "amount": 100.0, "currency": "USD", "amount_formatted": "$100.00", "description": "Purchase of goods", "return_url": "https://example.com/return", "environment": "production", "initiated_at": "2023-05-21T11:00:00Z", "checkout_url": "https://example.com/checkout", "payment_phone_number": "+1234567890", "app": { "id": "app1", "name": "Example App", "icon_url": "https://example.com/icon.png" }, "customer": { "id": "cust1", "first_name": "John", "last_name": "Doe", "email": "john.doe@example.com", "phone": "+1234567890", "address": "123 Main St", "city": "Springfield", "state": "IL", "country_code": "US", "country": "United States", "zip_code": "62701", "environment": "production", "created_at": "2023-01-01T00:00:00Z", "updated_at": "2023-05-21T00:00:00Z" }, "method": { "name": "Credit Card", "code": "cc", "icon_url": "https://example.com/cc.png", "environment": "production" }, "gateway": { "name": "Stripe", "account_name": "Acme Corp", "code": "stripe", "icon_url": "https://example.com/stripe.png", "environment": "production" }, "metadata": { "custom_field1": "custom_value1", "custom_field2": "custom_value2" }, "context": { "ip": "192.0.2.0", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537", "country": "US", "local": "en-US" } } } ``` -------------------------------- ### Verify Payout Transaction Request Source: https://docs.moneroo.io/payouts/verify-payout Use this GET request to verify a specific payout transaction by providing its ID. Ensure your secret key is included in the Authorization header. ```bash GET /v1/payouts/{payoutId}/verify HTTP/1.1 Host: https://api.moneroo.io Authorization: Bearer YOUR_SECRET_KEY Content-Type: application/json Accept: application/json ``` -------------------------------- ### Retrieve Payment Transaction (Go) Source: https://docs.moneroo.io/payments/retrieve-payment This Go program demonstrates fetching a payment transaction using the `net/http` package. It constructs the request, sets the authorization header, and handles both successful and error responses. ```go package main import ( "fmt" "net/http" "io/ioutil" ) func main() { paymentPublicID := "your_payment_public_id" token := "your_token" url := fmt.Sprintf("https://api.moneroo.io/v1/payments/%s", paymentPublicID) req, err := http.NewRequest("GET", url, nil) if err != nil { // Handle error } req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) client := &http.Client{} resp, err := client.Do(req) if err != nil { // Handle error } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { // Handle error } if resp.StatusCode == 200 { // Handle successful response and retrieve the payment transaction details } else { // Handle error response } } ``` -------------------------------- ### Retrieve Payout Details with PHP Source: https://docs.moneroo.io/sdks/php Fetch detailed information about a specific payout by providing its transaction ID to the `get` method. This allows you to retrieve the payout's current status and other relevant data. ```php $transactionId = 'your-payout-transaction-id'; $payout = new \Moneroo\Payout($secretKey); $payout = $payout->get($transactionId); ``` -------------------------------- ### Initialize Payment Source: https://docs.moneroo.io/sdks/laravel Creates a new payment by passing an array of payment data to the `init` method. The method returns an object containing payment details, including a checkout URL for the customer. ```APIDOC ## Initialize Payment To create a payment, you need to pass an array of payment data to the `init` method. The array must contain the following keys: ### Parameters #### Request Body - **amount** (integer) - Required - The payment amount. - **currency** (string) - Required - The currency of the payment. - **description** (string) - Optional - Description of the payment. - **return_url** (string) - Required - Callback URL for payment updates. - **customer.email** (string) - Required - Customer's email address. - **customer.first_name** (string) - Required - Customer's first name. - **customer.last_name** (string) - Required - Customer's last name. - **customer.phone** (string) - Optional - Customer's phone number. If not provided, the customer can be prompted to enter these details during the payment process. - **customer.address** (string) - Optional - Customer's address. If not provided, the customer can be prompted to enter these details during the payment process. - **customer.city** (string) - Optional - Customer's city. If not provided, the customer can be prompted to enter these details during the payment process. - **customer.state** (string) - Optional - Customer's state. If not provided, the customer can be prompted to enter these details during the payment process. - **customer.country** (string) - Optional - Customer's country. If not provided, the customer can be prompted to enter these details during the payment process. - **customer.zip** (string) - Optional - Customer's zip code. If not provided, the customer can be prompted to enter these details during the payment process. - **metadata** (array) - Optional - Additional data for the payment. Should be an array of key-value pairs with string values only. - **methods** (array) - Optional - Allowed payment methods. If not provided, all available payment methods will be allowed. Array should contain only supported payment methods. ### Request Example ```php $paymentData = [ 'amount' => 100, 'currency' => 'USD', 'customer' => [ 'email' => 'john.doe@example.com', 'first_name' => 'John', 'last_name' => 'Doe', 'phone' => '123456789', 'address' => '123 Main St', 'city' => 'Los Angeles', 'state' => 'CA', 'country' => 'USA', 'zip' => '90001', ], 'description' => 'Payment for order #123', 'return_url' => 'https://yourwebsite.com/thanks', 'metadata' => [ 'order_id' => '123', 'customer_id' => '456', ], 'methods' => ['card', 'orange_ci'], ]; $monerooPayment = new Moneroo\Payment(); $payment = $monerooPayment->init($paymentData); // Redirect the customer to the Checkout URL header('Location: ' . $payment->checkout_url); ``` ### Response #### Success Response (200) The response object contains payment details, including `transaction_id` and `checkout_url`. ``` -------------------------------- ### Initialize Payment Source: https://docs.moneroo.io/payments/standard-integration Call this endpoint from your server to initialize a payment. Provide the payment details in the request body. Authorization is done via a Bearer token. ```APIDOC ## POST /v1/payments/initialize ### Description Initializes a payment transaction and returns a link to the payment page. ### Method POST ### Endpoint https://api.moneroo.io/v1/payments/initialize ### Parameters #### Request Body - **amount** (integer) - Required - The payment amount. - **currency** (string) - Required - The currency of the payment. - **description** (string) - Required - Description of the payment. - **return_url** (string) - Required - Return URL where your customer will be redirected after payment. - **customer.email** (string) - Required - Customer's email address. - **customer.first_name** (string) - Required - Customer's first name. - **customer.last_name** (string) - Required - Customer's last name. - **customer.phone** (string) - Optional - Customer's phone number. - **customer.address** (string) - Optional - Customer's address. - **customer.city** (string) - Optional - Customer's city. - **customer.state** (string) - Optional - Customer's state. - **customer.country** (string) - Optional - Customer's country. - **customer.zip** (string) - Optional - Customer's zip code. - **metadata** (array) - Optional - Additional data for the payment. Should be an array of key-value pairs with string values. - **methods** (array) - Optional - Payment methods to make available. Should contain supported payment method shortcodes. - **restrict_country_code** (string) - Optional - Restrict the payment to a specific country. - **restricted_phone** (object) - Optional - Restrict the payment to a specific phone number. - **restricted_phone.number** (string) - Required if `restricted_phone` is provided - The phone number to restrict the payment to. - **restricted_phone.country_code** (string) - Required if `restricted_phone` is provided - The country code of the restricted phone number. ### Request Example ```json { "amount": 100, "currency": "USD", "description": "Payment for order #123", "customer": { "email": "john@example.com", "first_name": "John", "last_name": "Doe" }, "return_url": "https://example.com/payments/thank-you", "metadata": { "order_id": "123", "customer_id": "123" }, "methods": ["mtn_bj", "moov_bj"] } ``` ### Response #### Success Response (200) - **message** (string) - Confirmation message. - **data** (object) - Contains payment details. - **id** (string) - The unique identifier for the transaction. - **checkout_url** (string) - The URL to redirect the customer to for payment. #### Response Example ```json { "message": "Transaction initialized successfully", "data": { "id": "5f7b1b2c", "checkout_url": "https://checkout.moneroo.io/5f7b1b2c" } } ``` ``` -------------------------------- ### Verify Payout Transaction Source: https://docs.moneroo.io/payouts/verify-payout You can verify a payout transaction by making a GET request to the /v1/payouts/{payoutId}/verify endpoint. Replace `{payoutId}` with the actual payout transaction ID and `YOUR_TOKEN` with your API key. ```APIDOC ## GET /v1/payouts/{payoutId}/verify ### Description Verifies the status and details of a specific payout transaction. ### Method GET ### Endpoint /v1/payouts/{payoutId}/verify ### Parameters #### Path Parameters - **payoutId** (string) - Required - The unique identifier of the payout transaction. #### Headers - **Authorization** (string) - Required - Bearer token for authentication. Example: `Bearer YOUR_TOKEN` ### Response #### Success Response (200) Returns a JSON object containing the payout transaction details if found and verified. ```json { "message": "Payout transaction fetched successfully!", "data": { "id": "go86j8csuq51", "status": "success", "amount": 500, "currency": { "name": "US Dollar", "symbol": "$", "symbol_first": true, "decimals": 2, "decimal_mark": ".", "thousands_separator": ",", "subunit": "Cent", "subunit_to_unit": 100, "symbol_native": "$", "decimal_digits": 2, "rounding": 0, "code": "USD", "name_plural": "US dollars", "icon_url": "https://assets.cdn.moneroo.io/currencies/USD.svg" }, "amount_formatted": "$ 500.00", "description": "hello", "environment": "sandbox", "metadata": [], "app": { "id": "01HHJYSA4VCBVKN4KTYF76J", "name": "Smarte", "website_url": "https://www.smarthome.com", "icon_url": "https://assets.cdn.moneroo.io/samples/business.svg", "created_at": "2023-12-14T01:24:17.000000Z", "updated_at": "2023-12-14T01:24:17.000000Z", "is_enabled": false }, "customer": { "id": "fsbh12wot2c3", "first_name": "John", "last_name": "Doe", "email": "john@test.com", "phone": null, "address": null, "city": null, "state": null, "country_code": null, "country": null, "zip_code": null, "profile_url": "https://eu.ui-avatars.com/api/?name=John+Dow&background=ffcc00&color=fff&size=256&rounded=true&bold=true", "created_at": "2023-12-22T01:00:37.000000Z", "updated_at": "2024-01-08T13:09:23.000000Z" }, "disburse": { "id": "0nj13p3bheje", "identifier": "pd_65miz6qf4u9y", "failure_message": null, "failure_error_code": null, "failure_error_type": null, "method": { "id": "6zyu010zn6wo", "name": "Test Payout Method", "short_code": "moneroo_payout_demo", "icon_url": "https://assets.cdn.moneroo.io/icons/circle/moneroo.svg" }, "gateway": { "id": "8heokxp8yyxj", "account_name": "Moneroo Test Payout Gateway" } } } } ``` ```