### E-Wallet Success Response Example Source: https://tripay.co.id/developer Example of a successful response when retrieving e-wallet details, including balance and currency. ```json { "success": true, "data": { "wallet_type": "DANA", "mobile_phone": "08123456789", "balance": "100000.00", "currency": "IDR" } } ``` -------------------------------- ### Get Payment Instruction (Node.js) Source: https://tripay.co.id/developer A Node.js example using the Axios library to fetch payment instructions. It configures Axios to ignore HTTP errors for custom handling. ```javascript const axios = require('axios'); // using Axios library var apiKey = "api_key_anda"; axios.get('https://tripay.co.id/api/payment/instruction?code=BRIVA', { headers: { 'Authorization': 'Bearer ' + apiKey }, validateStatus: function (status) { return status < 999; // ignore http error } }) .then((res) => { console.log(res) }) .catch((error) => { console.error(error) }); ``` -------------------------------- ### Get Payment Channels (NodeJS) Source: https://tripay.co.id/developer This NodeJS example utilizes the Axios library to make a GET request to the Tripay API for payment channels. It demonstrates setting headers and handling responses. ```javascript const axios = require('axios') // using Axios library var apiKey = "api_key_anda"; axios.get('https://tripay.co.id/api/merchant/payment-channel', { headers: {'Authorization': 'Bearer ' + apiKey }, validateStatus: function (status) { return status < 999; // ignore http error } }) .then((res) => { console.log(res) }) .catch((error) => { console.error(error) }); ``` -------------------------------- ### Check Transaction Status with NodeJS Source: https://tripay.co.id/developer This NodeJS example uses the Axios library to make a GET request to check transaction status. Ensure Axios is installed. ```javascript const axios = require('axios') // using Axios library var apiKey = "api_key_anda"; axios.get('https://tripay.co.id/api/transaction/check-status?reference=T0001000000455HFGRY', { headers: { 'Authorization': 'Bearer ' + apiKey }, validateStatus: function (status) { return status < 999; // ignore http error } }) .then((res) => { console.log(res) }) .catch((error) => { console.error(error) }); ``` -------------------------------- ### Get Merchant Transactions (NodeJS) Source: https://tripay.co.id/developer This NodeJS example uses the Axios library to make a GET request for merchant transactions. It demonstrates setting the Authorization header and handling responses or errors. ```javascript const axios = require('axios') // using Axios library var apiKey = "api_key_anda"; axios.get('https://tripay.co.id/api/merchant/transactions?page=1&per_page=25', { headers: { 'Authorization': 'Bearer ' + apiKey }, validateStatus: function (status) { return status < 999; // ignore http error } }) .then((res) => { console.log(res) }) .catch((error) => { console.error(error) }); ``` -------------------------------- ### Get Transaction Detail (Node.js) Source: https://tripay.co.id/developer This Node.js example uses the Axios library to make a GET request to the Tripay API for transaction details. Remember to replace 'api_key_anda' with your actual API key. ```javascript const axios = require('axios'); // using Axios library var apiKey = "api_key_anda"; var reference = "T0001000000000000006"; axios.get('https://tripay.co.id/api/transaction/detail?reference=' + reference, { headers: { 'Authorization': 'Bearer ' + apiKey }, validateStatus: function (status) { return status < 999; // ignore http error } }) .then((res) => { console.log(res) }) .catch((error) => { console.error(error) }); ``` -------------------------------- ### API Response Examples Source: https://tripay.co.id/developer?tab=channels These are example responses from the E-Wallet unlink API. The first shows a successful unlinking, while the second indicates a failure in processing the request. ```json { "success": true, "message": "Account has been unlinked" } ``` ```json { "success": false, "message": "Failed to process your request. Please try again" } ``` -------------------------------- ### E-Wallet Failure Response Example Source: https://tripay.co.id/developer Illustrates a failed response when e-wallet details cannot be fetched, providing a reason for the failure. ```json { "success": false, "message": "Failed to fetch data. Make sure the account is linked and try again" } ``` -------------------------------- ### Tripay API Success Response Example Source: https://tripay.co.id/developer?tab=channels This is an example of a successful response from the Tripay API, detailing virtual account information. It includes details like group, code, name, fees, and active status. ```json { "success": true, "message": "Success", "data": [ { "group": "Virtual Account", "code": "MYBVA", "name": "Maybank Virtual Account", "type": "direct", "fee_merchant": { "flat": 4250, "percent": 0 }, "fee_customer": { "flat": 0, "percent": 0 }, "total_fee": { "flat": 4250, "percent": "0.00" }, "minimum_fee" : 4000, "maximum_fee" : 4500, "minimum_amount" : 10000, "maximum_amount" : 10000000, "icon_url": "https://tripay.co.id/xxxxxxxxx.png", "active": true }, { "group": "Virtual Account", "code": "PERMATAVA", "name": "Permata Virtual Account", "type": "direct", "fee_merchant": { "flat": 4250, "percent": 0 }, "fee_customer": { "flat": 0, "percent": 0 }, "total_fee": { "flat": 4250, "percent": "0.00" }, "minimum_fee" : 4000, "maximum_fee" : 4500, "minimum_amount" : 10000, "maximum_amount" : 10000000, "icon_url": "https://tripay.co.id/xxxxxxxxx.png", "active": true }, { "group": "Virtual Account", "code": "BNIVA", "name": "BNI Virtual Account", "type": "direct", "fee_merchant": { "flat": 4250, "percent": 0 }, "fee_customer": { "flat": 0, "percent": 0 }, "total_fee": { "flat": 4250, "percent": "0.00" }, "minimum_fee" : 4000, "maximum_fee" : 4500, "minimum_amount" : 10000, "maximum_amount" : 10000000, "icon_url": "https://tripay.co.id/xxxxxxxxx.png", "active": true }, { "group": "Virtual Account", "code": "BRIVA", "name": "BRI Virtual Account", "type": "direct", "fee_merchant": { "flat": 4250, "percent": 0 }, "fee_customer": { "flat": 0, "percent": 0 }, "total_fee": { "flat": 4250, "percent": "0.00" }, "minimum_fee" : 4000, "maximum_fee" : 4500, "minimum_amount" : 10000, "maximum_amount" : 10000000, "icon_url": "https://tripay.co.id/xxxxxxxxx.png", "active": true }, { "group": "Virtual Account", "code": "MANDIRIVA", "name": "Mandiri Virtual Account", "type": "direct", "fee_merchant": { "flat": 4250, "percent": 0 }, "fee_customer": { "flat": 0, "percent": 0 }, "total_fee": { "flat": 4250, "percent": "0.00" }, "minimum_fee" : 4000, "maximum_fee" : 4500, "minimum_amount" : 10000, "maximum_amount" : 10000000, "icon_url": "https://tripay.co.id/xxxxxxxxx.png", "active": true }, { "group": "Virtual Account", "code": "BCAVA", "name": "BCA Virtual Account", "type": "direct", "fee_merchant": { "flat": 5500, "percent": 0 }, "fee_customer": { "flat": 0, "percent": 0 }, "total_fee": { "flat": 5500, "percent": "0.00" }, "minimum_fee" : 5500, "maximum_fee" : 6000, "minimum_amount" : 10000, "maximum_amount" : 10000000, "icon_url": "https://tripay.co.id/xxxxxxxxx.png", "active": true }, { "group": "Virtual Account", "code": "SMSVA", "name": "Sinarmas Virtual Account", "type": "direct", "fee_merchant": { "flat": 4250, "percent": 0 }, "fee_customer": { "flat": 0, "percent": 0 }, "total_fee": { "flat": 4250, "percent": "0.00" }, "minimum_fee" : 4000, "maximum_fee" : 4500, "minimum_amount" : 10000, "maximum_amount" : 10000000, "icon_url": "https://tripay.co.id/xxxxxxxxx.png", "active": true }, { "group": "Virtual Account", "code": "MUAMALATVA", "name": "Muamalat Virtual Account", "type": "direct", "fee_merchant": { "flat": 4250, "percent": 0 }, "fee_customer": { "flat": 0, "percent": 0 }, "total_fee": { "flat": 4250, "percent": "0.00" }, "minimum_fee" : 4000, "maximum_fee" : 4500, "minimum_amount" : 10000, "maximum_amount" : 10000000, "icon_url": "https://tripay.co.id/xxxxxxxxx.png", "active": true }, { "group": "Virtual Account", "code": "CIMBVA", "name": "CIMB Virtual Account", "type": "direct", "fee_merchant": { "flat": 4250, "percent": 0 }, "fee_customer": { "flat": 0, "percent": 0 }, "total_fee": { "flat": 4250, "percent": "0.00" }, "minimum_fee" : 4000, "maximum_fee" : 4500, "minimum_amount" : 10000, "maximum_amount" : 10000000, "icon_url": "https://tripay.co.id/xxxxxxxxx.png", "active": true } ] } ``` -------------------------------- ### Tripay API Success Response Source: https://tripay.co.id/developer Example of a successful response when retrieving open payment details. ```JSON { "success": true, "message": "", "data": { "uuid": "T0001OP9376HnpS", "merchant_ref": "INV345675", "customer_name": "Nama Pelanggan", "payment_name": "BCA Virtual Account", "payment_method": "BCAVA", "pay_code": "1234567890", "qr_string": null, "qr_url": null } } ``` -------------------------------- ### Handle Callback with PHP (Native) Source: https://tripay.co.id/developer This native PHP example demonstrates how to receive, validate the signature, and process payment status updates from a callback. Ensure your database connection and private key are correctly configured. ```php false, 'message' => 'Invalid signature', ])); } $data = json_decode($json); if (JSON_ERROR_NONE !== json_last_error()) { exit(json_encode([ 'success' => false, 'message' => 'Invalid data sent by payment gateway', ])); } // Hentikan proses jika callback event-nya bukan payment_status if ('payment_status' !== $_SERVER['HTTP_X_CALLBACK_EVENT']) { exit(json_encode([ 'success' => false, 'message' => 'Unrecognized callback event: ' . $_SERVER['HTTP_X_CALLBACK_EVENT'], ])); } $invoiceId = $db->real_escape_string($data->merchant_ref); $tripayReference = $db->real_escape_string($data->reference); $status = strtoupper((string) $data->status); if ($data->is_closed_payment === 1) { $result = $db->query("SELECT * FROM tbl_invoices WHERE id = '{$invoiceId}' AND tripay_reference = '{$tripayReference}' AND status = 'UNPAID' LIMIT 1"); if (! $result) { exit(json_encode([ 'success' => false, 'message' => 'Invoice not found or already paid: ' . $invoiceId, ])); } while ($invoice = $result->fetch_object()) { switch ($status) { // handle status PAID case 'PAID': if (! $db->query("UPDATE tbl_invoices SET status = 'PAID' WHERE id = {$invoice->id}")) { exit(json_encode([ 'success' => false, 'message' => $db->error, ])); } break; // handle status EXPIRED case 'EXPIRED': if (! $db->query("UPDATE tbl_invoices SET status = 'EXPIRED' WHERE id = {$invoice->id}")) { exit(json_encode([ 'success' => false, 'message' => $db->error, ])); } break; // handle status FAILED case 'FAILED': if (! $db->query("UPDATE tbl_invoices SET status = 'FAILED' WHERE id = {$invoice->id}")) { exit(json_encode([ 'success' => false, 'message' => $db->error, ])); } break; default: exit(json_encode([ 'success' => false, 'message' => 'Unrecognized payment status', ])); } exit(json_encode(['success' => true])); } } ``` -------------------------------- ### Create Transaction with Python Source: https://tripay.co.id/developer This Python script demonstrates how to create a transaction using the Tripay API. It includes setting up API keys, merchant details, and transaction parameters, then generating a signature and sending the request. Ensure you complete the `order_items` list with your product details. ```python import requests import time import hmac import hashlib try: apiKey = "api_key_anda" privateKey = "private_key_anda" merchant_code = "T0001" merchant_ref = "INV345675" amount = 1000000 expiry = int(time.time() + (24*60*60)) # 24 jam signStr = "{}{}{}".format(merchant_code, merchant_ref, amount) signature = hmac.new(bytes(privateKey,'latin-1'), bytes(signStr,'latin-1'), hashlib.sha256).hexdigest() payload = { 'method': 'BRIVA', 'merchant_ref': merchant_ref, 'amount': amount, 'customer_name': 'Nama Pelanggan', 'customer_email': 'emailpelanggan@domain.com', 'customer_phone': '081234567890', 'return_url': 'https://domainanda.com/redirect', 'expired_time': expiry, 'signature': signature } order_items = [ { 'sku': 'PRODUK1', 'name': 'Nama Produk 1', 'price': 500000, 'quantity': 1, 'product_url': 'https://tokokamu.com/product/nama-produk-1', 'image_url': 'https://tokokamu.com/product/nama-produk-1.jpg' }, { 'sku': 'PRODUK2', 'name': 'Nama Produk 2', 'price': 500000, 'quantity': 1, ``` -------------------------------- ### Get Payment Instruction (Python) Source: https://tripay.co.id/developer This Python script demonstrates how to request payment instructions using the requests library. It includes error handling for network issues and invalid responses. ```python import requests apiKey = "api_key_anda" try: payload = { "code": "BRIVA" } headers = { "Authorization": "Bearer " + apiKey } result = requests.get(url="https://tripay.co.id/api/payment/instruction", params=payload, headers=headers) response = result.text print(response) except Exception as e: print("Request Error: " + str(e)) ``` -------------------------------- ### Handle Tripay Callback with PHP (Native) Source: https://tripay.co.id/developer?tab=channels This native PHP example demonstrates how to receive, validate the signature, and process a payment status callback from Tripay. It includes database interaction for updating invoice statuses. ```php false, 'message' => 'Invalid signature', ])); } $data = json_decode($json); if (JSON_ERROR_NONE !== json_last_error()) { exit(json_encode([ 'success' => false, 'message' => 'Invalid data sent by payment gateway', ])); } // Hentikan proses jika callback event-nya bukan payment_status if ('payment_status' !== $_SERVER['HTTP_X_CALLBACK_EVENT']) { exit(json_encode([ 'success' => false, 'message' => 'Unrecognized callback event: ' . $_SERVER['HTTP_X_CALLBACK_EVENT'], ])); } $invoiceId = $db->real_escape_string($data->merchant_ref); $tripayReference = $db->real_escape_string($data->reference); $status = strtoupper((string) $data->status); if ($data->is_closed_payment === 1) { $result = $db->query("SELECT * FROM tbl_invoices WHERE id = '{$invoiceId}' AND tripay_reference = '{$tripayReference}' AND status = 'UNPAID' LIMIT 1"); if (! $result) { exit(json_encode([ 'success' => false, 'message' => 'Invoice not found or already paid: ' . $invoiceId, ])); } while ($invoice = $result->fetch_object()) { switch ($status) { // handle status PAID case 'PAID': if (! $db->query("UPDATE tbl_invoices SET status = 'PAID' WHERE id = {$invoice->id}")) { exit(json_encode([ 'success' => false, 'message' => $db->error, ])); } break; // handle status EXPIRED case 'EXPIRED': if (! $db->query("UPDATE tbl_invoices SET status = 'EXPIRED' WHERE id = {$invoice->id}")) { exit(json_encode([ 'success' => false, 'message' => $db->error, ])); } break; // handle status FAILED case 'FAILED': if (! $db->query("UPDATE tbl_invoices SET status = 'FAILED' WHERE id = {$invoice->id}")) { exit(json_encode([ 'success' => false, 'message' => $db->error, ])); } break; default: exit(json_encode([ 'success' => false, 'message' => 'Unrecognized payment status', ])); } exit(json_encode(['success' => true])); } } ``` -------------------------------- ### Get Channel Fee Details Source: https://tripay.co.id/developer?tab=channels This API is used to get the transaction fee calculation details for each channel based on the determined amount. ```APIDOC ## Get Channel Fee Details ### Description This endpoint retrieves detailed transaction fee calculations for various payment channels, considering the specified transaction amount. ### Method GET ### Endpoint `/channels/fee-details` ### Query Parameters - **amount** (integer) - Required - The transaction amount for which to calculate fees. ### Response #### Success Response (200) - **group** (string) - The category of the payment channel (e.g., "Virtual Account", "Convenience Store", "E-Wallet"). - **code** (string) - The unique code identifying the payment channel. - **name** (string) - The display name of the payment channel. - **type** (string) - The type of the channel (e.g., "direct"). - **fee_merchant** (object) - Fee details for the merchant. - **flat** (integer) - Flat fee amount for the merchant. - **percent** (float) - Percentage fee for the merchant. - **fee_customer** (object) - Fee details for the customer. - **flat** (integer) - Flat fee amount for the customer. - **percent** (float) - Percentage fee for the customer. - **total_fee** (object) - Total fee details. - **flat** (integer) - Total flat fee amount. - **percent** (string) - Total percentage fee. - **minimum_fee** (integer) - The minimum fee applicable for this channel. - **maximum_fee** (integer) - The maximum fee applicable for this channel. - **minimum_amount** (integer) - The minimum transaction amount for this channel. - **maximum_amount** (integer) - The maximum transaction amount for this channel. - **icon_url** (string) - URL for the channel's icon. - **active** (boolean) - Indicates if the channel is currently active. ### Response Example ```json [ { "group": "Virtual Account", "code": "BCA", "name": "BCA Virtual Account", "type": "direct", "fee_merchant": { "flat": 4000, "percent": 0 }, "fee_customer": { "flat": 0, "percent": 0 }, "total_fee": { "flat": 4000, "percent": "0.00" }, "minimum_fee" : 4000, "maximum_fee" : 4500, "minimum_amount" : 10000, "maximum_amount" : 10000000, "icon_url": "https://tripay.co.id/xxxxxxxxx.png", "active": true } ] ``` ### Error Handling #### Error Response (401) - **success** (boolean) - Indicates if the request was successful. - **message** (string) - Error message describing the issue (e.g., "Invalid API Key"). ```json { "success": false, "message": "Invalid API Key" } ``` ``` -------------------------------- ### Create Open Payment Transaction (Python) Source: https://tripay.co.id/developer This Python script demonstrates how to create an open payment transaction. It uses the `requests` library for HTTP calls and `hmac` with `hashlib` for signature generation. Remember to replace placeholder credentials. ```python import requests import time import hmac import hashlib try: apiKey = "api_key_anda" privateKey = "private_key_anda" merchant_code = "T0001" merchant_ref = "INV345678" method = "BCAVA" signStr = "{}{}{}".format(merchant_code, method, merchant_ref) signature = hmac.new(bytes(privateKey,'latin-1'), bytes(signStr,'latin-1'), hashlib.sha256).hexdigest() payload = { 'method': method, 'merchant_ref': merchant_ref, 'customer_name': 'Nama Pelanggan', 'signature': signature } headers = { "Authorization": "Bearer " + apiKey } result = requests.post(url="https://tripay.co.id/api/open-payment/create", data=payload, headers=headers) response = result.text print(response) except Exception as e: print("Request Error: " + str(e)) ``` -------------------------------- ### Get Payment Channels (PHP) Source: https://tripay.co.id/developer Use this PHP snippet to make a GET request to the Tripay API to retrieve a list of payment channels. Ensure your API key is correctly set. ```php true, CURLOPT_URL => 'https://tripay.co.id/api/merchant/payment-channel', CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_HTTPHEADER => ['Authorization: Bearer '.$apiKey], CURLOPT_FAILONERROR => false, CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4 )); $response = curl_exec($curl); $error = curl_error($curl); curl_close($curl); echo empty($error) ? $response : $error; ?> ``` -------------------------------- ### Generate E-Wallet Link Request (Python) Source: https://tripay.co.id/developer This Python script demonstrates how to create an E-Wallet link using the Tripay API. It utilizes the `requests` library for HTTP calls and `hmac` for signature generation. Remember to substitute the placeholder credentials. ```python import requests import time import hmac import hashlib try: apiKey = "api_key_anda" privateKey = "private_key_anda" merchantCode = "kode_merchant_anda" walletType = "DANA" mobilePhone = "08123456789" expiry = int(time.time() + (24*60*60)) # 24 jam signStr = "{}{}{}".format(merchantCode, walletType, mobilePhone) signature = hmac.new(bytes(privateKey,'latin-1'), bytes(signStr,'latin-1'), hashlib.sha256).hexdigest() payload = { 'wallet_type': walletType, 'mobile_phone': mobilePhone, 'signature': signature } headers = { "Authorization": "Bearer " + apiKey } result = requests.post(url="https://tripay.co.id/api/ewallet/link", data=payload, headers=headers) response = result.text print(response) except Exception as e: print("Request Error: " + str(e)) ``` -------------------------------- ### Get E-Wallet Detail Source: https://tripay.co.id/developer?tab=channels This API is used to retrieve details of an e-wallet. ```APIDOC ## GET /api/ewallet/detail ### Description This endpoint retrieves the details of a specified e-wallet, including its type and associated mobile phone number. ### Method GET ### Endpoint https://tripay.co.id/api/ewallet/detail ### Parameters #### Query Parameters - **wallet_type** (string) - Required - The type of e-wallet (e.g., DANA). - **mobile_phone** (string) - Required - The mobile phone number associated with the e-wallet. #### Headers - **Authorization** (string) - Required - Bearer {api_key}. Replace {api_key} with your actual API key. ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **data** (object) - Contains the e-wallet details. - **wallet_type** (string) - The type of e-wallet. - **mobile_phone** (string) - The associated mobile phone number. - **balance** (string) - The current balance of the e-wallet. - **currency** (string) - The currency of the balance. #### Response Example (Success) ```json { "success": true, "data": { "wallet_type": "DANA", "mobile_phone": "08123456789", "balance": "100000.00", "currency": "IDR" } } ``` #### Response Example (Failure) ```json { "success": false, "message": "Failed to fetch data. Make sure the account is linked and try again" } ``` ``` -------------------------------- ### Create Transaction with JavaScript (Axios) Source: https://tripay.co.id/developer This JavaScript snippet demonstrates how to create a transaction using the Axios library. It includes generating a signature and setting up the request payload for the Tripay API. ```javascript const axios = require('axios'); // using Axios library const crypto = require('crypto'); var apiKey = "api_key_anda"; var privateKey = "private_key_anda"; var merchant_code = "T0001"; var merchant_ref = "INV345675"; var amount = 1000000; var expiry = parseInt(Math.floor(new Date()/1000) + (24*60*60)); # 24 jam var signature = crypto.createHmac('sha256', privateKey) .update(merchant_code + merchant_ref + amount) .digest('hex'); var payload = { 'method': 'BRIVA', 'merchant_ref': merchant_ref, 'amount': amount, 'customer_name': 'Nama Pelanggan', 'customer_email': 'emailpelanggan@domain.com', 'customer_phone': '081234567890', 'order_items': [ { 'sku': 'PRODUK1', 'name': 'Nama Produk 1', 'price': 500000, 'quantity': 1, 'product_url': 'https://tokokamu.com/product/nama-produk-1', 'image_url': 'https://tokokamu.com/product/nama-produk-1.jpg' }, { 'sku': 'PRODUK2', 'name': 'Nama Produk 2', 'price': 500000, 'quantity': 1, 'product_url': 'https://tokokamu.com/product/nama-produk-2', 'image_url': 'https://tokokamu.com/product/nama-produk-2.jpg' } ], 'return_url': 'https://domainanda.com/redirect', 'expired_time': expiry, 'signature': signature } axios.post('https://tripay.co.id/api/transaction/create', payload, { headers: { 'Authorization': 'Bearer ' + apiKey }, validateStatus: function (status) { return status < 999; // ignore http error } }) .then((res) => { console.log(res) }) .catch((error) => { console.error(error) }); ``` -------------------------------- ### Generate E-Wallet Link Request (NodeJS) Source: https://tripay.co.id/developer This NodeJS example uses the Axios library to make a POST request to the Tripay API for creating an E-Wallet link. The crypto module is used for generating the SHA256 HMAC signature. Replace the placeholder values with your credentials. ```javascript const axios = require('axios'); // using Axios library const crypto = require('crypto'); var apiKey = "api_key_anda"; var privateKey = "private_key_anda"; var merchantCode = "kode_merchant_anda"; var walletType = "DANA"; var mobilePhone = "08123456789"; var signature = crypto.createHmac('sha256', privateKey) .update(merchantCode + walletType + mobilePhone) .digest('hex'); var payload = { 'wallet_type': walletType, 'mobile_phone': mobilePhone, 'signature': signature } axios.post('https://tripay.co.id/api/ewallet/link', payload, { headers: { 'Authorization': 'Bearer ' + apiKey }, validateStatus: function (status) { return status < 999; // ignore http error } }) .then((res) => { console.log(res) }) .catch((error) => { console.error(error) }); ``` -------------------------------- ### Get Merchant Transactions Source: https://tripay.co.id/developer Retrieve a list of merchant transactions with various filtering and pagination options. ```APIDOC ## GET /api/merchant/transactions ### Description Retrieves a list of merchant transactions. Supports filtering by reference, merchant reference, payment method, and status, along with pagination and sorting. ### Method GET ### Endpoint https://tripay.co.id/api/merchant/transactions ### Parameters #### Query Parameters - **page** (int) - Optional - The page number for pagination. Defaults to 1. - **per_page** (int) - Optional - The number of records per page. Maximum is 50. - **sort** (string) - Optional - Sorting order. `asc` for oldest to newest, `desc` for newest to oldest. - **reference** (string) - Optional - Filter by transaction reference number. - **merchant_ref** (string) - Optional - Filter by merchant reference/invoice number. - **method** (string) - Optional - Filter by payment channel code. - **status** (string) - Optional - Filter by payment status (e.g., `PAID`). ### Request Example ```json { "page": 1, "per_page": 25 } ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **message** (string) - A message describing the result of the request. - **data** (array) - An array of transaction objects. - **reference** (string) - The unique transaction reference. - **merchant_ref** (string) - The merchant's reference number. - **payment_method** (string) - The payment method used. - **amount** (number) - The transaction amount. - **status** (string) - The current status of the transaction. - **created_at** (integer) - Timestamp of when the transaction was created. - **expired_at** (integer) - Timestamp of when the transaction expires. - **pagination** (object) - Pagination details. - **current_page** (integer) - The current page number. - **last_page** (integer) - The last page number. - **per_page** (integer) - The number of records per page. - **total_records** (integer) - The total number of records. #### Response Example ```json { "success": true, "message": "Success", "data": [ { "reference": "T015100000358440000", "merchant_ref": "INV123", "payment_selection_type": "static", "payment_method": "MYBVA", "payment_name": "Maybank Virtual Account", "customer_name": "Nama Customer", "customer_email": "emailcustomer@gmail.com", "customer_phone": null, "callback_url": null, "return_url": null, "amount": 153750, "fee_merchant": 3750, "fee_customer": 0, "total_fee": 3750, "amount_received": 150000, "pay_code": 45649878666155, "pay_url": null, "checkout_url": "https://tripay.co.id/checkout/T015100000358440000", "order_items": [ { "sku": null, "name": "T-Shirt", "price": 150000, "quantity": 1, "subtotal": 150000 } ], "status": "UNPAID", "note": null, "created_at": 1592381058, "expired_at": 1592388303, "paid_at": null } ], "pagination": { "sort": "desc", "offset": { "from": 1, "to": 1 }, "current_page": 1, "previous_page": null, "next_page": null, "last_page": 1, "per_page": 25, "total_records": 1 } } ``` #### Error Response (e.g., 401 Unauthorized) ```json { "success": false, "message": "Invalid API Key" } ``` ``` -------------------------------- ### Tripay API Success Response Source: https://tripay.co.id/developer This is an example of a successful response from the Tripay API, detailing transaction information. ```json { "success": true, "message": "", "data": { "reference": "T0001000000000000006", "merchant_ref": "INV345675", "payment_selection_type": "static", "payment_method": "BRIVA", "payment_name": "BRI Virtual Account", "customer_name": "Nama Pelanggan", "customer_email": "emailpelanggan@domain.com", "customer_phone": "081234567890", "callback_url": "https://domainanda.com/callback", "return_url": "https://domainanda.com/redirect", "amount": 1000000, "fee_merchant": 1500, "fee_customer": 0, "total_fee": 1500, "amount_received": 998500, "pay_code": "57585748548596587", "pay_url": null, "checkout_url": "https://tripay.co.id/checkout/T0001000000000000006", "status": "PAID", "paid_at": "1582856000", "expired_time": 1582855837, "order_items": [ { "sku": "PRODUK1", "name": "Nama Produk 1", "price": 500000, "quantity": 1, "subtotal": 500000, "product_url": "https://tokokamu.com/product/nama-produk-1", "image_url": "https://tokokamu.com/product/nama-produk-1.jpg" }, { "sku": "PRODUK2", "name": "Nama Produk 2", "price": 500000, "quantity": 1, "subtotal": 500000, "product_url": "https://tokokamu.com/product/nama-produk-2", "image_url": "https://tokokamu.com/product/nama-produk-2.jpg" } ], "instructions": [ { "title": "Internet Banking", "steps": [ "Login ke internet banking Bank BRI Anda", "Pilih menu Pembayaran lalu klik menu BRIVA", "Pilih rekening sumber dan masukkan Kode Bayar (57585748548596587) lalu klik Kirim", "Detail transaksi akan ditampilkan, pastikan data sudah sesuai", "Masukkan kata sandi ibanking lalu klik Request untuk mengirim m-PIN ke nomor HP Anda", "Periksa HP Anda dan masukkan m-PIN yang diterima lalu klik Kirim", "Transaksi sukses, simpan bukti transaksi Anda" ] }, { "title": "Aplikasi BRImo", "steps": [ "Login ke aplikasi BRImo Anda", "Pilih menu BRIVA", "Pilih sumber dana dan masukkan Nomor Pembayaran (57585748548596587) lalu klik Lanjut", "Klik Lanjut", "Detail transaksi akan ditampilkan, pastikan data sudah sesuai", "Klik Konfirmasi", "Klik Lanjut", "Masukkan kata sandi ibanking Anda", "Klik Lanjut", "Transaksi sukses, simpan bukti transaksi Anda" ] } ] } } ``` -------------------------------- ### Successful Transaction Response Source: https://tripay.co.id/developer This is an example of a successful transaction response from the TriPay API, indicating the transaction status is PAID. ```json { "success": true, "message": "Status transaksi saat ini PAID", } ``` -------------------------------- ### Get Open Payment Detail Source: https://tripay.co.id/developer This API is used to retrieve the details of a specific open payment transaction using its UUID. ```APIDOC ## GET /open-payment/{uuid}/detail ### Description Retrieves the details of a specific open payment transaction. ### Method GET ### Endpoint https://tripay.co.id/api/open-payment/{uuid}/detail ### Parameters #### Header Parameters - **Authorization** (string) - Required - Bearer {api_key} ### Request Example ```php true, CURLOPT_URL => 'https://tripay.co.id/api/open-payment/'.$uuid.'/detail', CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_HTTPHEADER => ['Authorization: Bearer '.$apiKey], CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4 ]); $response = curl_exec($curl); $error = curl_error($curl); curl_close($curl); echo empty($error) ? $response : $error; ?> ``` ### Response #### Success Response (200) - **success** (boolean) - Indicates if the request was successful. - **message** (string) - Message associated with the response. - **data** (object) - Contains the payment details. - **uuid** (string) - The unique identifier for the payment. - **merchant_ref** (string) - The merchant's reference number. - **customer_name** (string) - The name of the customer. - **payment_name** (string) - The name of the payment method. - **payment_method** (string) - The code for the payment method. - **pay_code** (string) - The payment code. - **qr_string** (string|null) - The QR code string, if applicable. - **qr_url** (string|null) - The URL for the QR code, if applicable. #### Response Example ```json { "success": true, "message": "", "data": { "uuid": "T0001OP9376HnpS", "merchant_ref": "INV345675", "customer_name": "Nama Pelanggan", "payment_name": "BCA Virtual Account", "payment_method": "BCAVA", "pay_code": "1234567890", "qr_string": null, "qr_url": null } } ``` #### Error Response - **success** (boolean) - Indicates if the request was successful. - **message** (string) - Error message. #### Error Response Example ```json { "success": false, "message": "Invalid API Key" } ``` ```