PaymentServer

PaymentServer

Facilitates interaction with the wallet server.

Constructor

new PaymentServer(sdk, serverUrl, opts)

Create a new wallet server instance.

Source:
Parameters:
Name Type Description
sdk ShelfNetwork

Parent SDK instance.

serverUrl string

wallet 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.

withCredentials boolean <optional>

Indicates whether or not cross-site Access-Control requests should be made using credentials.

responseType string <optional>
'json'

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

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.

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.