In the first chapter, we learned that Ripple allows you to exchange not just Ripple but anything of value. This means you can send currencies, such as USD and EUR, through Ripple. This is made possible because Ripple allows organizations or institutions to issue currency. This issued currency is tied to holdings of currency outside Ripple's ledgers. So, a bank X can issue USD in the form of an XRP ledger asset by holding the money outside.
Now, there's a problem of trust. How can you ensure that the digital asset issued you through Ripple can be redeemed for USD later? Hence, Ripple allows you to create a trust line between you and the issuer. You can select the maximum limit that an issuer can owe you. Ripple therefore uses issued currency and trust lines to enable the exchange of anything of value.
Now, let's get back to cross-currency payments. Ripple allows traders to create offers on the Ripple ledger.
Let's say John does forex trading, and he actively creates offers on Ripple's ledger book. The last offer he created was that he was willing to buy dollars for euros at a fixed exchange rate($1.25 = €1).
Paul who lives in the United States wants to send €500 to his friend in Europe. Paul comes to Ripple to make a cross-currency payment. However, there's a problem; he can't know for sure at what rates his money would be exchanged before making the transaction. He has two ways of making this cross-currency payment:
- He can send a fixed money at a variable cost to him. Here, he wants to make sure his friend receives exactly €500 and he's willing to bear the price for it.
- He can send a variable amount at a fixed cost to him. Here, he's only willing to spend $600, however, his friend might receive, say, €480, depending on the exchange rates. Such payments are called partial payments in Ripple.
Paul will be able to see the offers posted by traders on the Ripple's ledger. Since Ripple selects the offer that's the cheapest, Paul can make a guess. However, since a high volume of transaction happens in Ripple, the offer could be redeemed by someone else before Paul.
Paul decides to send a fixed money of €500 at a variable cost to him. Ripple's system checks for the best offer and finds John's offer is good. According to John's exchange rate, Paul is debited with $625. John's €500 is sent to Paul's friend and John is credited with $625. That's how Ripple makes cross-currency payments happen.
The following diagram demonstrates the flow of transaction between users through the Ripple network:

Here's an example of the "OfferCreate" JSON that's created by a trader who wants to buy $50:
{
"TransactionType": "OfferCreate",
"Account": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"Fee": "12",
"Flags": 0,
"LastLedgerSequence": 7108682,
"Sequence": 8,
"TakerGets": "6000000",
"TakerPays": {
"currency": "USD",
"issuer": "ruazs5h1qEsqpke88pcqnaseXdm6od2xc",
"value": "50"
}
}