Jump to content

[Guide] How to implement Bitcoin payments end-to-end using CoinGate


Recommended Posts

Disclaimer:

The instructions in this post are only guaranteed to work with PrestaShop 1.7.2.4 and CoinGate module 1.2.5. 

Goal:

Implementing the Bitcoin currency end-to-end

Problem:

Prestashop does not allow for custom currency creation via the Admin interface. When trying to add a new currency, you must select from a list of fiat currencies, such as USD or EUR. When making a purchase, the Total of the order (in the fiat currency) is forwarded to CoinGate which uses their own servers to convert it to the equivalent in Bitcoins, at the current rate.

Solution: 

Step 1) Open the file `modules/coingate/controllers/front/redirect.php`. Go to Line 80 and change it from:

            'currency'         => $currency->iso_code,

to:

            'currency'         => 'BTC',

This will tell CoinGate to treat the Total of the order as if it was designated in Bitcoin, rather than a fiat currency. Conversion will no longer take place. 

Step 2) Open the file `translations/cldr/main--xx-XX--currencies` ("xx-XX" varies depending on the location of your store). Find the following text:

           "USD":{"displayName":"US Dollar","displayName-count-one":"US dollar","displayName-count-other":"US dollars","symbol":"$","symbol-alt-narrow":"$"}

and change it to:

           "USD":{"displayName":"Bitcoin","displayName-count-one":"Bitcoin","displayName-count-other":"Bitcoin","symbol":"\u20BF ","symbol-alt-narrow":"\u20BF "}

This will simply display ₿ instead of $ (to learn more, read: https://www.prestashop.com/forums/topic/608078-guide-how-to-configurecustomize-your-currency-in-prestashop-17/). 

Step 3) Now just set the prices of your products as if they were in Bitcoins.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...