Developers

Integrate mobile payments and monetize with Mocopay

Our developer center provides all the details for a simple and smooth integration so you could easily add mobile payments with Mocopay.

Calculating signature

It is mandatory to provide correct signature with each API call. Signature is sent in:

A) HTTP header ‘Signature’

or

B) HTTP request parameter ‘signature’

NOTE: Also when WEB SDK is used in advanced mode this signature is also send in data-spgw-signature parameter of payment button.

Content of signature parameter or header is constructed in following form:

<api-key>:<base64(MD5(signaturestring))>

Guide for preparing 

signaturestring

which needs to be MD5 coded:

  • sort all API request parameters together with their values, sorting is done based on the first character in parameter name (by character code in strict ASCII order e.g. a parameter name that begins with the uppercase letter F (ASCII code 70) precedes a parameter name that begins with a lowercase letter b (ASCII code 98).)
  • append sorted parameters to request URI followed with sign ‘?’
  • append request URI with sorted parameters to API secret given from MoCoPay for your service

Example:

API key: app1

API secret: this.is.a.secret

URI with sorted parameters: /v1/payment/initPayment/?mcc=228&mnc=01&pid=12000&userId=123456789

Signature string: this.is.a.secret/v1/payment/initPayment/?mcc=228&mnc=01&pid=12000&userId=123456789

Produced signature content:

app1:WETDyNQLx0+8BJ16vDgiVg==