Skip to main content

Documentation

Retrieve Invoice

Retrieve the basic data of an invoice, with individual invoice lines.

    • invoice

    • ID of the invoice you want to retrieve. String starting with invoice_.

Code Samples
    • .NET

      • using System;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        string invoice = "invoice_9030474cc176d302d77cfa6f74acb746";
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("GET", $"/v1/invoices/{invoice}");
        
                        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/invoices/invoice_9030474cc176d302d77cfa6f74acb746'
            );
        
            console.log(result);
          } catch (error) {
            console.error('Error completing request', error);
          }
        }
    • PHP

      • <?php
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        
        try {
            $object = make_request('get', "/v1/invoices/invoice_9030474cc176d302d77cfa6f74acb746");
            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/invoices/invoice_9030474cc176d302d77cfa6f74acb746')
        pprint(result)
  • /v1/invoices/:invoice

  • Retrieve Invoice

  • curl -X get
    https://sandboxapi.rapyd.net/v1/invoices/invoice_59d94a39990de1d9c9121c9f2510d1a6
    -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": "b72825bf-2e2f-4ee2-addb-aeb011116c5a"
        },
        "data": {
            "id": "invoice_59d94a39990de1d9c9121c9f2510d1a6",
            "attempt_count": 0,
            "billing": "pay_automatically",
            "billing_reason": "subscription_create",
            "created_at": 1702188713,
            "currency": "USD",
            "customer": "cus_6ed4f7d07dcff8efd9d7bb67960a52c9",
            "description": "",
            "discount": null,
            "due_date": 0,
            "days_until_due": 30,
            "metadata": {},
            "number": 0,
            "payment_method": "card_66ca7053b7c2a9c381b963fc54121682",
            "payment": {
                "id": "payment_99cb67df553895516661efdd397bd7b1",
                "amount": 712,
                "original_amount": 712,
                "is_partial": false,
                "currency_code": "USD",
                "country_code": "AT",
                "status": "CLO",
                "description": "",
                "merchant_reference_id": "",
                "customer_token": "cus_6ed4f7d07dcff8efd9d7bb67960a52c9",
                "payment_method": "card_66ca7053b7c2a9c381b963fc54121682",
                "payment_method_data": {
                    "id": "card_66ca7053b7c2a9c381b963fc54121682",
                    "type": "at_visa_card",
                    "category": "card",
                    "metadata": {},
                    "image": "",
                    "webhook_url": "",
                    "supporting_documentation": "",
                    "next_action": "not_applicable",
                    "name": "John Doe",
                    "last4": "0093",
                    "acs_check": "unchecked",
                    "cvv_check": "pass",
                    "bin_details": {
                        "type": "CREDIT",
                        "brand": "VISA",
                        "level": "SIGNATURE",
                        "issuer": "MAYBANK SINGAPORE LIMITED",
                        "country": "SG",
                        "bin_number": "401636"
                    },
                    "expiration_year": "26",
                    "expiration_month": "01",
                    "fingerprint_token": "ocfp_3441802c25a8fb3c3249c8249da1d964"
                },
                "auth_code": "719694",
                "expiration": 1702793528,
                "captured": true,
                "refunded": false,
                "refunded_amount": 0,
                "receipt_email": "",
                "redirect_url": "",
                "complete_payment_url": "",
                "error_payment_url": "",
                "receipt_number": "",
                "flow_type": "",
                "address": null,
                "statement_descriptor": "Subscription",
                "transaction_id": "",
                "created_at": 1702188728,
                "metadata": {},
                "failure_code": "",
                "failure_message": "",
                "paid": true,
                "paid_at": 1702188729,
                "dispute": null,
                "refunds": null,
                "order": null,
                "outcome": null,
                "visual_codes": {},
                "textual_codes": {},
                "instructions": [],
                "ewallet_id": "ewallet_8d09667ac2a0d4ba57d2765c497491fd",
                "ewallets": [
                    {
                        "ewallet_id": "ewallet_8d09667ac2a0d4ba57d2765c497491fd",
                        "amount": 712,
                        "percent": 100,
                        "refunded_amount": 0
                    }
                ],
                "payment_method_options": {},
                "payment_method_type": "at_visa_card",
                "payment_method_type_category": "card",
                "fx_rate": 1,
                "merchant_requested_currency": null,
                "merchant_requested_amount": null,
                "fixed_side": "",
                "payment_fees": null,
                "invoice": "invoice_59d94a39990de1d9c9121c9f2510d1a6",
                "escrow": null,
                "group_payment": "",
                "cancel_reason": null,
                "initiation_type": "customer_present",
                "mid": "mid_f79561a67d79c6e0162bf22f3ccd1292",
                "next_action": "not_applicable",
                "error_code": "",
                "remitter_information": {}
            },
            "payout": null,
            "payment_fields": null,
            "period_end": 1704867113,
            "period_start": 1702188713,
            "lines": [
                {
                    "id": "il_25c53e1c28cdf3d02f9ccbf340eeec43",
                    "amount": 712,
                    "currency": "USD",
                    "description": "Subs Checks",
                    "discountable": true,
                    "invoice_item": "",
                    "metadata": {},
                    "period": {
                        "start": 1702188713,
                        "end": 1704867113
                    },
                    "proration": false,
                    "quantity": 8,
                    "plan": {
                        "id": "plan_f6412a03a120e84daa0c1a5330935891",
                        "aggregate_usage": "sum",
                        "amount": 89,
                        "billing_scheme": "per_unit",
                        "created_at": 1702188712,
                        "currency": "USD",
                        "interval": "month",
                        "interval_count": 1,
                        "metadata": {},
                        "nickname": "",
                        "tiers": [],
                        "tiers_mode": "",
                        "transform_usage": {
                            "divide_by": 1,
                            "round": "up"
                        },
                        "trial_period_days": 0,
                        "usage_type": "licensed",
                        "active": true
                    },
                    "subscription": "sub_fa2da2e11cbf323d1d55c7d5f67c9967",
                    "subscription_item": "subi_b04ea03571bb17fe01f93dc68a589ea5",
                    "type": "subscription"
                }
            ],
            "statement_descriptor": "",
            "subscription": "sub_fa2da2e11cbf323d1d55c7d5f67c9967",
            "discount_amount": 0,
            "subtotal": 712,
            "tax": 0,
            "tax_percent": 0,
            "total": 712,
            "status": "paid",
            "payout_fields": null,
            "type": "payment",
            "next_payment_attempt": 0,
            "automatic_attempt_count": 0
        }
    }