API Documentation
Offramps API
Offramps API
  • Guides
    • Getting Started
  • API Reference
    • Authentication
    • Agreements
      • Agreements#Show
    • Users
      • Users#Create
      • Users#Show
      • Users#Index
    • KYC Sessions
      • KYC#Create
    • Payment Details
      • PaymentDetails#Create
      • PaymentDetails#Index
      • PaymentDetails#Show
      • PaymentDetails#Validate
      • PaymentDetails#Deactivate
      • Rail Availability
      • Required Fields For Local Currency Payouts
      • Required Fields For Swift Currency Payouts
    • Quotes
      • How to make a payment
      • Quotes#Create
      • Quotes#Show
      • Quotes#Execute
      • Quote#Rate
    • Offramps
      • Offramps#Index
      • Offramps#Create
      • Offramps#Update
      • Offramps#Show
      • Limitations
    • Webhooks
      • KYC Webhook
      • Offramp Webhook
      • Payment Detail Webhook
      • Webhook Signatures
    • Errors
    • Conversions
      • Conversions#Create
  • Sandbox Only
    • Sandbox Special Moves
Powered by GitBook
On this page
  1. API Reference
  2. Agreements

Agreements#Show

Show the terms and conditions flow

Render the following URL in an iFrame

https://{{base_url}}/public/agreements?email={encodeURIComponent(USER_EMAIL)}

Each time a user completes an agreement, we'll send an event containing information about the agreement they signed, like { agreements: agreed_payso }. Additionally, once the entire flow is completed, we'll emit a { agreements: complete } event. You can easily listen for these events using the following JavaScript code in your frontend.

Below is an example of how you might implement the Agreement flow in your front-end. In this example we are using React, but ChatGPT can transpile this to your preferred language if you ask it nicely.

Make sure to encode the email of termsUrl with encodeURIComponent().

import React, { useRef }  from 'react';

const Agreements = ({ onComplete }) => {
  const iframeRef = useRef();
  const termsUrl = 'https://{{base_url}}/public/agreements?email={encodeURIComponent(USER_EMAIL)}'

  // Set up a listener for the event that is fired when the user signs the Agreement
  useEffect(() => {
    window.addEventListener("message", onCompleteHandler);
    return () => {
      window.removeEventListener("message", onCompleteHandler);
    };
  }, []);

  // Do something in your UI when the event fires
  const onCompleteHandler = (event) => {
    if (event.data.agreements === 'complete') {
      onComplete();
    } else if (Object.keys(event.data.agreements).find(i =>i.includes("agreed"))) {
      // When a user has signed an agreement, refresh the termsUrl.
      // This improves cross-browser support and prevents caching issues.
      iframeRef.current.src = termsUrl
    }
  }

  // Render the Agreement, passing in the User's email as a query parameter
  return <iframe ref={iframeRef} src={termsUrl} />
}

export default Agreements;

If a User is created with a different email, or did not complete the flow, then it's likely they won't be cleared to use the service.

PreviousAgreementsNextUsers

Last updated 4 months ago

Once the flow has been completed, you can then with the same email that was used to sign the Agreement.

create a User object