coinpaymentsnet / coinpayments-php Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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.
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!
https://i.imgur.com/wN6S9f3.png
Is it possible with this library?
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
There is no way to obtain information on the minimum withdrawal of each currency.
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 .
The function does not provide a way to pass this POST attributes:
success_url, cancel_url
// 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
"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 the following error:
Error: The field "label" was passed but is not a valid field for the "get_callback_address" command!
coinpayments-php/src/CoinpaymentsAPI.php
Lines 452 to 461 in 72e1abd
A quick fix would be to only add the 'label' => $label
key-value pair when it's not an empty string.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.