If you're doing more than just accepting payments and are offering a service, you'll want to send the user back to your website to make sure the transaction went through and send the user on their way.

If you're promising a service on Queye Pay and don't deliver, the user can request a refund.

Queye Pay will send your customer back to your website, whether or not the payment was successful. That means, that it's up to you to check if the charge was successful or if it failed.

You can use the Queye Pay status API to see the transaction details, including if it went through.

Technically, anyone with your (public) vendor key and the transaction ID can check the status of the payment, so keep the transaction ID safe. However, it's also important to note that no identifying information can be found from this API.

Alright, now that you understand what the API is, let's learn about how you get the transaction ID. When a user submits payment and the payment is processed, the user gets redirected back to your return URL with a new parameter: the tr_id. This tr_id will have the transaction ID. A transaction ID is made up of four letters and eight numbers (e.g. ABCD12345678). You'd probably want to extract that.

$tr_id = $_GET['tr_id'] ?? null;
const tr_id = req.query.tr_id;
const urlParams = new URLSearchParams(window.location.search);
const tr_id = urlParams.get("tr_id");
from flask import request
tr_id = request.args.get('tr_id')
tr_id = params[:tr_id]
tr_id := r.URL.Query().Get("tr_id")
string tr_id = HttpContext.Request.Query["tr_id"];
String tr_id = request.getParameter("tr_id");

Now that you have that, you can send a new request to the Queye Pay Status API: https://api.queye.co/pay/status/.

$tr_id = $_GET['tr_id'];
$url = 'https://api.queye.co/pay/status/?tr_id=' . $tr_id . '&vendor=VENDOR_KEY';
$response = file_get_contents($url);
$data = json_decode($response, true);
// Require built-in HTTPS and URL modules for sending HTTP request and parsing query
const https = require('https'); // Node.js built-in module for HTTPS requests
const url = require('url');

// Simulate getting query parameter (e.g. from process.argv or web framework)
const query = new URLSearchParams(process.argv[2]);
const tr_id = query.get('tr_id');

const apiUrl = `https://api.queye.co/pay/status/?tr_id=${tr_id}&vendor=VENDOR_KEY`;

https.get(apiUrl, (res) => {
  let data = '';

  res.on('data', chunk => data += chunk);
  res.on('end', () => {
    const parsed = JSON.parse(data);
    console.log(parsed);
  });
}).on('error', (err) => {
  console.error('Error: ', err.message);
});
// Extract tr_id from browser URL query parameters
const urlParams = new URLSearchParams(window.location.search);
const tr_id = urlParams.get('tr_id');

fetch(`https://api.queye.co/pay/status/?tr_id=${tr_id}&vendor=VENDOR_KEY`)
  .then(response => response.json())
  .then(data => {
    console.log(data);
  });
import requests  # External library for HTTP requests (install via `pip install requests`)
import sys
from urllib.parse import parse_qs

# Parse query string manually (or use Flask's request.args in web apps)
query_string = sys.argv[1]
params = parse_qs(query_string)
tr_id = params.get('tr_id', [''])[0]

url = f'https://api.queye.co/pay/status/?tr_id={tr_id}&vendor=VENDOR_KEY'
response = requests.get(url)
data = response.json()
print(data)
require 'net/http'  # Built-in Ruby module for HTTP requests
require 'json'      # Built-in Ruby module to parse JSON
require 'uri'       # Built-in Ruby module to safely encode URLs

tr_id = ARGV[0]  # Or use `params['tr_id']` in a web app
uri = URI("https://api.queye.co/pay/status/?tr_id=#{tr_id}&vendor=VENDOR_KEY")

response = Net::HTTP.get(uri)
data = JSON.parse(response)
puts data
package main

import (
	"encoding/json"  // Standard Go package for JSON parsing
	"fmt"
	"io/ioutil"
	"net/http"
	"os"
)

func main() {
	trID := os.Args[1] // Normally you'd get this from query parameters
	url := fmt.Sprintf("https://api.queye.co/pay/status/?tr_id=%s&vendor=VENDOR_KEY", trID)

	resp, err := http.Get(url)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := ioutil.ReadAll(resp.Body)
	var data map[string]interface{}
	json.Unmarshal(body, &data) // Decode JSON
	fmt.Println(data)
}
using System;                 // Basic system utilities
using System.Net.Http;       // Required for HTTP client
using System.Threading.Tasks;
using System.Text.Json;      // For parsing JSON

class Program {
    static async Task Main(string[] args) {
        string tr_id = args[0]; // Normally from query string
        string url = $"https://api.queye.co/pay/status/?tr_id={tr_id}&vendor=VENDOR_KEY";

        using HttpClient client = new HttpClient();
        var response = await client.GetStringAsync(url);

        // Deserialize JSON string into a dictionary
        var data = JsonSerializer.Deserialize<Dictionary<string, object>>(response);
        Console.WriteLine(data);
    }
}
// Required imports:
// - URL and HttpURLConnection for sending the HTTP request
// - Scanner for reading the response
// - Gson library for JSON parsing (add dependency: com.google.code.gson:gson)
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
import com.google.gson.*;

public class Main {
    public static void main(String[] args) throws Exception {
        String tr_id = args[0];
        String urlStr = "https://api.queye.co/pay/status/?tr_id=" + tr_id + "&vendor=VENDOR_KEY";
        
        URL url = new URL(urlStr);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");

        Scanner scanner = new Scanner(new InputStreamReader(conn.getInputStream()));
        StringBuilder response = new StringBuilder();
        while (scanner.hasNext()) response.append(scanner.nextLine());
        scanner.close();

        JsonObject json = JsonParser.parseString(response.toString()).getAsJsonObject();
        System.out.println(json);
    }
}

The API will return something like this:

{
  "ABCD12345678": {
    "status": "successful",
    "product": "Chocolate",
    "vendor": "Company",
    "amount": 12.95,
    "currency": "USD",
    "datetime": "2024-08-01 11:26:35"
  }
}

You'll need to parse it to see if the charge went through. Additionally, you can log the payment details.

if ($data[$tr_id]['status'] === 'successful') {
    // Success - the user has been charged.
} else {
    // Something went wrong - the user has not been charged.
}
if (parsed[tr_id].status === 'successful') {
  // Success - the user has been charged.
} else {
  // Something went wrong - the user has not been charged.
}
if (data[tr_id].status === 'successful') {
  // Success - the user has been charged.
} else {
  // Something went wrong - the user has not been charged.
}
if data.get(tr_id, {}).get('status') == 'successful':
    # Success - the user has been charged.
else:
    # Something went wrong - the user has not been charged.
if data[tr_id]['status'] == 'successful'
  # Success - the user has been charged.
else
  # Something went wrong - the user has not been charged.
end
if status, ok := data[trID].(map[string]interface{})["status"]; ok && status == "successful" {
	// Success - the user has been charged.
} else {
	// Something went wrong - the user has not been charged.
}
if (data.ContainsKey(tr_id) && data[tr_id].ToString().Contains("successful")) {
    // Success - the user has been charged.
} else {
    // Something went wrong - the user has not been charged.
}
if (json.has(tr_id) && json.getAsJsonObject(tr_id).get("status").getAsString().equals("successful")) {
    // Success - the user has been charged.
} else {
    // Something went wrong - the user has not been charged.
}

Next: Creating a product.