Git Product home page Git Product logo

coinpayments-php's People

Contributors

asheroto avatar c7hudson avatar coinpayments avatar crypto2 avatar gozur avatar shakeel2717 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

coinpayments-php's Issues

IPN issue or not ?

I've created a post response callback from IPN, does $_POST['amount'] is an value or not, so i have to use converter with this amount to USD ?

        $ipn_type = $_POST['ipn_type'];
    	$txn_id = $_POST['txn_id'];
    	$item_name = $_POST['item_name'];
        $amount = $_POST['amount'];
    	$currency1 = $_POST['currency1'];
    	$currency2 = $_POST['currency2'];
    	$status = intval($_POST['status']);

is this correct, because i got an error saying that amount index does not exist.

thank you.

CORS error when using CoinPayments API from Next.js application

I'm attempting to integrate the CoinPayments API into my Next.js application using the coinpayments npm package. However, when I try to create a new transaction using the createTransaction method, I receive the following error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.coinpayments.net/api.php. (Reason: CORS header 'Access-Control-Allow-Origin' missing). Status code: 403.

I believe this error is related to Cross-Origin Resource Sharing (CORS) restrictions that prevent my Next.js application from making requests to the CoinPayments API. I've tried setting the mode option to no-cors when making the request, but this doesn't seem to resolve the issue.

Can you provide guidance on how to resolve this issue? Do I need to configure my server to allow cross-origin requests, or is there a way to configure the coinpayments package to handle CORS headers correctly?

Thanks for your help!

Too many errors in the last two minutes

When I test it on localhost its working fine but when I uploaded it to the server it gives the following error message always-

Too many errors in the last two minutes from 2001:41d0:303:20a8:: please fix your code 
and try again

CoinPayment IPN issue

I am trying to implement IPN notification on my server side .When i receive IPN on server , i am able to fetch request hmac from the request header but there is not data in body .
Server is in nodejs . i am taking reference from this example (https://www.coinpayments.net/downloads/cpipn.phps)
Sample code for my express server


const express = require('express')
const app = express()
const port = 8085;

app.get('/', (req, res) => res.send('Hello World! GET'));

app.post('/', (req, res) => res.send('Hello World! POST'));

app.get('/coinpaymentnotification', (req, res) => {
console.log("\nGET");
console.log(req.header);
console.log(req.headers);
console.log(req.body);
res.send('Hello World! GET');
});

app.post('/coinpaymentnotification', (req, res) => {
console.log("\nPOST");
console.log(req.header);
console.log(req.headers);
console.log(req.body);
res.send('Hello World! POST');
});

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))

Output of those console statement :

POST
[Function: header]
{
  host: 'hostname',
  'user-agent': 'CoinPayments.net IPN Generator',
  accept: '*/*',
  hmac: 'hmacsendfromIPN',
  'content-type': 'application/x-www-form-urlencoded; charset=utf-8',
  'content-length': '378'
}
undefined

From reference example it seems i have to take body data and pass data and secret to hmac function for generating hmac .After generating hmac verify hmac with hmac send in request header .

  1. Is i am doing something wrong in code ?
  2. do i have to change some settings on coin payment account ?
  3. is there any way i can test IPN on local system rather then live ?

variables must be replace

// Check for success of API call
if ($cps_api['error'] == 'ok') {
    // Prepare start of sample HTML output
    $output = '<table><tbody><tr><td>Username</td><td>Merchant ID</td><td>Email</td><td>Public Name</td></tr>';
    $output .= '<tr><td>' . $cps_api['result']['username'] . '</td><td>' . $cps_api['result']['merchant_id'] . '</td><td>' . $cps_api['result']['email'] . '</td><td>' . $cps_api['result']['public_name'] . '</td></tr>';
    // Close the sample output HTML and echo it onto the page
    $output .= '</tbody></table>';
    echo $output;
} else {
    // Throw an error if both API calls were not successful
    echo 'There was an error returned by the API call: ' . $balances['error'] . '<br>Rates API call status: ' . $rates['error'];
}

$cps_api should be replaced by $information in the above code

Autoload doesn't work

  1. The latest version on packagist is not up-to-date (missing autoload section in composer.json).
  2. Even if I install current version with "composer require coinpaymentsnet/coinpayments-php" and then add "classmap": ["/src"] to vendor/coinpaymentsnet/coinpayments-php/composer.json classes are still not auto loaded by composer.

As a workaround I just added this to the root composer.json:

"classmap": [
  "vendor/coinpaymentsnet/coinpayments-php/src"
]

GetCallbackAddressWithIpn with an empty label returns an error

GetCallbackAddressWithIpn with an empty label returns the following error:

Error: The field "label" was passed but is not a valid field for the "get_callback_address" command!

public function GetCallbackAddressWithIpn($currency, $ipn_url, $label='')
{
$fields = [
'currency' => $currency,
'ipn_url' => $ipn_url,
'label' => $label,
];
return $this->request_handler->execute('get_callback_address', $fields);
}

A quick fix would be to only add the 'label' => $label key-value pair when it's not an empty string.

How many addresses can be generated with GetOnlyCallbackAddress

I have a doubt please clear it, How many addresses can be generated with GetOnlyCallbackAddress() or GetCallbackAddressWithIpn().

Actually, I want each of my users to have a single deposit address, what will happen if my user exceeds 3k or 10k or let's say 100k.

I'm afraid, duplicate addresses will be assigned! Can somebody let me know about its limit?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.