Mark Invoice Uncollectible
Set an invoice to uncollectible status.
This status indicates that the invoice cannot be paid by the customer.
invoice
ID of the invoice you want to mark uncollectible. String starting with invoice_.
Code Samples
.NET
using System; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string invoice = "invoice_91931a87d4a342362495899cdbbd9664"; string result = RapydApiRequestSample.Utilities.MakeRequest("POST", $"/v1/invoices/{invoice}/mark_uncollectible"); 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( 'POST', '/v1/invoices/invoice_91931a87d4a342362495899cdbbd9664/mark_uncollectible' ); 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('post', "/v1/invoices/invoice_91931a87d4a342362495899cdbbd9664/mark_uncollectible"); var_dump($object); } catch(Exception $e) { echo "Error => $e"; } ?>
Python
from pprint import pprint from utilities import make_request result = make_request(method='post', path='/v1/invoices/invoice_91931a87d4a342362495899cdbbd9664/mark_uncollectible') pprint(result)
/v1/invoices/:invoice/mark_uncollectible
Mark Invoice Uncollectible
curl -X post 'https://sandboxapi.rapyd.net/v1/invoices/invoice_9497dc5488fb27cbcc17b62d40f2b80f/mark_uncollectible' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -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": "4fbd2be2-60c7-4319-a975-ec108244da6d" }, "data": { "id": "invoice_9497dc5488fb27cbcc17b62d40f2b80f", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "manual", "created_at": 1764747049, "currency": "USD", "customer": "cus_4e25112ac20e144ad073a614dc46934b", "description": "", "discount": null, "due_date": 1767339049, "days_until_due": 30, "metadata": {}, "payment_method": "card_b9548d9b53a565b2315fecdc6c87f158", "payment": null, "payout": null, "payment_fields": null, "period_end": 0, "period_start": 0, "lines": [], "statement_descriptor": "", "subscription": "", "discount_amount": 0, "subtotal": 0, "tax": 0, "tax_percent": 0, "total": 0, "status": "paid", "payout_fields": null, "type": "payment" } }
Bad Request - Status Not Open
curl -X post 'https://sandboxapi.rapyd.net/v1/invoices/invoice_e73b41cc28316f44d345aa8e6339a35d/mark_uncollectible' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here'
{ "status": { "error_code": "ERROR_MARK_UNCOLLECTIBLE_NOT_OPEN_INVOICE", "status": "ERROR", "message": "The request tried to mark an invoice as uncollectible, but the invoice status was not 'open'. The request was rejected. Corrective action: None. Determine why the invoice was not in 'open' status.", "response_code": "ERROR_MARK_UNCOLLECTIBLE_NOT_OPEN_INVOICE", "operation_id": "36da2a44-1671-45ce-aabf-3fab803d4327" } }
Bad Request - Invoice Not Found
curl -X post 'https://sandboxapi.rapyd.net/v1/invoices/invoice_e73b41cc28316f44d345aa8e6339a35/mark_uncollectible' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw ''
{ "status": { "error_code": "ERROR_GET_INVOICE", "status": "ERROR", "message": "The request tried to retrieve an invoice, but the invoice was not found. The request was rejected. Corrective action: Use a valid invoice ID.", "response_code": "ERROR_GET_INVOICE", "operation_id": "5d1ae2be-1830-404f-a241-36c49628c154" } }