GoatPaid Developers Section
GoatPaid is modern payment platform with alot of features. Some of this features you can use for your needs. You simple can integrate our payment platform in your website and allow your customers to pay directly to your account.
HTML Integration
-
This is a simple integration to e-shops, forex, trading platforms, exchangers and etc. Code is based on PHP and HTML.
<?php $merchant_name = 'Best Shop'; // Your SCI Name $merchant_id = '123456789000'; // Your SCI ID $secret_key = '123'; // Your SCI Secret Key $encryption_key = '123'; // Your Encryption Key $item_number = '1'; // Order ID $item_name = 'Order Digital Products'; // Order Name $item_price = '1000'; // Order Amount $item_currency = 'USD'; // Order currency can be USD, EUR, BTC, ETH and etc... $arHash = array( $merchant_name, $item_number, $item_price, $item_currency, $item_name, $secret_key ); $key = md5($encryption_key.$item_number); $params = @urlencode(base64_encode(openssl_encrypt(json_encode($arHash), 'AES-256-CBC', $key, OPENSSL_RAW_DATA))); $sign = strtoupper(hash('sha256', implode(':', $arHash))); ?> <form action="https://goatpaid.com/checkout/" method="POST"> <input type="hidden" name="merchant_name" value="<?php echo $merchant_name; ?>"> <input type="hidden" name="merchant_id" value="<?php echo $merchant_id; ?>"> <input type="hidden" name="item_number" value="<?php echo $item_number; ?>"> <input type="hidden" name="item_name" value="<?php echo $item_name; ?>"> <input type="hidden" name="item_price" value="<?php echo $item_price; ?>"> <input type="hidden" name="item_currency" value="<?php echo $item_currency; ?>"> <input type="hidden" name="hash_verify" value="<?php echo $sign; ?>"> <input type="hidden" name="params" value="<?php echo $params; ?>"> <input type="hidden" name="return_ipn" value="http://yourwebsite.com/ipn.php"> <input type="hidden" name="return_success" value="http://yourwebsite.com/success.php"> <input type="hidden" name="return_fail" value="http://yourwebsite.com/fail.php"> <button type="submit">Pay via GoatPaid</button> </form>
IPN Callback
-
IPN (Instant Payment Notification) will be sent to return_ipn parameter when payment is made successfully. That will inform merchant to update order status.
<?php if (!in_array($_SERVER['REMOTE_ADDR'], array('2a02:4780:1:1163:0:2785:71ae:3'))) return; if (isset($_POST['operation_id']) && isset($_POST['verify_sign'])) { $secret_key = 'Your secret key'; $arHash = array( $_POST['operation_id'], // Return Payment Transaction ID $_POST['operation_pm'], // Return Payment Method $_POST['operation_date'], // Return Date $_POST['operation_pay_date'], // Return Date when payment was made $_POST['merchant_id'], // Return API ID $_POST['item_number'], // Return Order number $_POST['item_price'], // Return Item Amount $_POST['item_currency'], // Return Item Currency $_POST['item_name'], // Return Item Name $_POST['operation_status'] // Return Payment Status ); if (isset($_POST['params'])) { $arHash[] = $_POST['params']; } $arHash[] = $secret_key; $sign_hash = strtoupper(hash('sha256', implode(':', $arHash))); if ($_POST['verify_sign'] == $sign_hash && $_POST['operation_status'] == 'success') { ob_end_clean(); exit($_POST['item_number'].'|success'); } ob_end_clean(); exit($_POST['item_number'].'|error'); } ?>
Authentication
-
Our API is based on CURL queries. Post and Get requests are processed through an authorization token that you can create through your account. Here is a simple curl query to check is your token works. All responses are returned in json format.
GET Request
curl https://goatpaid.com/api/ -H "Authorization: Bearer <YOUR TOKEN>"
-
SUCCESS Response
{"status":"success","msg":"Token is valid.","request_time":1615472918}
-
ERROR Response
{"status":"error","msg":"Unknown or invalid token.","request_time":1615473002}
-
ERROR Response
{"status":"error","msg":"Token access is still pending.","request_time":1615473083}
-
ERROR Response
{"status":"error","msg":"Access with this token is denied.","request_time":1615473083}
Get Account Balances
-
If you have allowed your token to show your balance. This is the request you must send to receive a response from our API with your balance.
GET Request
curl https://goatpaid.com/api/?a=get_balances -H "Authorization: Bearer <YOUR TOKEN>"
-
SUCCESS Response
{ "status":"success", "balances": { "USD Wallet": { "is_crypto":"0", "available_balance": "89779.46", "currency": "USD" }, "Bitcoin Wallet": { "is_crypto":"1", "available_balance":"0.15053549", "pending_balance":"0.00000000", "currency":"BTC" } }, "request_time":1615473423 }
-
ERROR Response
{"status":"error","msg":"Your token no have access to show account balances.","request_time":1615473002}
Get Accounts
-
If you have allowed your token to show your account addresses. This is the request you must send to receive a response from our API with your account addresses.
GET Request
curl https://goatpaid.com/api/?a=get_accounts -H "Authorization: Bearer <YOUR TOKEN>"
-
SUCCESS Response
{ "status":"success", "accounts": { "USD Wallet": { "address":"US53MONE16129540U2" }, "Bitcoin Wallet": { "address":"3EiyFopBY3NVLukn3zcKX1Uuyg99gdHxDc" } }, "request_time":1615475678 }
-
ERROR Response
{"status":"error","msg":"Your token no have access to show accounts.","request_time":1615473002}
Send Transaction
-
If you have allowed your token to send transactions from your account. This is the request you must send to receive a response from our API.
POST Request
curl https://goatpaid.com/api/?a=send_transaction -X POST -d '<POST PARAMETERS>' -H "Authorization: Bearer <YOUR TOKEN>"
Post Parameters if send a fiat:- - is_crypto (This parameter must be with 0)
- - to_wallet (Wallet account number of recipient)
- - amount (Number formated amount which will be sent to recipient)
- - currency (3 digit currency code. Eg: USD,EUR,RUB and etc.)
- - description (A description of payment)
- Example post parameter format: is_crypto=0&to_wallet=US...&amount=200¤cy=USD&description=Monthly+Payment
Every parameter must be urlencoded with PHP urlencode(); function.
Post Parameters if you send a crypto- - is_crypto (This parameter must be with 1)
- - address (Wallet account number of recipient)
- - amount (Number formated amount which will be sent to recipient)
- - currency (crypto currency code. Eg: BTC,ETH and etc.)
- Example post parameter format: is_crypto=1&address=1hc12uhc....&amount=0.5251¤cy=BTC
Every parameter must be urlencoded with PHP urlencode(); function.
-
SUCCESS Response
{ "status":"success", "amount":"200|0.5251", "currency":"USD|BTC", "txid":"paymentid|blockchain txid", "wallet":"12hchs....", "status":"pending|completed", "processed_time":1615475678, "request_time":1615475678 }
-
ERROR Response
{"status":"error","msg":"Your account no have enought funds.","request_time":1615473002}
-
ERROR Response
{"status":"error","msg":"Amount must be greater than 0.","request_time":1615473002}
-
ERROR Response
{"status":"error","msg":"Currency is not supported.","request_time":1615473002}
-
ERROR Response
{"status":"error","msg":"Currency is not allowed in ths token.","request_time":1615473002}
-
ERROR Response
{"status":"error","msg":"Account does not exists in our system.","request_time":1615473002}
-
ERROR Response
{"status":"error","msg":"Account Number is invalid.","request_time":1615473002}
-
ERROR Response
{"status":"error","msg":"(BTC|ETH..) address is not valid.","request_time":1615473002}
-
ERROR Response
{"status":"error","msg":"Your token no have access to send transaction.","request_time":1615473002}
List Transactions
-
If you have allowed your token to show your account transactions. This is the request you must send to receive a response from our API with your account addresses.
GET Request
curl https://goatpaid.com/api/?a=list_transactions -H "Authorization: Bearer <YOUR TOKEN>"
GET Requestcurl https://goatpaid.com/api/?a=list_transactions&page={num} -H "Authorization: Bearer <YOUR TOKEN>"
-
SUCCESS Response
{ "status":"success", "txs": { "31": { "type":"send", "is_crypto":"0", "wallet":"USD Wallet", "amount":"231", "currency":"USD", "date":"February 20, 2021 02:12 PM", "timestamp":"1613828652", "from_wallet":"US53MONE16129540U2", "to_wallet":"US93MONE16131311U3", "status":"completed" }, "29": { "type":"deposit", "is_crypto":"0", "deposit_via":"Credit or Debit Card", "wallet":"US53MONE16129540U2", "amount":"100000", "currency":"USD", "date":"February 18, 2021 02:21 PM", "timestamp":"1613650881", "status":"completed" }, ......... }, "total_txs":25, "txs_per_page":20, "request_time":1615476126 }
-
ERROR Response
{"status":"error","msg":"Your token no have access to list transactions.","request_time":1615473002}