Lagom Link
The first step to enable Lagom on your webpage is to add a link to the lagom.org/payout
payment page. This link contains 3 query-parameters elements.
https://lagom.org/payout?
provider=test-provider&
amount=100&
cb=aHR0cHM6Ly9leGFtcGxlLmNvbS9leGFtcGxl
- The provider ID, as displayed on the dashboard
- The amount to pay for, in cents of the currency of defined for the provider
- And the base64 encoded callback URL, to reach once the payment is completed by Lagom
Recommended Implementation
We recommend using a callback on the same URL (current URL of webpage), and detect the presence of a Lagom payment on your webserver or CDN. This will allow your callback to be dynamically generated, independently of where it is running (production or testing environment, locally, etc…).
In order to do this, you can use the following HTML link tag that embeds an inlined Javascript function.
<a href="#" onclick="(function a(event) { location.href = 'https://lagom.org/payout?amount=100&provider=test-provider&cb=' + btoa(location.href) })()">
This is a paid article, click here to read with Lagom
</a>
Reusable payments
By default, a Lagom user can access the same content from a provider multiple times freely. To enforce a re-payment for every visit, simply add the query-parameter reusable=no
to the payment link.