The technical preview of Corda Payments is here!

Corda Jan 13 2022 By: Iryna Tsimashenka
Comments

1 Comments

Views

7,459 Views

Corda Payments SDK Developer preview: Announcement Letter
Iryna Tsimashenka
Iryna Tsimashenka Developer Relations Lead – EMEA/India
Share this post:
Copied

R3 has launched the Technical Preview of Corda Payments, new payment initiation and processing module for CorDapps. Corda Payments enables developers to quickly connect to traditional off-ledger payment rails and payment service providers with minimal coding. Corda Payments includes out-of-the-box integration with Modulr — a banking as a service provider for UK and EU real-time payments that can initiate a payment on behalf of the customer. With minimal code, developers can initiate a payment instruction, check balances, review transaction history, and view the payment status. The agent application then orchestrates the payment by taking the instructions from the payment flow and routing the transaction to Modulr.

Sign up for your Corda Payments trial today on Customer Hub.

How It Works

Corda Payments Technical Preview comprises of two core components:

1) Agent CorDapp: a closed source JAR operated by a Business Network Operator. It can use an existing Corda network or establish a new permissioned Corda Payments Network. The operator needs to own a node and install the Corda Payments Agent CorDapp.

  • Gateway Service: this collects payment requests from the vault within the Agent Cordapp and makes a call to the REST API endpoints of the PSP to try and process the payment.

2) Corda Payments SDK: a library that integrates with the user’s CorDapp allowing the end-user to initiate a payment. You can use it to send payment instructions on the Corda Payments Network to the Agent.

Additionally, we are providing :

  • Sample Agent UI — This is a sample React front end which can be used with the Agent to provide an enhanced user experience for testing and using the Corda Payments system
  • Sample Client UI — This is a sample React front end which connects to one of the nodes on the network and can carry out limited functionality using the SDK. This front is an easy way to view the capabilities of the SDK without having to write code.
  • Sample Cordapp — This is a sample Cordapp template which includes SDK configuration instructions and sample code to showcase how to integrate the SDK into a new or an existing Cordapp. This is not a Cordapp in the traditional sense but a template to allow one to easily setup a Cordapp

This diagram shows high-level components included in the preview and an example of a simple payment flow.

High-level payment workflow and components
Diagram 1. High-level payment workflow and components

Features

The main features are the:

Client CorDapp

The end-user writes business logic and creates payment instructions.

Agent

Trusted party on the network — usually the Business Network Operator. As the agent, you will facilitate payments through to the integration with the PSP: Modulr. The agent is responsible for

  • Setting up the customer account on Modulr on behalf of the customer and removing the pain of KYB and compliance checks.
  • Payment facilitator Since it sits in the middle of the business network, the agent facilitates payment instructions. An agent can’t make payment on the user’s behalf but can review any errors that may occur when processing the transaction.

PSP

An external payment service provider (PSP). Our current integration is with Modulr who provides us with direct access to UK Faster Payments and SEPA. We are working with Modulr to establish other alternative payment routes on behalf of the Agent. The workflow is:

  1. An end-user initiates payment instructions to make a payment.
  2. The agent sends the payments to the PSP.
  3. The PSP responds to say that the payment has been successfully received and accepted
  4. The PSP will then sends a second payment status to confirm settlement success
  5. The agent receives the payment status from the PSP and in turns updates the payment status through to the Cordapp for end user visibility.

We have designed the technical preview to provide the core payment capabilities our Corda customers require, whilst delivering a seamless digital experience as the user remains within the Corda environment. Payments will be processed off the ledger using traditional payments rails. Payments rails are optimized to offer the fastest settlement service and status is tracked and updated on the ledger and held within the vault.

Low-level Components of Corda Payments

This diagram shows the end-user infrastructure and the agent infrastructure in more detail.

Low-level Components of Corda Payments
Diagram 2. Low-level Components of Corda Payments

R3 provides fully prewritten end user and agent infrastructure. It contains the:

  • Agent CorDapp, the network operator, installs this on the agent node.
  • Key storage, for storing agent’s credentials.

The agent exposes the agent REST API for agent operations staff to interact with the agent infrastructure. There will also be a sample Agent GUI provided as part of the release

The above diagram shows the components of a Business CorDapp:

User-written components

  • Business CorDapp flows
  • Web server
  • Business CorDapp UI

The Payments SDK

  • Payment Flows APIs
  • The State Machine, which is shared with the agent CorDapp, and the vault listener.

The end-user interacts with the Payments CorDapp. Business CorDapp flows use Payments SDK calls and interacts with the payments infrastructure. The end-user needs to write business logic to drive Payments SDK calls. The payments SDK provides an easy way to integrate a set of generic Payments Service APIs, which trigger the State Machine to execute payments and return a status update to the Vault Listener.

Here’s an example of a payment execution from the user’s perspective, simplified to one line. Consider the following example of establishing a connection (line 1), getting a list of nodes on the network (line 3), and making payment (line 20):


val clientConnection = client.start(rpcUsername, rpcPassword)
val proxy = clientConnection.proxy
val nodes = proxy.networkMapSnapshot()

val partyA = getNodeWithName(nodes,"PartyA", "O=PartyA, L=London, C=GB")
val partyB = getNodeWithName(nodes,"PartyB", "O=PartyB, L=New York, C=US")

// Instead of searching for accounts owned by PartyA you can simply pass the PaymentAccountId to the MakePayment flow
val accountA = proxy.startTrackedFlow(
    ::PaymentAccounts,
    partyA
).returnValue.getOrThrow().first()

// Instead of searching for accounts owned by PartyB you can simply pass the PaymentAccountId to the MakePayment flow
val accountB = proxy.startTrackedFlow(
    ::PaymentAccounts,
    partyB
).returnValue.getOrThrow().first()

val paymentState = proxy.startTrackedFlow(
    ::MakePayment,
    250 of GBP,
    accountA.accountId,
    accountB.accountId
).returnValue.getOrThrow()

Code snippet: https://gist.github.com/iryna-09/b91709491e5f950d43ea250618ce03ce

Payment can be achieved through a simple one-line payment instruction with only three parameters (amount, debtor, and creditor).

We are keen to get feedback and comments on Corda Payments to make improvements and meet your needs. For this and together with any questions please use our Slack payments channel.

Sign up for your trial on Customer Hub to start using Corda Payments today!

Iryna Tsimashenka
Iryna Tsimashenka Iryna Tsimashenka is the developer relations lead for EMEA/India at R3, an enterprise blockchain software firm working with a global ecosystem of more than 350 participants across multiple industries from both the private and public sectors to develop on Corda, its open-source blockchain platform, Corda Enterprise, a commercial version of Corda for enterprise usage, and Conclave, a confidential computing platform. Follow Iryna on LinkedIn here.

Reader Comment 1

  1. Lazar Iliev Iliev

    The diagram is not clear.

Leave a Reply

Subscribe to our newsletter to stay up to date on the latest developer news, tools, and articles.