Void Invoice
Set an invoice to void status.
Void invoices are similar to deleted invoices, but their records are kept for accounting purposes.
invoice
ID of the invoice you want to void. String starting with invoice_.
Code Samples
.NET
using System; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string invoice = "invoice_6d2360effe7ac01c260f1ee97a4d6ce5"; string result = RapydApiRequestSample.Utilities.MakeRequest("POST", $"/v1/invoices/{invoice}/void"); 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_6d2360effe7ac01c260f1ee97a4d6ce5/void' ); 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_6d2360effe7ac01c260f1ee97a4d6ce5/void"); 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_6d2360effe7ac01c260f1ee97a4d6ce5/void') pprint(result)
/v1/invoices/:invoice/void
Void Invoice
curl -X post https://sandboxapi.rapyd.net/v1/invoices/invoice_a87d5fa33216972acd2ccd9972ce0112/void -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": "76ca9191-fbb9-407a-b0e9-3412d8b6dc20" }, "data": { "id": "invoice_a87d5fa33216972acd2ccd9972ce0112", "attempt_count": 4, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1701849092, "currency": "USD", "customer": "cus_ec644ad88259ee3deea6dd98cd2b3f6f", "description": "", "discount": null, "due_date": 1704441092, "days_until_due": 30, "metadata": {}, "number": 0, "payment_method": "card_d100c6f732a1fc61c1044d7e582024bc", "payment": { "id": "payment_02c6203df843010ebeed2ca7611ca030", "amount": 0, "original_amount": 0.06, "is_partial": false, "currency_code": "USD", "country_code": "fr", "status": "ERR", "description": "", "merchant_reference_id": "", "customer_token": "cus_ec644ad88259ee3deea6dd98cd2b3f6f", "payment_method": "card_d100c6f732a1fc61c1044d7e582024bc", "payment_method_data": { "id": "card_d100c6f732a1fc61c1044d7e582024bc", "type": "fr_visa_card", "category": "card", "metadata": {}, "image": "", "webhook_url": "", "supporting_documentation": "", "next_action": "not_applicable", "name": "John Doe", "last4": "1111", "acs_check": "unchecked", "cvv_check": "pass", "bin_details": { "type": "CREDIT", "brand": "VISA", "level": null, "issuer": "JPMORGAN CHASE BANK, N.A.", "country": "US", "bin_number": "411111" }, "expiration_year": "24", "expiration_month": "12", "fingerprint_token": "ocfp_11ECFC39332B40F481220EC01B2F2B1B" }, "auth_code": null, "expiration": 1702454251, "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": "", "transaction_id": "", "created_at": 1701849451, "metadata": {}, "failure_code": "100", "failure_message": "Rejected. Contact Service Provider", "paid": false, "paid_at": 0, "dispute": null, "refunds": null, "order": null, "outcome": null, "visual_codes": {}, "textual_codes": {}, "instructions": {}, "ewallet_id": "ewallet_e2150f478c15d97b807b9ed179b798a0", "ewallets": [ { "ewallet_id": "ewallet_e2150f478c15d97b807b9ed179b798a0", "amount": 0.06, "percent": 100, "refunded_amount": 0 } ], "payment_method_options": {}, "payment_method_type": "fr_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_a87d5fa33216972acd2ccd9972ce0112", "escrow": null, "group_payment": "", "cancel_reason": null, "initiation_type": "recurring", "mid": "", "next_action": "not_applicable", "error_code": "ERROR_PROCESSING_CARD - [100]", "remitter_information": {} }, "payout": null, "payment_fields": null, "period_end": 1701935491, "period_start": 1701849092, "lines": [], "statement_descriptor": "", "subscription": "sub_0ecc9456e3ddfd508c3bc0a3cf80bfeb", "discount_amount": 0, "subtotal": 0.06, "tax": 0, "tax_percent": 0, "total": 0.06, "status": "void", "payout_fields": null, "type": "payment", "next_payment_attempt": 0, "automatic_attempt_count": 3 } }