This repository has been archived by the owner on Jan 22, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #306 from thejoshualewis/invite-users
added example to invite users
- Loading branch information
Showing
2 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* Copyright (c) 2014-2015 BitPay | ||
*/ | ||
|
||
/** | ||
* WARNING - This example will NOT work until you have generated your public | ||
* keys and also see the documentation on how to save those keys. | ||
* | ||
* Also please be aware that you CANNOT create an invoice until you have paired | ||
* the keys and received a token back. The token is usesd with the request. | ||
*/ | ||
|
||
$key_dir = '/tmp'; | ||
require __DIR__.'/../../vendor/autoload.php'; | ||
|
||
$time = gmdate("Y-m-d\TH:i:s\.", 1414691179)."000Z"; | ||
|
||
$token = "<your api token>"; | ||
|
||
//this is your private key in some form (see GetKeys.php) | ||
$storageEngine = new \Bitpay\Storage\EncryptedFilesystemStorage('TopSecretPassword'); | ||
$private = $storageEngine->load($key_dir . '/bitpay.pri'); | ||
$public = $storageEngine->load($key_dir . '/bitpay.pub'); | ||
|
||
$network = new \Bitpay\Network\Testnet(); | ||
$adapter = new \Bitpay\Client\Adapter\CurlAdapter(); | ||
|
||
|
||
$bitpay = new \Bitpay\Bitpay(); | ||
|
||
$client = new \Bitpay\Client\Client(); | ||
$client->setPrivateKey($private); | ||
$client->setPublicKey($public); | ||
$client->setNetwork($network); | ||
$client->setAdapter($adapter); | ||
|
||
#create a batch of email addresses to invite to create a BitPay account | ||
|
||
$emails[] = | ||
array( | ||
"email"=>"email-address1@email.com", | ||
"notificationURL" =>"https://test.com/ipn", | ||
"label"=>"email test 1" | ||
); | ||
|
||
$emails[] = | ||
array( | ||
"email"=>"email-address2@email.com", | ||
"notificationURL" =>"https://test.com/ipn", | ||
"label"=>"email test 2" | ||
); | ||
$response = $client->createRecipient($token,$emails); | ||
print_r($response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters