Implementation Overview
Below are high level steps to implementing Loop.
Getting set up
1. Create your account
When you create your account, you will be able to set the payout destination as well as the tokens
and networks
that an end User can pay Merchants. If the payout destination is a bank account, you will need to complete KYB.
Relevant API: Create entity
2. Configure merchants
Before you can process payments through our system, each Merchant needs to be configured in Loop. Here you can optionally define the tokens
, networks
and payout destination
that an end User can pay a given Merchant.
Relevant API: Create merchant
3. Configure webhooks
You will need to configure webhooks to hear about payment confirmations and failures.
The only field thats required in the create webhook request is the postUrl
which is where the webhook will be sent to (it does allow for more detailed control but thats the easiest setup). Once that's configured, the URL that you configured will get an event each time a payin
is created and when the payin
is processed on chain.
Relevant API: Create webhooks
4. Set up your payment gateway
Before you can charge a customer, you must create a paymentMethod
in Loop and get the wallet's approval.
The easiest way to enable this is by embedding Loop's Pay component in your checkout process. When the Pay component is used, it will create a customer
and paymentMethod
and allow you to initiate the first payin
. Our components are configurable, embeddable web components designed to simplify your integration to Loop while retaining your platform's look, feel and control of your Merchant and User's experience.
If you would like to not use Loop's component, you can create the customer
, paymentMethod
and gather the approval yourself. Here are directions and sample code to get the wallet's approval.
Relevant API: Create customer
Taking payments
5. Take the first payment
Using Loop's Component
When initiating the Pay component, you will tell the component which Merchant is being paid and for how much. Using the MerchantId
, the component will show only the pre-configured networks
and tokens
. The User will be able to connect their wallet and click Pay. This will initiate:
- Creating the
customer
in Loop - Assigning that
customer
thispaymentMethod
and marking that method asdefault
- Initiate the first payment using the parameters passed in
- Check the
paymentMethod
’s status to confirm the payment will be successful - Respond with any steps to rectify errors (e.g. low balance or low authorization)
- Initiate the Create payin if authorization and balance checks have passed
- Respond with any success or error codes as well as the
customerId
that is used to send additional payins for this customer
Use APIs to take the first payment
If you are using our APIs directly then you will need to repeat each of the steps above by calling our API endpoints.
- If not already done, you will need to create the
customer
with a payment method by calling the Create customer endpoint - Check the
paymentMethod
’s status by calling the GET Payment Method endpoint - Send a
payin
request if authorization and balance checks have passed using the Create Payin endpoint - Listen to webhooks for response
6. Send Loop subsequent payments
While the Pay component allows Merchants to get paid for the 1st payment, all subsequent payments must be sent using the Create Payin endpoint.
That's it!
Additional considerations
You may want to embed page payment history (List Payins), showing payment methods (List payment methods), allowing management of payment methods to end Users (Create and Delete payment method), showing payout destinations (List payout destination) and allowing management of payout destinations (Create and Delete).
Updated 2 months ago