API SmartPay

Melalui API ini, Anda akan mendapatkan informasi yang saling terintegrasi berkaitan Produk yang telah di beli oleh pengguna dan laporan keuangan.

  1. Endpoint

Method
GET

Sandbox URL

https://tripay.co.id/api-sandbox/merchant/transactions

Production URL

https://tripay.co.id/api/merchant/transactions

  1. Header

Key
Value
Keterangan

Authorization

Bearer {api_key}

Ganti {api_key} dengan API Key Anda

  1. Body

Parameter
Tipe
Contoh Nilai
Wajib
Keterangan

page

int

1

TIDAK

Nomor halaman

per_page

int

50

TIDAK

Jumlah data per halaman. Maks: 50

sort

string

desc

TIDAK

Sorting data. asc : Terlama ke Terbaru desc : Terbaru ke Terlama

reference

string

T0001000000455HFGRY

TIDAK

Untuk melakukan filter berdasarkan nomor referensi transaksi

merchant_ref

string

INV57564

TIDAK

Untuk melakukan filter berdasarkan nomor referensi/invoice merchant

method

string

TIDAK

Untuk melakukan filter berdasarkan kode channel pembayaran

status

string

PAID

TIDAK

Untuk melakukan filter berdasarkan status pembayaran

  1. Contoh Request PHP

<?php

$apiKey = 'api_key_anda';

$payload = [
    'page' => 1,
    'per_page' => 25,
];

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_FRESH_CONNECT  => true,
  CURLOPT_URL            => 'https://tripay.co.id/api/merchant/transactions?'.http_build_query($payload),
  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($err) ? $response : $error;

?>

  1. Response Sukses

{
  "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
  }
}

  1. Response Gagal

{
  "success": false,
  "message": "Invalid API Key"
}

Last updated