1.0.1 • Published 5 years ago

payment-corner v1.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

alt text <>

Payment Corner Node JS SDK

Version Build Status

Introduction

Payment Corner (Switzerland) Ltd is an open foreign exchange platform that enables customers to create their own products that need Forex capabilities into their systems, apps and workflows.

Customers connect to Payment Corner platform via Node JS SDK using their client ID , email and password which can be obtained from the user dashboard.

Supported Currencies

Our FX platform currently supports the following 28 currencies:

Currency (ISO)CurrencySWIFTLocal Payment
AUDAustralian DollarYesYes
GBPBritish PoundYesYes
BGNBulgarian LevYesNo
CADCanadian DollarYesYes
CNYChinese Yuan RenminbiYesNo
HRKCroatian KunaYesNo
CZKCzech KorunaYesYes
AEDEmirati DirhamYesNo
EUREuroYesYes
HKDHong Kong DollarYesYes
HUFHungarian ForintYesYes
ILSIsraeli ShekelYesNo
JPYJapanese YenYesNo
MXNMexican PesoYesYes
NZDNew Zealand DollarYesNo
NOKNorwegian KroneYesYes
PLNPolish ZlotyYesYes
QARQatari RialYesNo
RONRomanian New LeuYesNo
RUBRussian Ruble (Sell only)YesNo
SARSaudi RiyalYesNo
SGDSingapore DollarYesYes
ZARSouth African RandYesNo
SEKSwedish KronaYesYes
CHFSwiss FrancYesNo
THBThai BahtYesNo
TRYTurkish LiraYesNo
USDUnited States DollarYesYes

Installation

Install the package with: npm i payment-corner

Usage

The package needs to be configured with your account's email , passpword and client id, Client id can be obtained from your Payment Corner Dashboard.

const paymentCorner = require('payment-corner');

let Payment = new paymentCorner({
    email: 'user@domain.com',
    password: 'password',
    client_id: 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
    sandbox: true
});

Enable sandbox Mode

Set sandbox : true while Initalizing the SDK .

FX Transaction

Proceed with an FX transaction (buy and sell side), get your quote and confirm the FX trade.

Required Parameters

ParameterDescription
currency_to_buyISO 4217 format ( YYYY-MM-DD)
currency_to_sellISO 4217 format ( YYYY-MM-DD)
side_of_fx_txChoose the side of the FX transaction
amountAmount of the fixed side
fx_tx_gtcGeneral terms and conditions

Optional Parameters

ParameterDescription
fx_tx_dateISO 8601 format (YYYY-MM-DD)
amount_to_buyAmount of buy side
amount_to_sellAmount of sell side
fx_tx_unique_idIdempotency key

Usage

    Payment.fxTransaction({
        currency_to_buy: 'EUR',
        currency_to_sell: 'USD',
        side_of_fx_tx: 'sell',
        amount: 150,
        fx_tx_gtc: true,
    }).then(data => {
        console.log("fxTransaction result", data);
    }).catch(err => {
        console.log("fxTransaction err", err);
    });

Result

{ 
    path: '1ca9c450-0c48-472c-9fc1-6ae0544b3f2c',
    date_of_settlement: '2019-01-28T14:30:00+00:00',
    fx_tx_date: '2019-01-28T00:00:00+00:00',
    creator_contact_id: '08b45825-3ded-481d-ac93-9c22b908e10a',
    account_id: '0f1c61be-64ca-4c93-bdd3-1b384370378e',
    currency_pair: 'EURUSD',
    currency_to_buy: 'EUR',
    currency_to_sell: 'USD',
    amount_to_buy: '126.51',
    amount_to_sell: '150.00',
    side_of_fx_tx: 'sell',
    market_rate: '1.1857',
    client_net_rate: '1.1857',
    fx_tx_unique_id: null,
    fx_tx_creation_date: '2019-01-28T08:49:10+00:00',
    fx_tx_update_date: '2019-01-28T08:49:10+00:00',
    mid_market_rate: '1.1856',
    fx_tx_status: 'Funds_to_receive',
    ref: '20190128-ZVDHJZ-EbJF8960'
  }

Fx transaction status (fx_tx_status)

statusDescription
Funds_to_receiveFunds that are related to a FX transaction and that have not reached Payment Corner settlement account(s) yet
Funds_sentFunds have been sent by Payment Corner to requested beneficiary
Funds_receivedFunds have been received by Payment Corner
FX_deal_settledThe FX transaction is completed
FX_deal_closedThe FX transaction has been cancelled

