【问题标题】:BitPay API gateway payment Bitcoin - pairingBitPay API 网关支付比特币 - 配对
【发布时间】:2017-10-05 13:18:56
【问题描述】:

我正在为 bitpay API 苦苦挣扎。 到目前为止,我生成了 public、priate 和 sin 密钥。 我存储了它们,现在我想与 bitpay.com 的特殊密钥配对 这是我的错误,下面是我的整个代码。 有人可以帮忙吗?

Public Key: 0309f03bc0d566c411aeb55b8be57b0485d28706ace9b1a198d053212bde06d718 Private Key: 77cec96ea11e3d35ec2817db6951167755095f8a45c508028ca22734fe7e9962 Sin Key: Tf2XSANqca54VHQG31RXjAY5EKdyaysHtct 
Fatal error: Uncaught Bitpay\Client\ArgumentException: pairing code is not legal in /var/www/dev.simplemining.net/vendor/bitpay/php-client/src/Bitpay/Client/Client.php:494 Stack trace: #0 /var/www/dev.simplemining.net/controller/account.php(65): Bitpay\Client\Client->createToken(Array) #1 /var/www/dev.simplemining.net/index.php(20): require('/var/www/dev.si...') #2 {main} thrown in /var/www/dev.simplemining.net/vendor/bitpay/php-client/src/Bitpay/Client/Client.php on line 494



require __DIR__ . '/../vendor/autoload.php';
$private = new \Bitpay\PrivateKey('/tmp/private.key');
$public  = new \Bitpay\PublicKey('/tmp/public.key');
$sin     = new \Bitpay\SinKey('/tmp/sin.key');
// Generate Private Key values
$private->generate();
// Generate Public Key values
$public->setPrivateKey($private);
$public->generate();
// Generate Sin Key values
$sin->setPublicKey($public);
$sin->generate();
printf("Public Key:  %s\n", $public);
printf("Private Key: %s\n", $private);
printf("Sin Key:     %s\n\n", $sin);
$manager = new \Bitpay\KeyManager(new \Bitpay\Storage\EncryptedFilesystemStorage('fdgkjnfdERTPWIEFMVwe'));
$manager->persist($private);
$manager->persist($public);
$manager->persist($sin);



$bitpay = new \Bitpay\Bitpay(
    array(
        'bitpay' => array(
            'network'     => 'testnet', // testnet or livenet, default is livenet
            'public_key'  => '/tmp/public.key', //see tutorial/001.php and 002.php
            'private_key' => '/tmp/private.key',
            'key_storage' => 'Bitpay\Storage\EncryptedFilesystemStorage',
            'key_storage_password' => 'fdgkjnfdERTPWIEFMVwe'
        )
    )
);
/**
 * Create the client that will be used to send requests to BitPay's API
 */
$client = $bitpay->get('client');


// @var \Bitpay\KeyManager
$manager   = $bitpay->get('key_manager');
$publicKey = $manager->load($bitpay->getContainer()->getParameter('bitpay.public_key'));
$sin = new \Bitpay\SinKey();
$sin->setPublicKey($publicKey);
$sin->generate();

// @var \Bitpay\TokenInterface
$token = $client->createToken(
    array(
        'id'          => (string) $sin,
        'pairingCode' => 'fees',
        'label'       => 'y1FdbaA',
    )
);

【问题讨论】:

  • 您确定您的配对码生成时间少于 24 小时吗?

标签: bitcoin gateway bitpay


【解决方案1】:

我遇到了这个问题。然后我正确使用了这个“https://github.com/bitpay/php-bitpay-client”库并按照步骤操作。

所以首先下载最新的 bitpay 库并按照文档自述文件正确配置。

您可以与https://github.com/bitpay/php-bitpay-client/tree/master/examples/tutorial 的教程集成。

【讨论】:

  • Hey@Sandeep 而不是给出 github 的链接发布特定代码形式的 github 它将对 @tytanic 有所帮助。
猜你喜欢
  • 2018-04-11
  • 2016-08-07
  • 1970-01-01
  • 2014-04-22
  • 2016-09-23
  • 2014-11-26
  • 2013-03-01
  • 1970-01-01
  • 2016-05-16
相关资源
最近更新 更多