Skip to main content

Documentation

List Refunds by Payment ID

Retrieve a list of refunds for a specified payment.

    • payment

    • ID of the payment. String starting with payment_.

Code Samples
    • .NET

      • using System;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        string payment = "payment_fdbae3bd097c9fffd88d7c3084f02ffe";
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("GET", $"/v1/refunds?payment={payment}");
        
                        Console.WriteLine(result);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error completing request: " + e.Message);
                    }
                }
            }
        }
        
    • JavaScript

      • const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;
        
        async function main() {
          try {
            const result = await makeRequest(
              'GET',
              '/v1/refunds?payment=payment_93186bb9a6d7ddfbae1d80f60285d736'
            );
        
            console.log(result);
          } catch (error) {
            console.error('Error completing request', error);
          }
        }
        
    • PHP

      • <?php
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        
        try {
            $object = make_request('get', '/v1/refunds?payment=payment_c26f7c14a6bafdbfb7dfc5300d634e8e');
            var_dump($object);
        } catch(Exception $e) {
            echo "Error: $e";
        }
        ?>
    • Python

      • from pprint import pprint
        
        from utilities import make_request
        
        payment = "payment_7b3d9a457f108e8078f4a1a3fedf759c"
        response = make_request(method='get',
                                path=f'/v1/refunds?payment={payment}')
        
        pprint(response)
        
  • /v1/refunds?:payment

  • List Refunds by Payment ID

  • curl -X get
    https://sandboxapi.rapyd.net/v1/refunds?payment=payment_7a98328c6da659a181c16a594dae5d3d
    -H 'access_key: your-access-key-here'
    -H 'Content-Type: application/json'
    -H 'salt: your-random-string-here'
    -H 'signature: your-calculated-signature-here'
    -H 'timestamp: your-unix-timestamp-here'
    
  • {
        "status": {
            "error_code": "",
            "status": "SUCCESS",
            "message": "",
            "response_code": "",
            "operation_id": "695380f1-801c-47dd-9e8b-0262529695a4"
        },
        "data": [
            {
                "id": "refund_1b4c22f67ddc416e7ab7bcede3a18b64",
                "amount": 15,
                "currency": "USD",
                "failure_reason": "",
                "metadata": {
                    "merchant_defined": true
                },
                "reason": "Uncredited discount",
                "status": "Completed",
                "receipt_number": 0,
                "created_at": 1608559262,
                "updated_at": 1608559262,
                "merchant_reference_id": "CA1234op",
                "payment_created_at": 1608559072,
                "payment_method_type": "us_visa_card",
                "ewallets": [],
                "proportional_refund": false,
                "merchant_debited_amount": null,
                "merchant_debited_currency": null,
                "fx_rate": null,
                "fixed_side": null
            }
        ]
    }