Payment methods
On-chain payment methods
The paymentMethod
defines the walletAddress
, network
and token
combination a User pays a Merchant with.
A payment method can be utilized to take payments without bringing the user back on session to enter their payment method details by passing thepaymentMethodId
into the payin request.
Currently payers can only have 1 payment method. We are adding functionality to enable more than one payment method per User.
Status
Before a payment is due you can check if the status of a payment method's balance and authorization levels.
You can do this using the Get subscription endpoint by passing in the subscriptionId
that is found in the event response to initial payment in the Pay widget. If you need to retrieve the subscriptionId
you can use the List subscription endpoint and pass in the subscriptionRefId
.
The endpoint's response will include a status
object with the balance
and authorization
amounts. These amounts are in the token
also found in the response. These responses are pre-formatted for token decimals.
You can use this information to preemptively tell the payer that there is an issue with their payment that may result in it not being processed.
Handling insufficient token balance
It is up to the end User to add more money to their wallet.
Handling insufficient authorization
While the Pay component prompts the User to set a high enough authorization to cover future payments, a savvy end User may know how to change this authorization themselves by sending their own transaction to the given blockchain network. The ability to manage this authorization amount is a core feature of blockchains and cannot be overridden by Loop.
You can check that the User has enough authorization by calling the get payment method endpoint. If a User needs to increase their authorization, you can use the Pay widget to collect the necessary authorization or direct the payer to Loop's customer portal.
Updated 3 months ago