Sample PHP based server app for processing Simplify based transactions
Switch branches/tags
Nothing to show
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
css Updated index page Jun 18, 2015
images Adding busy indicator Jun 19, 2015
js Updated index page Jun 18, 2015
sdk Newer SDK Jun 19, 2015
.gitignore Import source code Jun 18, 2015 adding history file Jun 19, 2015
LICENSE.txt adding license file Jun 19, 2015 Update README with iOS SDK sample code snippet Dec 17, 2015
app.json Import source code Jun 18, 2015
charge.php Error handling Jun 19, 2015
favicon.ico Styling payment form Jun 18, 2015
index.php Adding busy indicator Jun 19, 2015
paymentForm.php Error handling Jun 19, 2015
simplifyLogo.png Import source code Jun 18, 2015
simplifyLogo.svg Import source code Jun 18, 2015

Simplify Payment PHP Server Deploy

This is an companion application to help developers start building mobile applications using Simplify Commerce by MasterCard to accept payments. For more information on how Simplify Commerce works, please go through the overview section of Tutorial at -

##Steps for running

  • Register with Heroku (if you haven't done so already)
  • Register with Simplify Commerce and you will need API Keys (Under Settings/API Keys) in the next step
  • Click on "Deploy to Heroku" button you see above
  • Go to index.php from the deployed app for next steps...

##Steps for integrating with iOS & Android apps


    //Copy your new php server URL and append /charge.php, then replace YOUR_HEROKU_URL with that string
    NSURL *url = [NSURL URLWithString:@"YOUR_HEROKU_URL"];

    //Create a post request
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    request.HTTPMethod = @"POST";

    //Set the request body data to an encoded string containing your token and the charge amount
    NSString *bodyString = [NSString stringWithFormat:@"simplifyToken=%@&amount=%@", token, amount];
    request.HTTPBody = [bodyString dataUsingEncoding:NSUTF8StringEncoding];

    //Create a background data task for charging the card. Be sure to switch back to the application's main thread before adjusting the app's UI
    NSURLSessionDataTask *chargeTask = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
    if (error) {
        //Handle data task error
        NSError *jsonError;
        id object = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
        if (jsonError) {
            //Handle JSON error
        else {
            //Handle JSON response
    //Start the data task
    [chargeTask resume];


    URL url = null;
    HttpURLConnection con = null;
    try {
       URL url = new URL("");
       HttpURLConnection con = (HttpURLConnection) url.openConnection();
        //add reuqest header
        con.setRequestProperty("User-Agent", ""Mozilla/5.0");
        con.setRequestProperty("Accept-Language", "en-US,en;q=0.5");

        String urlParameters = "simplifyToken="+token.getId()+"&amount=1000";

        // Send post request
        DataOutputStream wr = new DataOutputStream(con.getOutputStream());

        int responseCode = con.getResponseCode();
        System.out.println("\nSending 'POST' request to URL : " + url);
        System.out.println("Post parameters : " + urlParameters);
        System.out.println("Response Code : " + responseCode);

        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();

        while ((inputLine = in.readLine()) != null) {
        //print result
    } catch (Exception e) {
    } finally {