Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the currency #5

Closed
acrobaat opened this issue Jan 7, 2017 · 1 comment
Closed

Changing the currency #5

acrobaat opened this issue Jan 7, 2017 · 1 comment

Comments

@acrobaat
Copy link

acrobaat commented Jan 7, 2017

Hi,
How do I change this code to accept Euro's (or any other currency)
I found the $ signs and changed them into €, but how is the calculation made into bitcoins?

@coinables
Copy link
Owner

coinables commented Jan 7, 2017

Calculation is done on the index.php page and then stored in a session while the user browses so that prices don't change while they shop. https://github.com/coinables/Blockchain-Receive-Payments-API-Shopping-Cart/blob/master/index.php#L11-L17

Current source is from Coinbase, but you can change it to whatever you want. For example in Euros you can get it from btc-e or kraken.

Example using btc-e BTC/EUR conversion.
Change lines 11-17

//get current exchange rate
if(!isset($_SESSION['exr'])){
$url = "https://btc-e.com/api/3/ticker/btc_eur";
$json = json_decode(file_get_contents($url), true);
$price = $json["btc_eur"]["last"];
$_SESSION['exr'] = $price;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants