SHARE
TWEET

secure pay ex

erinx Sep 12th, 2015 (edited) 54 Never
  1. <?php
  2.  
  3.   // the API accepts GET and POST requests, and outputs JSON formatted data.
  4.   // always check for an ['error'] key in the response.
  5.  
  6.   // example calls:
  7.  
  8.   // tripkey of the user
  9.   $senderKey = '#...';
  10.  
  11.   // tripcode of the recipient for transactions
  12.   $recipientCode = '!...';
  13.  
  14.   // amount to send for transactions
  15.   $amount = 10;
  16.  
  17.   // balance check: ['account'], ['balance'], ['formatted']
  18.   $balance = json_decode(file_get_contents('https://erin.wtf/securepay?s=' . urlencode($senderKey) . '&b=true'), true);
  19.  
  20.   if(!$balance['error']){
  21.     print $balance['balance'];
  22.   }else{
  23.     print $balance['error'];
  24.   }
  25.  
  26.   // recent transactions: [id]['time'], [id]['sender'], [id]['recipient'], [id]['amount'], [id]['formatted']
  27.   $recent = json_decode(file_get_contents('https://erin.wtf/securepay?s=' . urlencode($senderKey) . '&t=true'), true);
  28.  
  29.   if(!$recent['error']){
  30.     print json_encode($recent);
  31.   }else{
  32.     print $recent['error'];
  33.   }
  34.  
  35.   // charge account: ['sent'], ['to'], ['from'], ['formatted']
  36.   $payment = json_decode(file_get_contents('https://erin.wtf/securepay?s=' . urlencode($senderKey) . '&r=' . urlencode($recipientCode) . '&a=' . $amount), true);
  37.  
  38.   if(!$payment['error']){
  39.     print $payment['formatted'];
  40.   }else{
  41.     print $payment['error'];
  42.   }
  43.  
  44. ?>
RAW Paste Data
Top