Skip to content

Instantly share code, notes, and snippets.

@spaomalley
spaomalley / paymentEcho.php
Last active December 15, 2015 10:48
Simple payment example that uses the 'echo' feature to return the created resource data.
<?php
require 'ConfigFactory.php';
require 'OAuthRequest.php';
$c = new Creds();
$creds = $c->creds();
$links = $c->links();
$accessTokenData = getAccessToken($links, $creds);
@spaomalley
spaomalley / getPayment.php
Last active December 15, 2015 10:48
Retrieve specific Payment resource
<?php
require 'ConfigFactory.php';
require 'OAuthRequest.php';
$c = new Creds();
$creds = $c->creds();
$links = $c->links();
$accessTokenData = getAccessToken($links, $creds);
@spaomalley
spaomalley / ConfigFactory.php
Last active December 15, 2015 06:08
These 2 files are necessary for many of the examples listed on the PPS API examples page in relation to the API Documentation. OAuth.php constructs the OAuth request. enterCreds2.php holds basic information such as your credentials, merchantId and endpoints.
<?php
class Creds{
function creds(){
//You're using 2-Legged OAuth so you're consumer secret is a SHA1 hash of your password into beta.mxmerchant.com
//put that between password between the second 2 single quotes.
return array(
@spaomalley
spaomalley / createOrder.php
Last active December 15, 2015 05:29
Create a basic order with our API
<?php
require 'Creds.php';
require 'OAuth.php';
$c = new Creds();
$creds = $c->creds();
$links = $c->links();
$accessTokenData = getAccessToken($links, $creds);
@spaomalley
spaomalley / OAuth.py
Last active December 14, 2015 06:39
OAuth 2 Legged Authentication
import base64
import datetime
import hmac
import hashlib
from hashlib import md5
import random
import re
import time
import urllib
import urllib2
@spaomalley
spaomalley / 3leg.php
Last active December 13, 2015 21:48
3-Legged OAuth 1.0a Authentication 3leg.php- Credentials, and functions for 3-legged OAuth authentication authorize.php- gets your request token, stores response in mysql db redirects to authorization URI callback.php- exchanges request token for access token utilizing oauth_verifier
<?php
$consumerKey = '';
$consumerSecret = '';
$links = array(
'request'=> array('https://api.prioritypaymentsystems.com/checkout/v1.1/oauth/1a/requesttoken',"POST"),
'authorize'=> array('https://beta.mxmerchant.com/oauth/authorize',"GET"),
'access'=> array('https://api.prioritypaymentsystems.com/checkout/v1.1/oauth/1a/accesstoken', "POST")
);
@spaomalley
spaomalley / postCust.php
Last active December 13, 2015 20:38
Create a customer using the minimum requirements
<?php
require 'ConfigFactory.php';
require 'OAuthRequest.php';
$c = new Creds();
$creds = $c->creds();
$links = $c->links();
$accessTokenData = getAccessToken($links, $creds);
@spaomalley
spaomalley / CreatePayment.php
Last active December 12, 2015 12:28
Simple Payment Example in PHP (with echo option)
<?php
require 'ConfigFactory.php';
require 'OAuthRequest.php';
$c = new Creds();
$creds = $c->creds();
$links = $c->links();
$accessTokenData = getAccessToken($links, $creds);