XRP Payment Terminal

Transaction: SUCCESS!

Journalling my process and progress…

Objective: A native iOS payment terminal app that accepts cryptocurrency as payment with a tap of an NFC card/tag or scan of a QR code to enter secret keys to sign transactions. App clip will allow customers to quickly pay for transactions with a tap of an NFC card/tag or scan of a QR code.

GOALS

  • Create XRP Payment Terminal
    • Inventory System
      • Add/Delete Items to Inventory
      • Calculate Total of Items
    • Payment Terminal (Apple iPhone/iPad App)
      • Total Amount of Items w/ XRP Payment as Option
      • Send XRP
        • Prepare Transaction
          • Payment indicator (paymentType)
          • Sender (senderAddressEntered)
          • Destination (let destinationAddress =)
          • Amount in drops 💧 (totalAmount and/or taxIncludedTotalAmount)
    • Sign Transaction by entering Secret Key (using NFC Card/Tag)
    • Submit Transaction: Secret Key Entered -> ACCEPT?
    • Wait for Status: SUCCESS! -> Confirmation and Transaction Info Details on Receipt
      • Info includes: Total in XRP/USD, Items list, etc…
    • CLEAR CACHE
  • App Clip
    • Fast-Pay by quick tap of NFC Card/Tag
  • Create an NFC Write App (Apple iPhone – usable offline)
    • Generate XRP Wallet: Account and Secret Key

Napkin sketch

Colors by A 😆

Design in Sketch

Payment Sequence -> Tap NFC Card/Tag (maybe add NFC icon and “waiting” .gif)
That looks better
(Note: I should really mask secret keys!)
NFC Card tapped and (masked) Secret Key entered

Swift Code (sample to work off of – source)

import Foundation
import ripplexKit
 
// A URL to reach the remote rippled node at.
// Some options:
//     dev.xrp.ripplex.io:50051
//     test.xrp.ripplex.io:50051
//     main.xrp.ripplex.io:50051
let grpcAddress = "test.xrp.ripplex.io:50051"
 
// A wallet that exists on Testnet.
let seed = "snYP7oArxKepd3GPDcrjMsJYiJeJB";
guard let wallet = Wallet(seed: seed) else {
    print("The given seed is not valid: \(seed)")
    exit(0)
}
 
// A recipient address.
let recipientAddress = "X7cBcY4bdTTzk3LHmrKAK6GyrirkXfLHGFxzke5zTmYMfw4"
let dropsToSend: UInt64 = 10
 
// Instantiate an XRPClient connected to the XRP Ledger Testnet
print("\nUsing rippled node located at: \(grpcAddress)\n")
let xrpClient = XRPClient(grpcURL: grpcAddress, network: .test)
 
// Get account balance
print("Retrieving balance for \(wallet.address) ..")
let balance = try xrpClient.getBalance(for: wallet.address)
 
print("Balance was \(balance) drops!\n")
 
// Send XRP
print("Sending:")
print("- Drops \(dropsToSend)")
print("- To: \(recipientAddress)")
print("- From: \(wallet.address)\n")
let hash = try xrpClient.send(dropsToSend, to: recipientAddress, from: wallet)
 
print("Hash for transaction:\n\(hash)\n")
 
// Check status of the payment
let status = try xrpClient.paymentStatus(for: hash)
print("Result for transaction is:\n\(status)\n");
 
// Retrieve full payment history for account
print("Payment history for account " + wallet.address + ":\n")
let paymentHistory = try xrpClient.paymentHistory(for: wallet.address)
let shortPaymentHistory = paymentHistory.prefix(5) // limit long output
for payment in shortPaymentHistory {
    print(payment)
}

Progress Notes

  • 9/16/2020 – nighttime “napkin sketch” and fun coloring session with A
  • 9/19/2020 – design payment sequence in Sketch
  • 9/20/2020 – upload payment sequence video to YouTube
  • 9/20/2020 -> ??? – reading and late-night coding just on payment sequence
  • 9/26/2020 – Included QR Code scan to payment sequence. (update: removed from sequence on 9/27/2020)
    • Notes: Sender info is a requirement of XRPL transactions. There was no way for Sender info to be entered in my initial payment sequence. Secret Keys alone aren’t enough for transactions.
  • 9/27/2020 – Read Getting Started with Xpring SDK
    • Notes: Sender info can be entered using Secrey Keys (seed – proposed: entered in by NFC card/tag). This is a relief! My payment sequence will (hypothetically) work! recipientAddress (my address) will need to be a constant and it must be in x-address format. I wonder if this is best practice, though… *!Need to ensure seed is flushed out of system before new transactions can be processed.
  • 10/xx/20 – Read Getting Started With RippleX Dev Kit
    • Notes: XpringKit is now RippleXKit
  • 11/07/2020 – implementation of QR Code reader (source reference)

Code Notes

  • arrays (when “shop sequence” is implemented)
    • listedItem
    • transactionDetails
  • variables
    • itemCountTotal
    • totalAmount
    • taxIncludedTotalAmount
    • addressEntered
    • keysEntered
    • transactionStatusSuccess
  • animation
    • waiting for NFC card/tag tap
    • Transaction Success/Fail
    • Shop Sequence
      • Add Item to Cart
      • Checkout
via WietseWind

3 thoughts on “XRP Payment Terminal

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.