Skip to content

Instantly share code, notes, and snippets.

@spaomalley
spaomalley / payment.php
Created November 26, 2013 17:57
Basic payment example using PHP
<?php
require 'ConfigFactory.php';
require 'OAuthRequest.php';
$c = new Creds();
$creds = $c->creds();
$links = $c->links();
$accessTokenData = getAccessToken($links, $creds);
@spaomalley
spaomalley / OAuth.js
Last active December 20, 2015 12:49
Make a payment using stored card information for a customer. NOTE:: The CVV must be captured per transaction.
function OAuthObject(linkObject, tokenObject, idObject, queryParameters){
this.linkObject = linkObject;
this.credentialObject = getCredentials();
this.tokenObject = tokenObject;
this.idObject = idObject;
this.queryParameters = queryParameters;
this.parameterAggregate = [];
this.authorization_Headers = '';
@spaomalley
spaomalley / CreateCustomerCardAccount.js
Created August 1, 2013 16:11
Store card information for a customer
function API_Demo(){
this.tokenObject={};
this.idObject={};
this.endPoints = getEndpoints();
this.setIdObject = function(id){
this.idObject = {
@spaomalley
spaomalley / CustomerCreate.js
Created August 1, 2013 16:10
Create a Customer Record
function API_Demo(){
this.tokenObject={};
this.endPoints = getEndpoints();
this.captureResourceId = function (location){
return location.substr(location.lastIndexOf('/') + 1, location.length);
@spaomalley
spaomalley / Config.js
Last active December 16, 2015 07:29
Javascript OAuth Authentication helper functions
var Config = {
credentials: {
"consumerKey" : "",
"consumerSecret" : ""
},
Endpoints: {
request: {
url: 'https://sandbox.api.prioritypaymentsystems.com/checkout/v1.1/' + 'oauth/1a/requesttoken'
,method: "POST"
function Payment(){
var setTokenData = function(response){
Config.tokens.oauth_token = response.oauth_token;
Config.tokens.oauth_token_secret = response.oauth_token_secret;
}
var Tokens = {
@spaomalley
spaomalley / control.js
Last active December 16, 2015 07:09
Javascript implementation of retrieving a payment record. Your consumer key and secret will need to be entered to complete the request.
function demoAPI(){
var DA = new API_Demo();
DA.setTokens();
DA.postPayment();
DA.getPaymentById();
}
@spaomalley
spaomalley / OAuth.js
Last active December 16, 2015 03:59
This is a javascript implementation of the OAuth 1.0a workflow. It uses the Crypto-Js library.
function oauth(method, url,token,tokenSecret){
var consumerKey = "";
var consumerSecret = "";
var params = {
"oauth_consumer_key": consumerKey,
"oauth_nonce": generateNonce(),
"oauth_signature_method": "HMAC-SHA1"
}
@spaomalley
spaomalley / ConfigFactory.cs
Last active December 16, 2015 01:59
.NET(C#) Basic payment submission.
namespace Card_Account_Transactions
{
public class ConfigFactory
{
public string consumerKey;
public string consumerSecret;
public string merchantId;
public string baseURL;
@spaomalley
spaomalley / deletePayment.php
Last active December 15, 2015 10:48
Payment Deletion. This is only available to use when the 'status' attribute of the payment resource is NOT set to 'Settled'. If so, you must is issue a refund.
<?php
require 'ConfigFactory.php';
require 'OAuthRequest.php';
$c = new Creds();
$creds = $c->creds();
$links = $c->links();
$accessTokenData = getAccessToken($links, $creds);