Skip to content

Sale_Refund

Craig Christenson edited this page Oct 26, 2012 · 2 revisions

2Checkout's back office API allows you to retrieve sale information. You must specify your API username and password using the the Twocheckout::setCredentials method before calling a method in this class. The Twocheckout_Sale class provides methods to retrieve and update sales and will return a JSON object or array depending on your specification.

##Method

###refund

Use to attempt to issue a full or partial refund.

####Arguments

  • array Array

  • Array containing refund_invoice or refund_lineitem parameters in key => value pairs. Parameters -> API Refund Invoice || API Refund Lineitem

  • string format

  • Supports 'json' or 'array'. Defines response format. Default: 'json'

####Returns

Returns result as a JSON object or array depending on your specification.

####Example Usage:

<?php

Twocheckout::setCredentials("APIuser1817037", "APIpass1817037");

$args = array(
    'sale_id' => 4753371371,
    'category' => 1,
    'comment' => 'Order never sent.'
);

$result = Twocheckout_Sale::refund($args, 'array');

print_r($result);

####Example Response:

Array
(
    [response_code] => OK
    [response_message] => refund added to invoice
)
Clone this wiki locally