- <?php
- // the API accepts GET and POST requests, and outputs JSON formatted data.
- // always check for an ['error'] key in the response.
- // example calls:
- // tripkey of the user
- $senderKey = '#...';
- // tripcode of the recipient for transactions
- $recipientCode = '!...';
- // amount to send for transactions
- $amount = 10;
- // balance check: ['account'], ['balance'], ['formatted']
- $balance = json_decode(file_get_contents('https://erin.wtf/securepay?s=' . urlencode($senderKey) . '&b=true'), true);
- if(!$balance['error']){
- print $balance['balance'];
- }else{
- print $balance['error'];
- }
- // recent transactions: [id]['time'], [id]['sender'], [id]['recipient'], [id]['amount'], [id]['formatted']
- $recent = json_decode(file_get_contents('https://erin.wtf/securepay?s=' . urlencode($senderKey) . '&t=true'), true);
- if(!$recent['error']){
- print json_encode($recent);
- }else{
- print $recent['error'];
- }
- // charge account: ['sent'], ['to'], ['from'], ['formatted']
- $payment = json_decode(file_get_contents('https://erin.wtf/securepay?s=' . urlencode($senderKey) . '&r=' . urlencode($recipientCode) . '&a=' . $amount), true);
- if(!$payment['error']){
- print $payment['formatted'];
- }else{
- print $payment['error'];
- }
- ?>
RAW Paste Data


