Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nerdylocks/8b327ad0bba4acc6df6d to your computer and use it in GitHub Desktop.
Save nerdylocks/8b327ad0bba4acc6df6d to your computer and use it in GitHub Desktop.

Host Meta

Discovery protocol that describes the services offered by the current domain or gatewayd.

GET https://latambridgepay.com/.well-known/host-meta.json

{
  "subject": "https://latambridgepay.com",
  "expires": "2014-01-30T09:30:00Z",
  "properties": {
    "name": "Latam Bridge Pay",
    "description": "Ripple Gateway to and from Latin American banks.",
    "rl:type": "gateway",
    "rl:domain": "latambridgepay.com",
    "rl:accounts": [
      {
        "address":"r4tFZoa7Dk5nbEEaCeKQcY3rS5jGzkbn8a",
        "rl:currencies": ["USD", "BRL", "PEN", "MXN"]
      }
    ],
    "rl:hotwallets": [
      "rEKuBLEX2nHUiGB9dCGPnFkA7xMyafHTjP"   // manual
    ]
  },

  "links": [
    {   
      "rel": "https://gatewayd.org/gateway-services/bridge_quotes",
      "href": "https://latambridgepay.com/v1/bridge/quotes/",
      "properties": {
        "version": "1"
      }
    },
    {   
      "rel": "https://gatewayd.org/gateway-services/bridge_payments",
      "href": "https://latambridgepay.com/v1/bridge/payments",
      "properties": {
        "version": "1",
        "fields": {
          "sender_claims":{
            "bank": {
              "type": "AstropayBankCode",
              "required": true,
              "label": {
                "en": "Astropay Bank Code"
              },
              "description": {
                "en": "Bank code from Astropay's documentation"
              }
            },
            "country": {
              "type": "AstropayCountryCode",
              "required": true,
              "label": {
                "en": "Astropay Country Code",
              },
              "description": {
                "en": "Country code from Astropay's documentation"
              }
            },
            "cpf": {
              "type": "PersonalIDNumber",
              "required": true,
              "label": {
                "en": "Personal Government ID Number"
              },
              "description": {
                "en": "Personal ID number from the Astropay documentation"
              },
            }
            "name": {
              "type": "FullName",
              "required": true,
              "label": {
                "en": "Sender's Full Name"
              },
              "description": {
                "en": "First and last name of sender"
              }
            },
            "email": {
              "type": "EmailAddress",
              "required": true,
              "label": {
                "en": "Sender's Email Address"
              },
              "description": {
                "en": "Sender's Email Address"
              }
            },
            "bdate": {
              "type": "Date",
              "required": true,
              "label": {
                "en": "YYYYMMDD"
              },
              "description": {
                "en": "Sender's date of birth"
              }
            }
        }  
      }   
    },
    {
      "rel": "https://gatewayd.org/gateway-services/bridge_payment_status",
      "href": "https://latambridgepay.com/api/v1/bridge/payments",
      "properties": {
        "version": "1"
      }
    }
  ]
}

Webfinger

GET https://latambridgepay.com/.well-known/webfinger?resource=ripple:bob

{
    "subject": "ripple:bob",
    "expires": "2014-10-07T22:46:35.097Z",
    "aliases": [
        "ripple:bob",
        "ripple:rBWay8KRdmroZra4DTXi6h5cLtPhs5mH7v"
    ],
    "links": [
        {
            "rel": "https://gatewayd.org/gateway-services/bridge_quotes",
            "href": "https://latambridgepay.com/v1/bridge/quotes",
            "titles": {
                "default": "Get quotes to send funds between Ripple and bank accounts in Latin America."
            }
        },
        {
            "rel": "https://gatewayd.org/gateway-services/bridge_payments",
            "href": "https://latambridgepay.com/v1/bridge/payments",
            "titles": {
                "default": "Send funds between Ripple and bank accounts in Latin America."
            }
        }
    ],
    "properties": {
        
    }
}

Bridge Quote

GET https://latambridgepay.com/v1/bridge/quotes/ripple:bob/5+USD

{

  "success": true,
  "bridge_payments": [{
    "gateway_tx_id": "9876",
    "gateway_tx_type": "in", // in to ripple
    "gateway_tx_state": "quote",
    "gateway_tx_message": "Inactive, must be posted.",
    "expiration": "1311280970" <== UNIX epoch
    
    "destination_account": "acct:[email protected]", // ripple:r1234?dt=5 <== Webfinger
    "destination_amount": {
        "amount": "5",
        "currency": "USD",
        "issuer": "r4tFZoa7Dk5nbEEaCeKQcY3rS5jGzkbn8a"
    },
    
    "ripple_invoice_id": "8765", <== Add invoice_id column to ripple_transactions
    "sender_claims": {
      "bank_account": "",
      "routing_number": "",
      "country": "",
      "bank_name": ""
    }
  }]
}

POST /payments

Response (400)

{
  success: false,
  "sender_claims_required": [
    "bank_account",
    "routing_number",
    "country",
    "bank_name",
  ]
}

Bridge Payment Status

GET https://latambridgepay.com/v1/bridge/payments/9876

{

  "success": true,
  "bridge_payment": {
    "gateway_tx_id": "9876",
    "gateway_tx_type": "in", // in to ripple
    "gateway_tx_state": "invoice",
    "gateway_tx_message": "Invoice, must be paid.",
    "expiration": "1311280970"
    "destination_account": "acct:[email protected]",
    "destination_amount": {
        "amount": "5",
        "currency": "USD",
        "issuer": "r4tFZoa7Dk5nbEEaCeKQcY3rS5jGzkbn8a"
    },
    "ripple_invoice_id": "8765", <== Add invoice_id column to ripple_transactions
    "sender_claims": {
      "bank_account": "somebankaccount",
      "routing_number": "routingnumber",
      "country": "countrt",
      "bank_name": "bankname"
    }
  }
}

Protocol Defined Types

A standard set of type definitions for easy internationalized parsing of KYC data requirements.

We need to by default define enough to cover most cases and allow people to define additional ones that will hopefully be incorportated if they have KYC requirements that are not covered by the default set.

Outbound Bridge Awareness Mechanisms

  1. Hard-coded which outbound bridges you know about.
  2. Know about a centralized registry for discovering outbound bridges.
  3. Ask the user to provide the outbound bridge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment