To use the SDK, add the following meta tag within the <head>
tag in your HTML document:
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<script
src="https://sdk.supra-pay.com/v3/suprapay-sdk.js"
data-spura-client-id="YOUR_CLIENT_ID">
</script>
<script src="https://sdk.supra-pay.com/v3/suprapay-sdk.js"> </script> <script> const spura = SpuraSDK.initialize ( 'YOUR_CLIENT_ID', { popupWidth: 500, popupHeight: 700 } ); </script>
YOUR_CLIENT_ID
is the store ID issued from the admin page.
Parameter (Required) | Description |
---|---|
type (Required) | 'buy' or 'sell' |
userId (Required) | User ID |
userName (Required) | User Name |
usdtqty (Required) | Payment Amount (USDT Quantity, Int) |
displayType (Required) | 'modal' or 'popup'
⚠️iOS User Note:
Modal popups may not be supported on iOS (iPhone/iPad) due to iOS policies. |
<button data-spura-type="buy" data-spura-user-id="userid" data-spura-user-id="Jone Smith" data-spura-usdtqty="1000" data-spura-display="modal"> Buy </button>
※This demo is for testing purposes only. Please be careful when using it in production.
※The execution speed may be slow or errors may occur.
!! This does not reflect the actual payment results. You should not judge user payments based on this callback.
// Initialize with callbacks const spura = SpuraSDK.initialize('YOUR_CLIENT_ID', { onSuccess: function(data) { console.log('Payment Success:', data); // Handle successful payment }, onError: function(error) { console.error('Payment Failed:', error); // Handle payment error }, onCancel: function(data) { console.warn('Payment Cancelled:', data); // Handle payment cancellation } }); // Or set callbacks after initialization spura.setCallbacks({ onSuccess: (data) => { console.log('Payment Success:', data); }, onError: (error) => { console.error('Payment Failed:', error); }, onCancel: (data) => { console.warn('Payment Cancelled:', data); } });
Callback functions are optional. If not set, logs will be output to the console by default.
spura pay uses USDT as the default payment method.
Please pass the payment amount in USDT to be used for payment.
Please check the current price of USDT before payment to calculate the amount to be received.
※The source uses the Bithumb API.
async function getBithumbUSDTPrice() { try { const response = await fetch('https://api.bithumb.com/public/ticker/USDT_KRW'); const data = await response.json(); if(data.status === '0000') { return { price: parseFloat(data.data.closing_price), timestamp: parseInt(data.data.date) }; } } catch (error) { console.error('Error fetching USDT price:', error); } } // Example usage getBithumbUSDTPrice().then(priceInfo => { console.log('USDT Price:', priceInfo.price); });
function getBithumbUSDTPrice() { try { $url = 'https://api.bithumb.com/public/ticker/USDT_KRW'; $response = file_get_contents($url); if ($response === false) { throw new Exception('Failed to get response'); } $data = json_decode($response, true); if ($data['status'] === '0000') { return [ 'price' => (float)$data['data']['closing_price'], 'timestamp' => (int)$data['data']['date'] ]; } } catch (Exception $e) { error_log('Error: ' . $e->getMessage()); } } // Example usage $usdtInfo = getBithumbUSDTPrice(); echo "USDT Current Price: " . number_format($usdtInfo['price']) . " KRW";