CryptoGofer!

Documentation & Implementation

This is intended for people with some knowledge of code, php specifically...but having said that, if I continue to hear the same comments/questions about set-up I will begin work on a knowledgebase. Your feedback will help, & donations are appreciated!

Topics:

Sending Transactions
Getting Our Exchange Rates
Variables You Can Send
What We Return
Security Hash
Return URL
Notification URL (IPN/Listener)


How To Send Transactions:

Sending a transaction (requesting your user pay) is quite simple, you can just use a normal hyperlink like this (of course you can fancy that up by using an image, or whatever):

Or you may wish to create a form on your site and post to us:


Exchange Rates:

Why would you do this?
To give your user an expectation of how much crypto they'll be paying...or whatever - it's kind of unessesary since you'll be able to just send them to our site with a price in USD and it will automatically convert...but I know this is a functionality I would want, so I made it.

Here's the code:

You can get the price of any coin we support by simply changing out the 'LTC' with any of the currencies found here: http://CryptoGofer.com/crypto2usd.php

You can access this in any language you're comfortable with...I'm just a php guy.

To avoid complications of people paying the wrong amount because of volatile currencies, we only update our prices a couple times per day.

This helps if someone isn't able to complete their transaction in the 10 minutes provided and needs to manually update their amount later on in the day...and as you may know, even 1 minute can make a difference in crypto.


Variables You Can Send:

Required Variables:
u
Your User ID
h
Hash how to create
w
Is walled address to send to
c
Currency ie. BTC, BCH, LTC...
NOTE: Send One OR The Other Amount, NOT both - if both are sent crypto will be used.
ad
Amount To Pay In USD
ac
Amount To Pay In Crypto
Optional Variables:
p
Product ID/Description
v
Variables you would like to send, ie a username or other identifying information for you to
r
return url, (where the user goes after payment) how to create
Please Note: You cannot send your return url with any parameters, (ie. http://mydomain.com/?whatever=whatever) When we redirect back to you we will need to send variables to that page, and that leads to conflicts.

Allowed Characters:

As you may know, some characters can effect the functionality of a URL and/or database...as such we only allow:
• Alphanumeric characters (ie, A-Z a-z 0-9)
• @ (At Sign)
• , (comma)
• . (period)
• - (hyphen)
• / (forward slash)
• : (colon)
ALL other characters will be turned into a tilde (~), so we don't reccommend using it.

So you may need to check what we send back to you for a match like this:
$returned_var = $_GET["returned_var"];
$my_var='whatever';
$my_stripped_var=preg_replace("#[^0-9a-z @.,-]#i", "~", $my_var);

Now you can make a match for whatever functionality you need - but note this isn't 100% accurate, if someone else has a different illegal character in the same place, but the rest of the same allowed...statistically quite a low probability, and I've been doing this for years without issue.


What Do We Send Back?

CGhash We will return a hash so you know this is from us: see example below.
CGstatus success, cancel, fail, timeout, wronghash, usedtxn
CGnote A note/comment; sent when status=fail or other unexpected events
CGtxn Transaction hash/ID
CGconf Transaction Confrimations
CGwallet wallet address paid
CGcrypto what crypto currency ie. BTC
CGamt amount paid in crypto
CGprod Product ID/Description (you sent this)
CGvars Other variables you sent, if you need multiple simply send comma separated and create an array like "something:this,whatever:that" etc...then array it on your end

How To Create Your Security Hashes:

We create this hash so people aren't able to change payment amounts or wallets once they land on the payment page...and especially so you know the information we send back to you is correct.

Send Hash (this is for posting to us)

Return Hash (this is what we send back to you)

Notes:
Amount Returned To You Is In Crypto!
• Remember, your private key should NEVER be given out - The ONLY way someone can change the wallet or ammount is by knowing your private key!
• If 'the math' does not add up we simply return the user to your site.
• There is a send hash generator inside the members area, if you need to create static payment links for your site.


Return URL:

So when they land on your page you should do some basic checks...here is what a basic return url could look like - obviously you're going to need to make it beautiful, again, I'm just a php guy ;)

Notes:
• The messages & links in this example obviously need to be updated to work/make sense on your site.
• If you only have one thing the user could pay for from your site, you can simply use your payment link directly on this page instead of your own "order.php" page


Notification URL:

This is a 'back end' type page where notifications of successful transaction details are sent - this will include the initial transaction, and when your set number of confirmations has been reached.

We require that you echo out a '1' to the the page so we know the message was received.

Example script:

Notes:
• The user should never see/go to/know about this page.
• To conserve resources the script will only check for confirmations on transactions for 3 days.
• You can use this script to update your database or simply email yourself, or not use it at all
• We will send you a notification instantly after a transaction, and then again after your specified number of confirmations has been reached/exceeded.
• We will attempt to ping your notification URL 6 times, if we do not see a '1' on this page. 2nd attempt will be made in about 10 minutes, the 3rd in about an hour after that, the 4th in about 12 hours, the 5th after 24 hours the 6th after 48 hours. If we don't see the required info we will assume your notification script isn't working - if a high percentage of your transactions fail, the script will deactivate your IPN service, and you will need to update manually inside your account.