Payment Gateway Setup (SpicePay)

Overview
SpicePay is a payment gateway for blockchain payments. According to their website "Use SpicePay's online retail, e-commerce, billing and donation tools to accept blockchain payments from customers worldwide in Bitcoin and other cryptocurrencies. Access your funds immediately, with no fraud and no chargebacks, and save an average of 2% on every transaction!". To use this gateway please see below.
Live/Sandbox
SpicePay doesn`t have a native Sandbox area, but passes test variables if Maian Coin is in test mode so you can pay using a Testnet wallet.

Live Account:
https://spicepay.com.
API Setup
1 Log into your SpicePay account.

2 From the main dashboard, click "Tools" and then scroll down to Sites and click "Add Site".

3 Complete the information shown. Default values can be left as they are, but note the following for certain fields:

Status (Callback) URL = This is the full url to the following file in your installation: control/callback.php.

Example:
https://www.example.com/coin/control/callback.php

Return URL = The return url should be to "https://www.example.com/coin/?thanks=yes". Adjust path so it poins to the correct url.
Secret Code = Your secret code. Used for callback verification. Make it long and complex.
Form Method = Should be set to POST.

IMPORTANT: After you have added a site, go back in via the edit button. A new option will appear called "Add GET parameter "orderId" to Return URL.". Make sure this box is checked.

4 Log in to your Maian Coin control panel and navigate to "Settings > Payment/Currency".

5 On the "General" tab, select "SpicePay" as the "BitCoin/Blockchain Gateway".

6 On the parameters tab, create the following parameters with the correct values:

spicepay-site-id = Your SpicePay Site ID as shown in the Sites list.
spicepay-secret-code = Your SpicePay secret code for callback verification.


Setup completed. You are now ready to receive/test payments using SpicePay.
Accepted Statuses
Maian Coin will only update a sale as completed when it receives a response of "paid" from SpicePay. In some cases, there could be a delay before this response is received. If you would like the system to update a sale as completed for other statuses, add them to the 'accepted-statuses' array in the following file:

control/classes/gateways/class.spicepay.php

You should be cautious about this. Only the "paid" status confirms the sale on the blockchain and the merchant.

For a list of available statuses see the SpicePay website.

If you wish to allow sales that are pending (if supported by gateway), see the "Process Pending Payments as Completed" option in the payment settings.
Allowed IP Addresses
Maian Coin will only accept callbacks from valid gateway IP addresses. At the time of these docs, the allowed IP(s) for this gateway are:

51.254.46.119, 217.23.11.119 & 54.38.194.239

If the IP(s) are updated/changed, update IP addresses in the following file:

control/classes/gateways/class.spicepay.php
Resend IPN
If a sale isn`t updated because a callback wasn`t received, you can resend the callback via the SpicePay control panel. Locate the relevant sale and click the 'IPN' button next to the sale.