Integrate with MoneyGram Access
This document guides the reader through the technical requirements for integrating MoneyGram Access into an existing application. MoneyGram Access is a MoneyGram product that enables users of third-party applications, such as crypto wallets and exchanges, to cash-in (deposit) and cash-out (withdrawal) of Stellar USDC.
MoneyGram requires businesses to go through an onboarding process in order to get access to their testing and production environments. To get started with this process, reach out to [email protected].
Resources​
- MoneyGram Access Wallet MVP Implementation
- Use this MVP implementation as a reference for building your own integration. Many of the code snippets shared in this document are pulled from this project.
- Stellar Wallet SDK Docs
- Use this Wallet SDK to facilitate building your own integration. Many of the code snippets shared in this document are pulled from the Stellar Wallet SDK repository.
- Stellar Test Anchor
- Before getting access to MoneyGram's test environment, you can use the SDF's test anchor while developing your integration
- Stellar Demo Wallet
- This application visualizes the API calls necessary to connect to a Stellar Anchor
- Stellar Ecosystem Proposal 24 (SEP-24)
- The standardized API protocol for Stellar on & off ramps, implemented by MoneyGram
- Stellar Ecosystem Proposal 10 (SEP-10)
- The standardized API protocol for Stellar authentication, implemented by MoneyGram
Asset Information​
Before you get access to MoneyGram's test environment, you should test your implementation with the SDF's Stellar Test Anchor. It implements the same APIs as MoneyGram's service but uses a different asset. The information for each asset is below.
Stellar Reference Token​
This token is only on testnet.
- Issuing Account: GCDNJUBQSX7AJWLJACMJ7I4BC3Z47BQUTMHEICZLE6MU4KQBRYG5JY6B
- Asset Code: SRT
USD Coin​
Testnet:
- Issuing Account: GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5
- Asset Code: USDC
Pubnet:
- Issuing Account: GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN
- Asset Code: USDC
Introduction​
Applications seeking to integrate MoneyGram Access must implement the client side of Stellar Ecosystem Proposal 24 (SEP-24), a standardized protocol defined for applications to connect to businesses such as MoneyGram, more generally called anchors, that offer Stellar deposit & withdrawal services utilizing local payment rails.
This document will walk you through the necessary steps to develop a functional implementation of this standard.
The guide will assume your application is first being developed on Stellar’s test network and using MoneyGram’s testing deployment of Access, but there are no functional differences deploying the application to Stellar’s public network and using MoneyGram’s production deployment.
Installing the Wallet SDK​
We highly recommend using the wallet SDK to facilitate building your integration. Find more info on the Stellar Wallet SDK Docs.
You can use yarn
to install it:
- bash
yarn add @stellar/typescript-wallet-sdk
Custodial vs. Non-Custodial Applications​
Some applications, such as centralized exchanges, are custodial, meaning the application has access to the private keys of the acccounts holding its users’ funds on Stellar. Typically, custodial applications pool user funds into a smaller set of managed Stellar accounts, called pooled, shared, or omnibus accounts.
Other applications are non-custodial, meaning the application does not have access to the private keys of the accounts holding its users' funds on Stellar. Typically, non-custodial applications create or import a pre-existing Stellar account for each user.
These two approaches require minor but concrete differences in how applications integrate with MoneyGram Access. The sub-sections below will describe these differences, but the rest of this tutorial will assume the application is custodial.
Authentication​
MoneyGram needs to authenticate both the user and the application being used via Stellar's SEP-10 protocol.
Custodial applications are identified by the Stellar account public key they register with MoneyGram during the onboarding process. When authenticating, the application must pass this public key as the account
query parameter, and to identify the user, the application must pass a unique integer ID as the memo
query parameter. MoneyGram will return a Stellar transaction that must be signed by the application's private key and sent back for verification.
Because each user of a non-custodial application has their own Stellar account, non-custodial applications are identified by the home domain they register with MoneyGram during the onboarding process. When authenticating, the application must pass the user's public key as the account
query parameter, and pass their home domain as the client_domain
query parameter. MoneyGram will look up the SIGNING_KEY
value at https://<client_domain>/.well-known/stellar.toml
, and return a Stellar transaction that requires signatures from both the user's private key & the private key of the public SIGNING_KEY
on the application's SEP-1 stellar.toml file. An example file can be found at https://vibrantapp.com/.well-known/stellar.toml.
Transaction Initiation​
Because users of custodial applications don't have individual Stellar accounts, only the application knows how much money a user has to withdraw. Because of this, MoneyGram requires custodial applications to always pass the amount
field in the request to start a new transaction. Non-custodial applications do not need to do this, although they can if they prefer.
Source & Destination of Funds​
MoneyGram requires custodial applications to provide the Stellar accounts that may be used as the source or destination of funds during the onboarding process. For non-custodial applications, MoneyGram requires the source and destination of funds for each transaction to be the same account that was authenticated via SEP-10.