Transfers
Get Transfers
The getTransfers
function gets all transfers that belongs to your entity and matches the query.
Parameters
Takes an object that represents the query params to filter the transfers, with the properties below. If null, the request will return all transfers under your main entity.
transferId
(string): The Loop ID of the transfer you are looking for.wallet
(string): Filter transfers by the from / to wallet addresses.networkId
(number): The network Id of the transfers.entityId
(string): The entity Id that the transfers are associated with. This can be your env var entity ID or a child entity ID.
Returns
Promise<object[]>:
A promise that resolves with the array of transfers.
Example
Sign Transfer
The signTransfer
function takes a transfer
object as input and returns a signed message with your Loop contract signer key.
Parameters
The transfer
object requires the following properties:
invoiceId
(string): Invoice ID related to the transfer. Can be a stripe ID or an internal ID you have in your system.fromAddress
(string): Wallet address where funds are pulled from.toAddress
(string): Wallet address where funds are going to.tokenAddress
(string): Address of the token used to pay.amount
(number): Amount to bill. Iftransfer.usd
is true, specify the amount in cents (e.g. 2999 for $29.99). Iftransfer.usd
is false, specify the native token amount (e.g. 1000000 for 1 USDC).usd
(boolean): Whether the amount is denominated in USD.
Returns
Promise<string>:
A promise that resolves with the signed message of the transfer.
Example
Sign and Send a Transfer
The signSendTransfer
function signs the transfer and sends it to the Loop API. It takes in a transfer
object as its parameter and returns a promise that resolves with the list of transfers that were successfully sent.
Parameters
The transfer
object has the following properties:
invoiceId
(string): Invoice ID related to the transfer. Can be the stripe ID or an internal ID you have in your system.itemId
(string): Loop Item ID that is associated with the transfer.fromAddress
(string): Wallet address where funds are pulled from.toAddress
(string): Wallet address where funds are going to.tokenAddress
(string): Address of the token used to pay.amount
(number): Amount to bill. If opts.usd is true, specify the amount in cents (e.g. 2999 for $29.99). If opts.usd is false, specify the native token amount (e.g. 1000000 for 1 USDC).usd
(boolean): Whether the amount is denominated in USD.billDate
(number) [Optional]: The date the transfer should be executed on, formatted as a UNIX timestamp in seconds. Not specified or 0 indicates immediate processing.entityId
(string) [Optional]: If not specified, it will use your LOOP ID inferred by the API KEY.
Returns
Promise<object[]>
: A promise that resolves with the list of transfers that were successfully sent.
Example
Send Transfers
The sendTransfers
function sends a list of transfers to the Loop API.
Parameters
Takes an array of transfers to be sent to Loop, with the properties below:
invoiceId
(string): The invoice ID of the transfer.entityId
(string): Your Loop Entity ID.networkId
(number): The network Id of the transfer.planId
(string): Loop Item ID that is associated with the transfer.from
(string) Wallet address where funds are pulled from.to
(string): Wallet address where funds are going to.token
(string): Address of the token used to pay.amount
(string): Amount to bill. Ifusd
is true, specify the amount in cents (e.g. "2999" for $29.99). Ifusd
is false, specify the native token amount (e.g. "1000000" for 1 USDC).usd
(boolean): Whether the amount is denominated in USD.signature
(string): The signed transfer message. If delegated signing is enabled, this should just be an empty string.billDate
(number): The date the transfer should be executed on, formatted as a UNIX timestamp in seconds. Use the value 0 to indicate immediate processing.
Returns
Promise<object[]>
: A promise that resolves with a list of successfully sent transfers.
Example
Cancel Transfers
The cancelTransfers
function cancels a list of transfers on the Loop API.
Parameters
transferIds
(string[]): The list of transfer IDs to be cancelled.
Returns
A promise that resolves with the list of transfers that were cancelled.
Example
Last updated