Payments
API ReferencePaymentsRetrieve Payment
Retrieve Payment
Retrieve details of an existing payment by its ID.
GET /payments/:payment_id
Retrieves the details of a payment that has previously been created. Supply the unique payment ID that was returned from your previous request, and the corresponding payment information will be returned.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
payment_id | string | Required. The ID of the payment to retrieve. |
Request Example
curl 'https://api.paysvara.com/payments/pay_1234567890abcdef' \
-H "api-key: snd_YOUR_API_KEY"const response = await fetch(
'https://api.paysvara.com/payments/pay_1234567890abcdef',
{
headers: {
'api-key': 'snd_YOUR_API_KEY',
},
}
);
const payment = await response.json();
console.log(payment);import requests
response = requests.get(
'https://api.paysvara.com/payments/pay_1234567890abcdef',
headers={
'api-key': 'snd_YOUR_API_KEY',
},
)
payment = response.json()
print(payment)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.paysvara.com/payments/pay_1234567890abcdef',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'api-key: snd_YOUR_API_KEY',
],
]);
$response = curl_exec($curl);
$payment = json_decode($response, true);
print_r($payment);package main
import (
"encoding/json"
"fmt"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.paysvara.com/payments/pay_1234567890abcdef", nil)
req.Header.Set("api-key", "snd_YOUR_API_KEY")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var payment map[string]interface{}
json.NewDecoder(resp.Body).Decode(&payment)
fmt.Println(payment)
}Response
{
"payment_id": "pay_1234567890abcdef",
"merchant_id": "mer_abcdef123456",
"status": "succeeded",
"amount": 5000,
"amount_received": 5000,
"currency": "USD",
"capture_method": "automatic",
"payment_method": "card",
"payment_method_data": {
"card": {
"last4": "4242",
"brand": "visa",
"exp_month": "12",
"exp_year": "2028"
}
},
"customer_id": "cus_xyz789",
"email": "customer@example.com",
"description": "Order #12345",
"created": "2024-01-15T10:30:00Z",
"modified_at": "2024-01-15T10:30:05Z",
"metadata": {
"order_id": "12345"
}
}{
"error": {
"type": "invalid_request",
"code": "IR_05",
"message": "Payment not found"
}
}