PaymentServer

PaymentServer

Facilitates interaction with the TBC payment server.

Constructor

new PaymentServer(sdk, serverUrl, opts)

Create a new payment server instance.

Source:
Parameters:
Name Type Description
sdk ShelfNetwork

Parent SDK instance.

serverUrl string

payment server URL.

opts Object
Name Type Attributes Default Description
allowHttp boolean <optional>

Allow connecting to http servers, default: false. This must be set to false in production deployments!

proxy Object <optional>

Proxy configuration. Look axios docs for more info

httpBasicAuth Object <optional>

HTTP basic auth credentials. Look axios docs for more info.

customHeaders Object <optional>

Custom headers for request.

responseType string <optional>
'json'

Indicates the type of data that the server will respond with options are 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream'.

Classes

PaymentServer

Methods

confirm(opts) → {Promise.<JsonApiResponse>}

Confirm a transaction.

Source:
Parameters:
Name Type Description
opts object

Payment details.

Name Type Description
transactionId string

Transaction ID.

Returns:
Type:
Promise.<JsonApiResponse>

Payment server response.

create(opts) → {Promise.<JsonApiResponse>}

Preauthorize a transaction.

Source:
Parameters:
Name Type Description
opts object

Payment details.

Name Type Attributes Description
currency string

Payment currency.

amount string

Payment amount in cents.

description string

Payment description.

purpose string

Payment purpose.

invoiceId string <optional>

Invoice id.

redirect string <optional>

Custom redirect.

language string <optional>

ISO 639-1 code of the desired UI language.

Returns:
Type:
Promise.<JsonApiResponse>

Payment server response.

createTransactionV2(opts) → {Promise.<JsonApiResponse>}

Preauthorize a transaction.

Source:
Parameters:
Name Type Description
opts object

Payment details.

Name Type Attributes Description
currency string

Payment currency.

amount string

Payment amount in cents.

description string

Payment description.

purpose string

Payment purpose.

preauth boolean <optional>

If true, blocks money instead of committing.

invoiceId string <optional>

Invoice id.

redirect string <optional>

Custom redirect.

language string <optional>

ISO 639-1 code of the desired UI language.

Returns:
Type:
Promise.<JsonApiResponse>

Payment server response.

get(transactionId) → {Promise.<JsonApiResponse>}

Get a transaction ID.

Source:
Parameters:
Name Type Description
transactionId string

Transaction ID.

Returns:
Type:
Promise.<JsonApiResponse>

Payment server response.

getPage(queryopt) → {Promise.<JsonApiResponse>}

Get a page of transactions.

Source:
Parameters:
Name Type Attributes Description
query object <optional>

Request options.

Name Type Attributes Description
page.cursor Number <optional>

Pagination cursor.

page.limit Number <optional>

Page size.

sort Array.<string> <optional>

Sorting params.

accountId string <optional>

Filter by account ID.

status string <optional>

Filter by payment status.

purpose string <optional>

Filter by payment purpose.

invoiceId string <optional>

Filter by invoice ID.

Returns:
Type:
Promise.<JsonApiResponse>

Payment server response.

reverse(opts) → {Promise.<JsonApiResponse>}

Reverse a transaction.

Source:
Parameters:
Name Type Description
opts object

Payment details.

Name Type Description
transactionId string

Transaction ID.

Returns:
Type:
Promise.<JsonApiResponse>

Payment server response.