Refunds
List Refunds
Here you can find all the listed refunds and if you want to search any specific refund use the filter option and find it directly.
Sample Code / Result:
Language
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://apiv1.chargemonk.com/listRefunds?api_token=test_fEZhxDQuOmIMBAVC7K0wtNoPpGgRyed1", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", )); $response = curl_exec($curl); curl_close($curl); echo $response;
{ "status": "success", "data": [ { "refundId": "IFtyGlbZ", "refundAmount": "150.00", "refundDate": 1575026349, "reason": "Other", "refundMethod": "cheque", "refundType": "refunded", "refundCreatedAt": 1575026349, "customer": { "customerId": "FLncGSp1", "customerFirstName": "Sunil", "customerLastName": "Pal" }, "subscription": { "subscriptionId": "IbCE1esK", "subscriptionStartDate": 1574948643, "subscriptionNextBilling": 1577471400, "pricingModel": "flat_fee", "planQuantity": 1 }, "cards": { "cardId": "wLTbogtt", "firstName": "Sunil", "lastName": "Pal", "last4": "1111", "cardType": "visa", "expiryMonth": "02", "expiryYear": "2021" "transaction": [ { "transactionId": "IVG4I1RY", "paymentGatewayToken": "chm_2S3UZOVof8", "gatewayAccountName": "Braintree", "transactionAmount": 150, "transactionCurrency": "USD", "transactionType": "Refund", "status": "active", "createdAt": 1581060556 } ] } "invoice": { "invoiceId": "M8AGZSXa", "invoiceNumber": 1045, "currencyCode": "USD", "invoiceSubTotal": "1100.00", "invoiceDiscountAmount": "0.00", "invoiceTotal": "1100.00", "invoicePaymentMethod": "Card", "invoiceDate": 1574948643 } } ] }
List Refunds attributes
Key | R/O | Description |
---|---|---|
api_token | required | Token generated by ChargeMonk. string |
limit | optional |
Limits the number of records to be shown. integer, default=25 |
page | optional | The page number depending upon the limit. eg. In 100 records, limit 10, page 2 will show records from 11-20. integer, default=0 |
search_value | optional | First name, Last name, Subscription code and Refund code can be searched. string |
order_by | optional | Display records in ascending or descending order. asc, desc, default=desc |
order_param | optional | You can sort created at or updated at alone as well as with order by field. eg. order_param = refund_created_at refund_created_at, refund_date, default=refund_created_at |
customerCode | optional | To filter based on Subscription Customer Id. Operators supported: is, is_not, starts_with, ends_with, contains, does_not_contain eg. filter[customerCode][ends_with] = a5gs string |
refundCreatedAt | optional | Date at which amount was refunded. Operators supported: is, is_not, less_than, less_than_equal, greater_than, greater_than_equal, between eg. filter[refundCreatedAt][is] = [1579602740] eg. filter[refundCreatedAt][between] = [1613932200, 1614105000] integer, In timestamp(UTC) in seconds format |
refundAmount | optional | Amout that is being refunded. Operators supported: is, is_not, less_than, less_than_equal, greater_than, greater_than_equal, between eg. filter[refundAmount][is] = 100 eg. filter[refundAmount][between] = [100,150] integer |
refundDate | optional | Date of refund. Operators supported: is, is_not, less_than, less_than_equal, greater_than, greater_than_equal, between eg. filter[refundDate][is] = 1579602740 eg. filter[refundDate][between] = [1613932200, 1614105000] integer, In timestamp(UTC) in seconds format |
firstName | optional | First name of the customer Operators supported: is, is_not, starts_with, ends_with, contains, does_not_contain eg. filter[firstName][ends_with] = hon string |
lastName | optional | Last name of the customer Operators supported: is, is_not, starts_with, ends_with, contains, does_not_contain eg. filter[lastName][ends_with] = doe string |
refundId | optional | Unique code of the refund Operators supported: is, is_not, starts_with, ends_with, contains, does_not_contain eg. filter[refundId][is] = Hja7as9 string |
status | optional | Current status of the refund. Operators supported: is, is_not eg. filter[status][is] = refunded string, "refunded, payment due" |
filter[match] | optional | 'All' will take 'AND' whereas 'ANY' will take 'OR' as condition. eg. filter[match]= ALL, filter[subscriptionCode][is] = 9DpnXa7ks, filter[refund_created_at][is] = [1579602740] Will be read as Filter if the filed has subscription code like 9DpnXa7ks OR refund_created_at is [1579602740]. ANY, ALL |
Refunds
To issue an automatic refund to a customer from an invoice, Refund API is used. To process the refund request the same payment gateway will be used through which customer has been charged. Make a full refund or do it as many partial refunds is completely your choice.
Sample Code / Result:
Language
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://apiv1.chargemonk.com/addRefundCustomerInvoice", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array( 'api_token' => 'test_fEZhxDQuOmIMBAVC7K0wtNoPpGgRyed1', 'invoice_id' => 'dgD7Bz64', 'amount' => '10', 'note' => 'Refund 10', 'reason_code' => 'Product Unsatisfactory'), )); $response = curl_exec($curl); curl_close($curl); echo $response;
{ "status": "success", "message": "An amount USD 100 has been refunded and email has been sent." }
Refunds attributes
Key | R/O | Description |
---|---|---|
api_token | required | Token generated by ChargeMonk. string |
invoice_id | required | Invoice Code of generated Invoice on which you want to refund. string |
amount | required | Refund Amount you want to refund from the main generated Invoice. integer |
note | required | Note you want to display in the refund invoice. string |
reason_code | required | Reason Code because of which you want to refund from the generated invoice. 'Product Unsatisfactory', 'Service Unsatisfactory', 'Order Change', 'Order Cancellation', 'Waiver', 'Other' |
Record Refunds
To record the offline refund of an invoice, Record Refund API is used. With the help of this API, recording of offline refunds can be done for invoices that have been paid through offline payment methods like cash, cheque, chargeback, bank transfer or others.
Sample Code / Result:
Language
$curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://apiv1.chargemonk.com/addRecordRefundCustomerInvoice", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => array( 'api_token' => 'test_fEZhxDQuOmIMBAVC7K0wtNoPpGgRyed1', 'invoice_id' => 'dgD7Bz64', 'amount' => '2', 'note' => 'Record Refund 2', 'reason_code' => 'Order Cancellation', 'refund_method' => 'banktransfer', 'refund_date' => 1579602740, 'reference' => '10145', 'comment' => 'Record Refund 2'), )); $response = curl_exec($curl); curl_close($curl); echo $response;
{ "status": "success", "message": "An amount USD 150 has been refunded and Email has been sent." }
Record Refunds attributes
Key | R/O | Description |
---|---|---|
api_token | required | Token generated by ChargeMonk. string |
invoice_id | required | Invoice Code of generated Invoice on which you want to refund. string |
amount | required | Refund Amount you want to refund integer, min:1 |
note | required | Note you want to display in the refund invoice. string |
reason_code | required | Reason Code you want to select from 'Chargeback', Product Unsatisfactory', 'Service Unsatisfactory', 'Order Change', 'Order Cancellation', 'Waiver', 'Other' |
refund_method | required | Refund Method to want to refund from 'cash', 'cheque', 'chargeback', 'banktransfer', 'other' |
refund_date | required | Date on which refund was made. integer, In timestamp(UTC) in seconds format, Refund Date cannot be greater than current date |
reference | required | Reference no. for Refund |
comment | required | This comment will be added to Refund |