You have to transmit several parameters to EveryWallet SCI API to form a payment page. Those parameters contain data about the selling item, its price, details etc.
Here is an example of a typical payment form:
1 2 3 4 5 6 7 8 9 |
<form action="http://everywallet.com/sci/index.html" method="get"> <input type="hidden" name="e" value="your@email.com"/> <input type="hidden" name="m" value="merchant_site_code"/> <input type="hidden" name="a" value="100"/> <input type="hidden" name="d" value="merchant_doc_ref"/> <input type="hidden" name="s" value="signature"/> <input type="hidden" name="t" value="memo"/> <input type="image" alt="Pay with EveryWallet" name="submit" src="{button_img_url}"/> </form> |
Here is an example of a payment link URL:
1 |
http://EveryWallet.com/sci/index.html?e={buyer_email}&m={merchant_site_code}&a={amount}&d={merchant_doc_ref}&s={signature}&t={memo} |
Combine variables to create a request matching all your needs.
Param | Value |
---|---|
e | Buyer’s e-mail. |
m | Merchant-ID in EveryWallet. Displayed in Merchant Processing integration settings. |
a | Amount in the currency of your store. |
d | Number of an order in your store. You need to ensure the uniqueness of this parameter. |
s | Control signature. MD5 hash from the string «m:a: secret_word:d», where secret_word is a value of Secret key 1, specified in Merchant Processing settings. |
t | Payment attribute, e.g. product name in a merchant’s store. |
p | Buyer’s mobile phone number. |
b | Optional. You can put your parameters here, our server will return them to your Status URL. |
Here is the signature-forming function, implemented in PHP:
1 2 3 |
function make_signature($merchant_id, $out_amount, $secret_word, $order_id) { return md5($merchant_id.":".$out_amount.":".$secret_word.":".$order_id); } |
Control signature function is used to prove the authority of every SCI and callback request. The signature is a 32-bit number in hexadecimal notation, formed as a MD5 hash from a set of parameters represented as a string.
Here are the examples of control signature function, implemented in popular languages.
PHP:
1 2 3 |
function make_signature($merchant_id, $out_amount, $secret_word, $order_id) { return md5($merchant_id.":".$out_amount.":".$secret_word.":".$order_id); } |
JavaScript:
1 2 3 |
function makeSignature(merchantId, amount, merchantDocRef, secret){ return md5([merchantId, amount, merchantDocRef, secret].join(":")) } |
Java:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public static String md5(String input) { String md5 = null; if (null == input) return null; try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(input.getBytes(), 0, input.length()); md5 = new BigInteger(1, digest.digest()).toString(16); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return md5; } public String makeSignature(int merchantId, double amount, String merchantDocRef, String secret) { return md5(merchantId + ":" + amount + ":" + merchantDocRef + ":" + secret); } |
Python:
1 2 3 4 5 |
#Python 2/3 import hashlib def makeSignature(merchantId, amount, merchantDocRef, secret): raw = ':'.join(map(str, [merchantId, amount, merchantDocRef, secret])) return hashlib.md5(raw.encode('utf-8')).hexdigest() |
Perl:
1 2 3 4 5 6 |
use Digest::MD5 qw(md5_hex); sub makeSignature { my @list = @_; return md5_hex($list[0].':'.$list[1].':'.$list[2].':'.$list[3]); } |