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
1
LimePay.payments.get(paymentId) // returns new Promise<>
2
.then(payment => {})
3
.catch(error => {});
Copied!
Returns object of the Payment, once the promise is resolved.
1
limePay.Payments.Get(paymentID string) // returns (*types.Payment, error)
Copied!
Returns a pointer to Payment object and an error.

Getting All Payments

The following function retrieves all payments created:
Node.js
Go
1
LimePay.payments.getAll() // returns new Promise<>
2
.then(payments => {})
3
.catch(error => {});
Copied!
Returns array of Payment objects, once the promise is resolved.
1
limePay.Payments.GetAll() // returns (*[]types.Payment, error)
Copied!
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
1
LimePay.fiatPayment.create(paymentData, signerConfig) // returns new Promise<>
2
.then(payment => {})
3
.catch(error => {});
Copied!
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
1
limePay.FiatPayments.Create(paymentData types.Payment, privateKey string)
2
// returns (*types.Payment, error)
Copied!
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
1
LimePay.relayedPayment.create(paymentData, signerConfig) // returns new Promise<>
2
.then(payment => {})
3
.catch(error => {});
Copied!
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
1
limePay.RelayedPayments.Create(paymentData types.Payment, privateKey string)
2
// returns (*types.Payment, error)
Copied!
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
1
LimePay.fiatPayment.getInvoice(paymentId) // returns new Promise<>
2
.then((invoice) => {})
3
.catch(error => {});
Copied!
String containing the invoice (in HTML format) will be returned, once the promise is resolved.
1
limePay.FiatPayments.GetInvoice(paymentID string)
2
// returns (string, error)
Copied!
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
1
LimePay.fiatPayment.sendInvoice(paymentId) // returns new Promise<>
2
.then(() => {})
3
.catch(error => {});
Copied!
1
limePay.FiatPayments.SendInvoice(paymentID string)
2
// returns error
Copied!
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
1
LimePay.fiatPayment.getReceipt(paymentId) // returns new Promise<>
2
.then((receipt) => {})
3
.catch(error => {});
Copied!
String containing the receipt (in HTML format) will be returned, once the promise is resolved.
1
limePay.FiatPayments.GetReceipt(paymentID string)
2
// returns (string, error)
Copied!
String containing the receipt (in HTML format) and an error.

Related Resources:

Last modified 2yr ago