Skip to content

Instantly share code, notes, and snippets.

View fatmatto's full-sized avatar
🎯
Focusing

Mattia Alfieri fatmatto

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am fatmatto on github.
  • I am fatinside (https://keybase.io/fatinside) on keybase.
  • I have a public key ASB0WhPw0jZIgmTUyXXZ-QYFFxplRbo7k3GWJ6bOb-S7lAo

To claim this, I am signing this object:

Verifying that "fatmatto.id" is my Blockstack ID. https://onename.com/fatmatto
0x1F5757DCA13a7fAC3589CE575efFfba45D2f58C4
@fatmatto
fatmatto / marketcloud_checkout.js
Last active July 28, 2017 11:45
Complete register to checkout process for a Marketcloud app in plain client side JS
import Marketcloud from './path/to/marketcloud-js/dist/marketcloud.min.js'
// Creating a new instance of the Marketcloud client
var client = new Marketcloud.Client({
public_key : "your-public-key" // get it at www.marketcloud.it
});
// Utility function to create test passwords and emails
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Thank you for your order!</title>
<style media="all" type="text/css">
@media all {
@fatmatto
fatmatto / marketcloud_razorpay.php
Last active January 20, 2017 13:51
How to receive a razorpay event and update a Marketcloud order
<?php
// You need to install the Marketcloud SDK, you will find information on GitHub
// https://www.marketcloud.it/documentation/reference/php
/*
* Here you can find the data structure sent as a POST request
* The reference event is order.paid
https://docs.razorpay.com/v1/page/webhooks
*
*/
@fatmatto
fatmatto / marketcloud_file_upload.js
Last active December 13, 2016 23:15
Reading a file and uploading it with Marketcloud and the Javascript SDK
// Creating a new instance of the Marketcloud client
var client = new Marketcloud.Client({
public_key: 'your-public-key'
})
// File uploads requires at least user authentication
client.users.authenticate('example@mail.com', 'somepassword')
.then(function(response) {
// Auth was successful the client stored the user's auth token
@fatmatto
fatmatto / marketcloud-token.sh
Last active February 29, 2016 14:07
Generate a marketcloud token with curl
#!/bin/bash
timestamp=$(date +%s)
hashedSecret=$(echo -n "YOUR_SECRET_KEY$timestamp" | openssl sha256 -binary | base64)
curl -XPOST -H "Content-Type: application/json" -d "{\"publicKey\" : \"YOUR_PUBLIC_KEY\",\"secretKey\" : \"${hashedSecret}\",\"timestamp\" : ${timestamp}}" http://api.marketcloud.it/v0/tokens
@fatmatto
fatmatto / marketcloud-token.js
Last active September 8, 2015 15:38
Get a token marketcloud
var superagent = require('superagent'),
crypto = require('crypto');
var current_time = Date.now(),
public_key = "YOUR-PUBLIC-KEY",
secret_key = "YOUR-SECRET-KEY",
hash = crypto.createHash('sha256')
.update(secret_key+current_time)
.digest('base64');
@fatmatto
fatmatto / marketcloud.json
Created August 22, 2015 16:20
Marketcloud apis.json
{}