NATS For Networks REST API Process Chargeback
From TMM Wiki
Jump to navigationJump to searchThe printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
POST transaction/process_chargeback
Description This REST API resource to used to issue a chargeback for a transaction that was previously converted
Resource URL
- http://domain/api/transaction/process_chargeback
- Replace domain with your NATS for Networks domain
- POST
Response Format
- JSON
- HTTP headers
Parameters
- type: This should always be set as chargeback
- type: string
- required
- transaction_hash: The click_hash/transaction_hash of the transaction you want to chargeback.
- type: string
- optional
- click_hash: The click_hash/transaction_hash of the transaction you want to chargeback.
- type: string
- optional
- orderid: The transaction identifier sent on conversion (orderid) you want to chargeback.
- type: string
- optional
- transactionid: The N4N generated transaction identifier you want to chargeback
- type: string
- optional
- cost: The cost of the chargeback (decimal format) will be taken away from the affiliate payout
- type: double
- optional
- trans_custom1 : custom value to record with a transaction. -1 is a reserved value and should not be used.
- type: string
- optional
- trans_custom2 : custom value to record with a transaction. -1 is a reserved value and should not be used.
- type: string
- optional
- trans_custom3 : custom value to record with a transaction. -1 is a reserved value and should not be used.
- type: string
- optional
- trans_custom4 : custom value to record with a transaction. -1 is a reserved value and should not be used.
- type: string
- optional
- trans_custom5 : custom value to record with a transaction. -1 is a reserved value and should not be used.
- type: string
- optional
Example Request
POST
http://domain.com/api/transaction/process_chargeback
- Response:
Success { "result": "success", "message": "*success*" } Failure { "result": "error", "message": "Missing required field for chargeback (type)." }
Example Code
PHP
<?php $curl = curl_init(); $data = array( 'type' => 'chargeback', 'transaction_hash' => '156097c947ece92.38318951', ); $url = 'http://domain/api/transaction/process_chargeback'; $headers = array( 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: productsupport' ); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); curl_setopt($curl, CURLOPT_URL, $url); $resp = curl_exec($curl); //dumps an associative array representation of the json response $output = json_decode($resp, true); if($output !== NULL) { //json was valid. Dump the decoded array print_r($output); } else { //invalid json, just dump the raw response print_r($resp); } // Close request to clear up some resources curl_close($curl); ?>