Skip to main content

Documentación

List Coupons

Retrieve a list of all coupons.

You can filter the list with query parameters.

    • ending_before

    • The ID of the coupon created after the last coupon you want to retrieve.

    • limit

    • The maximum number of coupons to return. Range: 1-100.

      10

    • starting_after

    • The ID of the coupon created before the first coupon you want to retrieve.

Code Samples
    • .NET

      • using System;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        string result = RapydApiRequestSample.Utilities.MakeRequest("GET", "/v1/coupons");
        
                        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/coupons'
            );
        
            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/coupons');
            var_dump($object);
        } catch(Exception $e) {
            echo "Error =>$e";
        }
        ?>
    • Python

      • from pprint import pprint
        
        from utilities import make_request
        
        result = make_request(method='get', path='/v1/coupons')
        pprint(result)
        
  • /v1/coupons

  • List Coupons

  • curl -X get 'https://sandboxapi.rapyd.net/v1/coupons?limit=2' \
    -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": "b6dbd9a4-88eb-405f-97f1-593254189a16"
        },
        "data": [
            {
                "id": "coupon_ec743a04cbaf362e55695efe868d4c3b",
                "amount_off": 2.75,
                "created": 1763464621,
                "currency": "USD",
                "duration": "repeating",
                "duration_in_months": 1,
                "max_redemptions": 1,
                "metadata": {},
                "percent_off": 0,
                "redeem_by": 0,
                "times_redeemed": 1,
                "discount_valid_until": 0,
                "discount_validity_in_months": 0,
                "discount_duration_in_uses": 1,
                "description": "",
                "valid": false
            },
            {
                "id": "coupon_7b9934fcc584ef629d2dcad65cc0d39c",
                "amount_off": 0,
                "created": 1762175848,
                "currency": "",
                "duration": "repeating",
                "duration_in_months": 3,
                "max_redemptions": 10,
                "metadata": {},
                "percent_off": 10,
                "redeem_by": 0,
                "times_redeemed": 0,
                "discount_valid_until": 0,
                "discount_validity_in_months": 0,
                "discount_duration_in_uses": 0,
                "description": "",
                "valid": true
            }
        ]
    }