Remaining in Europe, he served as secretary to William Lee in 1777 when the Continental Congress appointed Lee commissioner at the Courts of Vienna and Berlin in an unsuccessful attempt to win the support of Austria and Prussia in the war. In 1778 Stockton was instrumental in negotiating a secret treaty between the United States and the Dutch Republic that, when discovered by the British, sparked the Fourth Anglo-Dutch War. He returned to New Jersey in 1779.