Retrieve FX Transaction(s)

Retrieve one or several FX transaction(s) based on one or several parameter(s).

Optional Parameters

ParameterDescription
refReference code
fx_tx_statusFX transaction status
currency_to_buyThe ISO 4217 format
currency_to_sellThe ISO 4217 format
fx_tx_idOne or several ID(s) to retrieve one or several FX transaction(s)
tx_from_firstISO 8601 format (e.g.2018-11-30)
tx_to_lastISO 8601 format (e.g.2018-11-30)
tx_time_update_firstISO 8601 format (e.g.2018-11-30)
tx_time_update_lastISO 8601 format (e.g.2018-11-30)
tx_date_fromISO 8601 format (e.g.2018-11-30)
tx_date_toISO 8601 format (e.g.2018-11-30)
currency_pairTwo ISO 4217 format concatenated
min_amount_to_buyMinimum amount on buy side
max_amount_to_buyMaximum amount on buy side
min_amount_to_sellMinimum amount of sell side
max_amount_to_sellMaximum amount on sell side
date_tx_debit_firstISO 8601 format (e.g.2018-11-30)
date_tx_debit_lastISO 8601 format (e.g.2018-11-30)
fx_tx_unique_idIdempotency key
page_nbPage number
result_per_pageNumber of results per page
sort_orderChange the sort order
sort_asc_to_descSort in ascending or descending order.

Usage

  Payment.retrieveFxTransaction({
  
    })
    .then(data => {
        console.log("retrieveFxTransaction", data);
    })
    .catch(err => {
        console.log("retrieveFxTransaction err", err);
    });

Result

{
         "conversions": [
         {
             "path": "832d46cd-d0ec-4717-9435-cc34d587dc95",
             "date_of_settlement": "2018-11-28T16:30:00+00:00",
             "date_of_conversion": "2018-11-28T00:00:00+00:00",
             "creator_contact_id": "f72a98bf-2d4d-421f-b5c1-425d19077002",
             "account_id": "0f1c61be-64ca-4c93-bdd3-1b384370378e",
             "currency_pair": "GBPUSD",
             "currency_to_buy": "USD",
             "currency_to_sell": "GBP",
             "amount_to_buy": "1000.00",
             "amount_to_sell": "710.28",
             "side_of_fx_tx": "buy",
             "client_rate": "1.4079",
             "fx_tx_unique_id": null,
             "fx_tx_creation_date": "2018-11-26T09:00:48+00:00",
             "fx_tx_update_date": "2018-11-28T06:31:04+00:00",
             "mid_market_rate": "1.4080",
             "fx_tx_status": "FX_deal_settled",
             "ref": "20181126-KSBMRW-IWwN2584"
         }
         ],
         "pagination": {
             "tot_nbr_entries": 2,
             "tot_nbr_pages": 1,
             "current_page": 1,
             "result_per_page": 25,
             "goto_previous_page": -1,
             "goto_next_page": 2,
             "sort_order": "created_at",
             "sort_asc_to_desc": "asc"
         }
     }

Retrieve a FX Transaction Record

Retrieve a single FX transaction based on the unique FX transaction ID.

Required Parameters

ParameterDescription
pathConversion UUID

Usage

    
     Payment.retrieveFxTransactionRecord({
        path: '832d46cd-d0ec-4717-9435-cc34d587dc95'
    })
    .then(data => {
        console.log("retrieveFxTransactionRecord", data);
    })
    .catch(err => {
        console.log("retrieveFxTransactionRecord err", err);
    })

Result

{
          "path": "832d46cd-d0ec-4717-9435-cc34d587dc95",
          "date_of_settlement": "2018-11-28T16:30:00+00:00",
          "date_of_conversion": "2018-11-28T00:00:00+00:00",
          "creator_contact_id": "f72a98bf-2d4d-421f-b5c1-425d19077002",
          "account_id": "0f1c61be-64ca-4c93-bdd3-1b384370378e",
          "currency_pair": "GBPUSD",
          "currency_to_buy": "USD",
          "currency_to_sell": "GBP",
          "amount_to_buy": "1000.00",
          "amount_to_sell": "710.28",
          "side_of_fx_tx": "buy",
          "client_rate": "1.4079",
          "fx_tx_unique_id": null,
          "fx_tx_creation_date": "2018-11-26T09:00:48+00:00",
          "fx_tx_update_date": "2018-11-28T06:31:04+00:00",
          "mid_market_rate": "1.4080",
          "fx_tx_status": "FX_deal_settled",
          "ref": "20181126-KSBMRW-QgGW6160"
      }

