2

为了DOGECOIN在我的网站中进行交易,我已经集成了来自https://www.dogeapi.com的 DOGECOIN API 。当用户单击结帐小部件时,它会重定向到DOGECOINAPI 页面,我需要在此处插入 PIN(帐户的唯一 PIN),该 PIN 是在https://www.dogeapi.com上注册时插入的。

问题:问题是为了完成交易,我们需要真正的狗狗币,但作为开发人员,我们总是需要先进行测试交易,所以我的问题是如何获得DOGECOI测试交易的测试环境?

我知道 DOGECOIN 是在几个月前推出的,没有太多东西可以使用它。如果你们中的任何人有这样的经验来处理它,请帮助我。

集成代码:

     <?php
    //set to your API_KEY
$api_key = '************************';

//set this to your users id
//for this example we will make it 22
//must be alphanumeric only
$user_id = '22';

//set this to the amount the item costs
$amount_doge = '1000';

//send a request to the API to make a new payment address
//put info about the request in 
$response = file_get_contents("https://www.dogeapi.com/wow/?api_key=$api_key&a=get_new_address&address_label=$user_id");
if($response !== 'Bad Query' && $response !== '') {
    $new_address = json_decode($response);


    //give them the address or echo a widget here
                                    ?>
    <script src='https://www.dogeapi.com/widget/dogeapi.js' type='text/javascript'></script>
    <div class='doge-widget-wrapper'>
    <form method='get' action='https://www.dogeapi.com/checkout'>
        <input type='hidden' name='widget_type' value='pay'>
        <input type='hidden' name='widget_key' value='ugkzdu62opc8qlb3e41u5kthq'>
        <input type='hidden' name='new_address' value='<?php echo $new_address ?>'>
        <input type='hidden' name='amount_usd' value='10'>
        <div class='doge-widget' style='display:none;'></div>
    </form>
</div>
<?php
    //for this example we will just echo an address
    echo "Please pay $amount_doge DOGE to $new_address to receive your item. It may take up to 10 minutes to confirm your payment.";
    //header("Location: post-payment.php");
} else {
    echo 'There was a problem processing your order.';
}
    ?>  

我在结帐后附上了页面的图像。

在此处输入图像描述

4

0 回答 0