This section outlines any additional integrations that can be done to extend the Currency Manager Extension functionality to different parts of the Rehive’s ecosystem.
Integrating with the Conversion Extension flows
A currency manager that links to a third party system that provides endpoints for handling conversions and quotes can integrate directly with Rehive’s Conversion Extension to use the third party as the underlying quote and conversion mechanism. This can be done by implementing the Conversion Quote Integration within the currency manager extension. Guide coming soon!
Integrating with the Payment Requests Extension (PRS)
In order for a payment manager to integrate with the PRS payment processing it needs to provide an endpoint which returns a standard set of payment information as well as stores the PRS quote id to be used by the payment manager when creating the transaction.
Flow
- The PRS sends quote information to the payment processor (in this case the currency manager extension).
- The payment processor stores the quote id as well as generates any required deposit/payment information a user might need to fulfill the payment. This is returned to the PRS.
- The wallet displays this payment information to the end user. The end user then makes a payment.
- The payment processor processes this payment as usual. Making sure to include the Quote ID stored in step three within the transaction metadata.
With the above flow in mind this is what the Currency Manager Extension needs to implement to support this flow:
- Add a
/payment
endpoint which handles the following fields being sent:
{
"id": "string",
"request": 0,
"reference": "string",
"currency": "string",
"amount": 0,
"expiration_date": "string",
"status": "pending",
"account": "string"
}
- When receiving a request on the
/payment
endpoint store theid
of the Quote object being sent through. Optionally store theaccount
object as this is Rehive account the payment is expected to be made too. - Using the currency generates the required payment information a user would need in order to make a payment via the third party ledger of the manager. For example if this was an XLM quote and the currency manager supported crypto wallet generation it should generate a unique XLM wallet for the user to make the payment too.
- Detect the deposit using it’s usual third party ledger syncing logic
- Once detected make a credit transaction to the
account
stored earlier as well as including theid
stored in the transaction metadata location:service_payment_requests: {“quote”: {“id”: id}}
- Complete/Fail the transaction as per the usual syncing logic
For a full description of the integration read the full Payment Requests Extension protocol. Additionally more general information on the PRS can be found here as well as Merchant integration docs here.