Change FX conversion value date

Change FX conversion value date by using the unique FX transaction path.

Required Parameters

ParameterDescription
pathID of the conversion that is being changed
new_date_fx_txNew FX transaction settlement date (YYYY-MM-DD)

Usage

 Payment.changeFxConversionValueDate({
        path: 'e5cce1bf-af7e-4633-b6ae-bae4b8bcaf36',
        new_date_fx_tx: '2019-01-28'
    })
    .then(data => {
        console.log("changeFxConversionValueDate", data);
    })
     .catch(err => {
       console.log("changeFxConversionValueDate err", err.message)
    });

Result

 {
         "path": "e5cce1bf-af7e-4633-b6ae-bae4b8bcaf36",
         "amount": "2.00",
         "currency": "USD",
         "new_conversion_date": "2018-12-20T00:00:00+00:00",
         "new_date_fx_tx": "2018-12-20T16:30:00+00:00",
         "old_conversion_date": "2018-12-11T00:00:00+00:00",
         "old_settlement_date": "2018-12-11T16:30:00+00:00",
         "event_date_time": "2018-12-11T06:37:12+00:00"
     }

Change FX Conversion Delivery Date Quotation

Allows you to get the new rates in case you want to change the FX transaction settlement date.

Required Parameters

ParameterDescription
pathConversion UUID
new_date_fx_txDesired new settlement date of conversion (YYYY-MM-DD)

Usage

    Payment.changeFxConversionDeliveryDateQuotation({
        path: 'e5cce1bf-af7e-4633-b6ae-bae4b8bcaf36',
        new_date_fx_tx: '2019-01-28'
    })
    .then(data => {
            console.log("changeFxConversionDeliveryDateQuotation", data);
    })
    .catch(err => {
            console.log("changeFxConversionDeliveryDateQuotation err", err.message);
    });

Result

{
         "path": "e5cce1bf-af7e-4633-b6ae-bae4b8bcaf36",
         "amount": "2.00",
         "currency": "USD",
         "new_conversion_date": "2018-12-20T00:00:00+00:00",
         "new_date_fx_tx": "2018-12-20T16:30:00+00:00",
         "old_conversion_date": "2018-12-11T00:00:00+00:00",
         "old_settlement_date": "2018-12-11T16:30:00+00:00",
         "event_date_time": "2018-12-11T06:37:12+00:00"
     }

FX market rate w/ mark-up

Get the FX market rate of any currency pairs which includes your mark-up.

Required Parameters

ParameterDescription
currency_to_buyISO 4217 format
currency_to_sellISO 4217 format
side_of_fx_txChoose the side of the FX transaction
amountAmount of the fixed buy or sell currency

Usage

    Payment.fxMarketRateWithMarkUp({
        currency_to_buy: 'USD',
        currency_to_sell: 'GBP',
        side_of_fx_tx: 'buy',
        amount: 10.00
    })
    .then(data => {
       console.log("fxMarketRateWithMarkUp ", data);
     })
     .catch(err => {
        console.log("fxMarketRateWithMarkUp err", err)
     });

Result

{
    "settlement_cut_off_time": "2018-12-13T16:30:00Z",
    "currency_pair": "GBPUSD",
    "currency_to_buy": "USD",
    "currency_to_sell": "GBP",
    "amount_to_buy": "10.00",
    "amount_to_sell": "7.10",
    "side_of_fx_tx": "buy",
    "client_rate": "1.4079",
    "mid_market_rate": "1.4080"
}

FX Market Rate

Get the interbank rates for any currency pairs.

Required Parameters

ParameterDescription
currency_pairISO 4217 format(YYYY-MM-DD)

Usage

    Payment.fxMarketRate({
        currency_pair: 'GBPUSD'
    })
    .then(data => {
        console.log("fxMarketRate", data);
    })
    .catch(err => {
        console.log("fxMarketRate err", err);
    });

Result

{
    "rates": {
        "GBPUSD": [
            "1.407700",
            "1.408300"
        ]
    },
    "unavailable": []
}