Payment methods

The paymentMethod defines the walletAddress, network and tokencombination a User pays a Merchant with.

A payment method can be utilized to take payments without requiring the User to connect with wallet again by passing thepaymentMethodId into the payin request.

Currently payers can only have 1 default payment method, but can have many payment methods on file. Merchants can optionally choose which payment method they want to charge and Users.

Manage Widget

Loop provides a "Payment Methods" component that Merchants can embed on their UIs to allow Users to manage their saved payment methods, including viewing, editing authorization amounts, adding new methods, and setting default payment methods.

Merchants can pass in a customerId or customerRefId to show a customer's payment methods. If no customer information is passed in, Loop will create a new customer.

Technical documentation is found here and a demo widget is found here.

Status

Before a payment is due you can check if the status of a payment method's balance and authorization levels. 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.

You can do this using the GET payment method endpoint by passing in the paymentMethodId that is found in the event response to initial payment in the Pay widget. If you need to retrieve the paymentMethodId you can use the List payment method endpoint.

The endpoint's response will include a status object with the balance and authorization amounts. These amounts are in the token amount and pre-formatted for token decimals. For stablecoins, like USDC and USDT, the token amount is equal to $1. For all other tokens, you will need to convert to the fiat amount yourself. You can use a data feed, like CoinMarketCap or 0xMatch, to get the exchange rate.

Handling insufficient token balance

It is up to the end User to add more money to their wallet. The Manage Widget will show the user their balance.

Handling insufficient authorization

While the Pay component prompts the User to set a high enough authorization to cover future payments, this amount is consumed as payment occur onchain. Thus, a User need to increase their authorization. This functionality is a core feature of blockchains and cannot be overridden by Loop.

If a User needs to increase their authorization, you can use the Manage Widget to provide a place for Users to easily adjust their authorization amount.