I use https://github.com/coinbase/coinbase-php with laravel to send Eth from my wallet to wallet on other service.
I use this method: $client->createAccountTransaction($account, $transaction);
In this way:
$transaction = Transaction::send([
'to' => new EthrereumAddress($destination_address),
'amount' => new Money($amount, $currency),
'description' => $description,
//'fee' => '0.0001' // only required for transactions under BTC0.0001
]);
$this->client->createAccountTransaction($account, $transaction);
But when I try to do this, I get this error:
The Coinbase API only accepts transactions to an account, email, or bitcoin address
Can someone tell me how to send eth or what is wrong ?
This was fixed in the latest 2.8.0 version.
https://github.com/coinbase/coinbase-php/releases/tag/2.8.0
You should use right $account for each cryptocurrency, but not just the $client->getPrimaryAccount();
For example:
$account = Account::reference('YOUR_ETH_ACCOUNT_ID');
Related
I have 2 problem with WHMCS LocalAPI.
(1) I have a problem when I add order to client via LocalAPI.
I use a webservice where I must send my request to a web service and if returned true then I must add a order to client, but when I use addorder API the WHMCS apply credit automatically and it is not suitable for me. I want to add order and DO NOT paid invoice through credit.
(2)
I have a additional domain field in domainadditionalfields in whmcs database that fieldname as figure, but I do not know what syntax is true I use this code but value field is empty:
$command = 'AddOrder';
$postData = array(
'clientid' => 701,
'domain' => array($domain),
'domaintype' => array('register'),
'regperiod' => array($period),
'nameserver1' => $ns1,
'nameserver2' => $ns2,
'additionalfields["irnichandle"]' => "ABC",
'paymentmethod' => 'mailin',
'applycredit' => false,
);
$adminUsername = 'adminuser'; // Optional for WHMCS 7.2 and later
$results = localAPI($command, $postData, $adminUsername);
$orderid = $result['orderid'];
$invoiceid = $result['invoiceid'];
print_r($results);
(1) There is an option to disable auto applying credit, Setup > General Settings > Credit > Automatic Credit Use (untick it)
(2) For additional fields, you should use domainfields parameter in the AddOrder function as following:
'domainfields' => array(base64_encode(serialize(array($firstFieldValue))))
Docs:
Additional Domain Fields
Automatic Credit Application.
I am using this:
$sell = new Sell([
'bitcoinAmount' => (-1*$buyAmount)
]);
$client->createAccountSell($account, $sell);
But it is sending my money to my bank account and initiating a wire transfer. How can I make it so it sends the money to my USD Wallet?
I had to do this:
$sell = new Sell([
'bitcoinAmount' => .002,
'paymentMethodID' => $usdWalletID
]);
$client->createAccountSell($account, $sell);
I am trying to add subscriber to list through Getresponse api for single contact subscription to list i have to call api like this
$getresponse = new GetResponse(api key);
$result = $getresponse->addContact(listid,
$lead['name'],
$lead['email']
);
Now i want to add multiple emails at a single call, i cant use foreach loop for each contact, is there a function or endpoint to add multiple emails at a single call?
Getresponse official API shows only one contact.
https://apidocs.getresponse.com/v3/resources/contacts#contacts.create
As of now, there is no API endpoints for import contacts as bulk (csv or JSON).
Yes, Bala is correct. There is no such API method for GetResponse to insert multiple contacts. However, please check the below API codes to insert single contact to GetResponse.
include('GetResponseAPI3.class.php');
$getresponse = new GetResponse('your-getresponse-token-here');
$var = $getresponse->addContact(array
(
'name' => 'FirstName LastName',
'email' => 'emailid#something.com',
'dayOfCycle' => 0,
'campaign' => array('campaignId' => 'Campaign-id'),
'ipAddress' => 'XXX.XXX.XX.XX'
)
);
var_dump($var);
I am using ignited/laravel-omnipay package for omnipay in laravel.
I am trying to implement token billing using stripe as shown here https://github.com/thephpleague/omnipay#token-billing.
Customer are getting created successfully on stripe but i am not able to make payment with the returned customer id.
Here's my code
$token = Input::get('stripetoken');
$gateway = Omnipay::create('Stripe');
$gateway->setApiKey('My Key');
$gateway->setTestMode(true);
$cardresponse = $gateway->createCard(array('token' =>$token))->send();
if ($cardresponse->isSuccessful()) {
$card_id = $cardresponse->getCardReference();
$data = $cardresponse->getData();
$customerid = $data['id'];
$cardid = $data['default_source'];
}
$paymentresponse = $gateway->purchase(array('amount' => '10.00','currency' => 'USD', 'cardReference' => $card_id))->send();
echo $paymentresponse->getMessage();
I am getting following response.
No such token: cus_8FwPaLNKdWcfRW
And when i check my stripe dashboard then customer with this id exists and has a card assigned.
Thanks for helping.
Since you're creating a customer object, you need to update your charge creation request to pass the customer ID in the customer parameter rather than in the source parameter (which causes the error you're seeing).
I'm not familiar with Omnipay but I think this should work:
$paymentresponse = $gateway->purchase(array('amount' => '10.00','currency' => 'USD', 'customerReference' => $card_id))->send();
I have used the Omnipay PayPal_Express checkout script on my site and everything works fine when I pay for an order except the order doesn't show in the PayPal Sandbox account.
It does show when I use the same script for PayPal_Pro.
My code is as follows:
use Omnipay\Omnipay;
// PayPal Express:
if(isset($_POST['paypalexpress'])) {
$gateway = GatewayFactory::create('PayPal_Express');
$gateway->setUsername('{myusername}');
$gateway->setPassword('{mypassword}');
$gateway->setSignature('{mysignauture}');
$gateway->setTestMode(true);
$response = $gateway->purchase(
array(
'cancelUrl'=>'http://www.mysite.com/?cancelled',
'returnUrl'=>'http://www.mysite.com/?success',
'amount' => "12.99",
'currency' => 'GBP',
'Description' => 'Test Purchase for 12.99'
)
)->send();
$response->redirect();
}
I have created two test accounts in my Sandbox, one is for the above API and one I use to pay with. I have tried paying with the test card details and the login but the order detail doesn't show in the account.
Can anyone help?
It looks like you're missing the completePurchase() part when Paypal returns to your returnUrl. My code assumes that you have the order details in a variable $order, but it may look something like this:
if(isset($_GET['success'])) {
$response = $gateway->completePurchase(array(
'transactionId' => $order->transaction,
'transactionReference' => $order->reference,
'amount' => $order->total,
'currency' => $order->currency,
))->send();
if ( ! $response->isSuccessful())
{
throw new Exception($response->getMessage());
}
}
Let me know if you need any help retrieving the order details on return. It can be stored in a session before you redirect, or in a database. If you haven't done already, take a look at the example code: https://github.com/omnipay/example/blob/master/index.php