Skip to main content

Set external order reference

Last updated: 16-Nov-2018
Rate this article:


Use this method to set an external reference for a partner order. This is helpful if you use unique identifiers in your own order management system and you want to mirror the IDs in the 2Checkout system.


Use this method before placeOrder.


Parameter Type/Description
sessionID Required (String)
  Session identifier, which is the output of the Login method. An exception is thrown if the values are incorrect.
externalRef Required (String)
  The unique identifier of an order placed in the Avangate system mirroring the reference you're using to manage order data in your system.


Parameter Type/Description
Response Boolean
  True or false



require ('PATH_TO_AUTH');  // Authentication example:
require ('PATH_TO_SET_PARTNER'); // setPartner example:
require ('PATH_TO_ADD_PRODUCT'); // addProduct example:

$externalRef = 'NEW_REFERENCE';

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'setExternalRef',
'params' => array($sessionID, $externalRef)
var_dump (callRPC((Object)$jsonRpcRequest, $host));

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'placeOrder',
'params' => array($sessionID)
var_dump (callRPC((Object)$jsonRpcRequest,$host));

require ('PATH_TO_PLACE_ORDER');


Error Description


The provided external reference is empty.


Rate this article:
Logo of Verifone