Skip to content

Instantly share code, notes, and snippets.

@adrianhopebailie
Last active June 2, 2017 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrianhopebailie/1612615a18eadca72808e5097045ee59 to your computer and use it in GitHub Desktop.
Save adrianhopebailie/1612615a18eadca72808e5097045ee59 to your computer and use it in GitHub Desktop.
Using an SPSP URL through ILP Kit APIs

Assuming https://example.com/ is ILP Kit URL

POST {"username": "", "password": "" } to https://example.com/api/auth/login

inspect response.headers.set-cookie and use as cookie for future requests

POST {“destination”:“<SPSP Endpoint URL>”,“sourceAmount”:null,“destinationAmount”:“<Amount>”} to https://example.com/api/payments/quote

returns:

{ “id”: “5750f15d-5c39-4902-b547-fbf1afb6c25b”,
  “sourceAmount”:“0.011252725”,
  “destinationAmount”:“1”,
  “destinationAccount”:“<ILP Address>”,
  “connectorAccount”: “nl.jpy.michiel.connector”,
  “sourceExpiryDuration”:“6”,
  “spsp”: { 
      “destination_account”:“”,
      “shared_secret”:“T0y_HfGrOr2Y_ym3VB9VPg”,
      “maximum_destination_amount”:“1000000000000",
      “minimum_destination_amount”:“1",
      “ledger_info”: { 
        “currency_code”: “EUR”,
        “currency_scale”:0
      },
      “receiver_info”: { 
        “name”:“Gregor Gololicic”,
        “image_url”:“http://i0.kym-cdn.com/entries/icons/original/000/006/151/tumblr_lltzgnHi5F1qzib3wo1_400.jpg”
      }
  }
}

Show user the Receiver info and send amoutn to confirm

Then PUT

{
  “quote”:{<Copy of Quote response>},
  “destination”:{
    “ledgerUri”:“https://ilp-sandbox.gatehub.net”,
    “paymentUri”:“https://ilp-sandbox.gatehub.net/spsp/52652acf-e52f-4e9b-beae-62ffdaee72a3.9e88346a-3cc0-4a3d-80dd-636aa8436fc4.78e8a4d0-f43f-4f76-941d-7998c8524417.575599777”,
    “ilpAddress”:“<ILP Address of receiver>”,
    “identifier”:“gregor@ilp-sandbox.gatehub.net”,
    “currencyCode”:“EUR”,
    “currencySymbol”:“€”,
    “name”:“Gregor Gololicic”,
    “imageUrl”:“http://i0.kym-cdn.com/entries/icons/original/000/006/151/tumblr_lltzgnHi5F1qzib3wo1_400.jpg”
   },
   “message”:“test”
}

to https://example.com/api/payments/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment