Payments

The SDK provides payment management functionalities that are documented here.

Actions

In order to consume the Payment's functionality you have to connect the SDK first. You can find more information on how to do that in the Installation section.

Getting Payment by ID

The following function retrieves a payment object by Id:

Node.js
Go
LimePay.payments.get(paymentId) // returns new Promise<>
.then(payment => {})
.catch(error => {});

Returns object of the Payment, once the promise is resolved.

limePay.Payments.Get(paymentID string) // returns (*types.Payment, error)

Returns a pointer to Payment object and an error.

Getting All Payments

The following function retrieves all payments created:

Node.js
Go
LimePay.payments.getAll() // returns new Promise<>
.then(payments => {})
.catch(error => {});

Returns array of Payment objects, once the promise is resolved.

limePay.Payments.GetAll() // returns (*[]types.Payment, error)

Returns an array of Payment objects and an error.

Creating Fiat Payment

You can create Fiat Payment by performing the performing the following function:

Node.js
Go
LimePay.fiatPayment.create(paymentData, signerConfig) // returns new Promise<>
.then(payment => {})
.catch(error => {});

Object of type Payment is returned, once the promise is resolved.

Where signerConfig is the wallet configuration of a wallet that is marked as signer in the Escrow Contract.

You can find more information of the different kinds of signer configurations here.

paymentData is object with the following properties:

Field

Type

Description

Required

currency

string

Currency code (ISO 4217) of the amount to be charged

Yes

shopper

string

The ID of the shopper that will be charged

Yes

items

array

Array of Item objects

Yes

fundTxData

object

Fund Transaction Data object

Yes

genericTransactions

array

Array of Generic Transaction objects

Yes

Fund Transaction Data

Field

Type

Description

Required

weiAmount

string

Amount of ethers that the shopper will be funded with

Yes

tokenAmount

string

Amount of tokens that the shopper will be funded with

No

gasPrice

string

Gas price used when funding shopper. Only applicable for Escrow Version 3 contracts

No

Generic Transaction

Field

Type

Description

Required

to

string

Address that the transaction will be send to

Yes

gasPrice

string

Gas price of the transaction

Yes

gasLimit

integer

Gas limit of the transaction

Yes

functionName

string

Name of the contract's function

Yes

functionParams

array

Array of Function Parameter objects.

No

limePay.FiatPayments.Create(paymentData types.Payment, privateKey string)
// returns (*types.Payment, error)

Returns a pointer to Payment object and an error.

Where paymentData is object with the following properties:

Field

Type

Description

Required

Currency

string

Currency code (ISO 4217) of the amount to be charged

Yes

Shopper

string

The ID of the shopper that will be charged

Yes

Items

[]Item

Array of Item objects

Yes

FundTxData

FundTxData

Fund Transaction Data object

Yes

GenericTransactions

[]GenericTransaction

Array of Generic Transaction objects

Yes

FundTxData

Field

Type

Description

Required

WeiAmount

string

Amount of ethers that the shopper will be funded with

Yes

TokenAmount

string

Amount of tokens that the shopper will be funded with

No

GenericTransaction

Field

Type

Description

Required

To

string

Address that the transaction will be send to

Yes

GasPrice

string

Gas price of the transaction

Yes

GasLimit

int

Gas limit of the transaction

Yes

FunctionName

string

Name of the contract's function

Yes

FunctionParams

[]FunctionParams

Array of Function Parameter objects.

No

Creating Relayed Payment

You can create Relayed Payment by performing the performing the following function:

Node.js
Go
LimePay.relayedPayment.create(paymentData, signerConfig) // returns new Promise<>
.then(payment => {})
.catch(error => {});

Object of type Payment is returned, once the promise is resolved.

Where signerConfig is the wallet configuration of a wallet the is marked as signer in the Escrow Contract.

You can find more information of the different kinds of signer configurations here.

paymentData is object with the following properties:

Field

Type

Description

Required

shopper

string

The ID of the shopper that will be charged

Yes

fundTxData

object

Fund TX Data object

Yes

genericTransactions

array

Array of Generic Transaction objects

Yes

Fund Transaction Data

Field

Type

Description

Required

weiAmount

string

Amount of ethers that the shopper will be funded with

Yes

gasPrice

string

Gas price that will be used when funding shopper. Applicable only for Version 3 Escrows

No

Generic Transaction

Field

Type

Description

Required

to

string

Address that the transaction will be send to

Yes

gasPrice

string

Gas price of the transaction

Yes

gasLimit

integer

Gas limit of the transaction

Yes

functionName

string

Name of the contract's function

Yes

functionParams

array

Array of Function Parameter objects.

No

limePay.RelayedPayments.Create(paymentData types.Payment, privateKey string)
// returns (*types.Payment, error)

Returns a pointer to Payment object and an error.

Where paymentData is object with the following properties:

Field

Type

Description

Required

Currency

string

Currency code (ISO 4217) of the amount to be charged

Yes

Shopper

string

The ID of the shopper that will be charged

Yes

Items

[]Item

Array of Item objects

Yes

FundTxData

FundTxData

Fund Transaction Data object

Yes

GenericTransactions

[]GenericTransaction

Array of Generic Transaction objects

Yes

FundTxData

Field

Type

Description

Required

WeiAmount

string

Amount of ethers that the shopper will be funded with

Yes

TokenAmount

string

Amount of tokens that the shopper will be funded with

No

GenericTransaction

Field

Type

Description

Required

To

string

Address that the transaction will be send to

Yes

GasPrice

string

Gas price of the transaction

Yes

GasLimit

int

Gas limit of the transaction

Yes

FunctionName

string

Name of the contract's function

Yes

FunctionParams

[]FunctionParams

Array of Function Parameter objects.

No

Getting Invoice for Payment

By performing the following function, you can retrieve the Invoice that will be send to your customer for a given payment:

Node.js
Go
LimePay.fiatPayment.getInvoice(paymentId) // returns new Promise<>
.then((invoice) => {})
.catch(error => {});

String containing the invoice (in HTML format) will be returned, once the promise is resolved.

limePay.FiatPayments.GetInvoice(paymentID string)
// returns (string, error)

String containing the invoice (in HTML format) and an error.

Sending Invoice for Payment

You can trigger the sending of an invoice for a given payment by executing the following function:

Node.js
Go
LimePay.fiatPayment.sendInvoice(paymentId) // returns new Promise<>
.then(() => {})
.catch(error => {});
limePay.FiatPayments.SendInvoice(paymentID string)
// returns error

Returns only an error.

Getting Receipt for Payment

By performing the following function, you can retrieve the Receipt that will be send to your customer for a given payment:

Node.js
Go
LimePay.fiatPayment.getReceipt(paymentId) // returns new Promise<>
.then((receipt) => {})
.catch(error => {});

String containing the receipt (in HTML format) will be returned, once the promise is resolved.

limePay.FiatPayments.GetReceipt(paymentID string)
// returns (string, error)

String containing the receipt (in HTML format) and an error.

Related Resources: