Get payments for a merchant - WalletConnect Pay Docs

Get payments for a merchant

cURL

curl --request GET \
  --url https://api.pay.walletconnect.com/v1/merchants/{merchant_id}/payments \
  --header 'X-Api-Key: <api-key>'

Python

import requests

url = "https://api.pay.walletconnect.com/v1/merchants/{merchant_id}/payments"

headers = {"X-Api-Key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)

JavaScript (Fetch)

const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};

fetch('https://api.pay.walletconnect.com/v1/merchants/{merchant_id}/payments', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://api.pay.walletconnect.com/v1/merchants/{merchant_id}/payments",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "GET",\
  CURLOPT_HTTPHEADER => [\
    "X-Api-Key: <api-key>"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Go

package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {

url := "https://api.pay.walletconnect.com/v1/merchants/{merchant_id}/payments"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-Api-Key", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))
}

Java (Unirest)

HttpResponse<String> response = Unirest.get("https://api.pay.walletconnect.com/v1/merchants/{merchant_id}/payments")
  .header("X-Api-Key", "<api-key>")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://api.pay.walletconnect.com/v1/merchants/{merchant_id}/payments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-Api-Key"] = '<api-key>'

response = http.request(request)
puts response.read_body

Response Example

{
  "data": [
    {
      "payment_id": "<string>",
      "merchant_id": "<string>",
      "reference_id": "<string>",
      "is_terminal": true,
      "wallet_name": "<string>",
      "token_symbol": "<string>",
      "token_decimals": 0,
      "token_logo": "<string>",
      "chain_logo": "<string>",
      "wallet_logo": "<string>",
      "chain_id": "<string>",
      "buyer_caip10": "<string>",
      "token_caip19": "<string>",
      "tx_hash": "<string>",
      "nonce": 1073741823,
      "token_amount": "<string>",
      "fiat_amount": -1,
      "fiat_currency": "<string>",
      "created_at": "<string>",
      "last_updated_at": "<string>",
      "settled_at": "<string>",
      "settlement_status": "<string>",
      "settlement_tx_hash": "<string>"
    }
  ],
  "stats": {
    "total_customers": 1073741823,
    "total_revenue": {
      "amount": 123,
      "currency": "<string>"
    },
    "total_transactions": 1073741823
  },
  "next_cursor": "<string>"
}