Skip to content

Instantly share code, notes, and snippets.

@perrytew
perrytew / HostedFields.class.php
Last active April 29, 2017 03:32
UltraCart/PHP: Storing credit card and cvv from the server side
<?php
// This class allows pure server side checkouts to complete orders by storing credit card numbers and cvv to the UltraCart token vault.
//
class HostedFields
{
function __construct(string $merchantId, string $cartId)
{
$this->merchantId = $merchantId;
$this->cartId = $cartId;
$this->public_key = $this->get_public_key();
@perrytew
perrytew / Adding UltraCart Hosted Fields to a Javascript Checkout
Last active February 9, 2016 19:59
Main block of code most apps will need to implement hosted fields, the new way to collect credit card numbers with UltraCart.
<!-- Changes -->
<!-- 10/1/2015 -->
<!-- Added a redundant check to make sure the hosted-fields js file actually loads first. this check has a document.write -->
<!-- call in it, so make sure the code below is at the end of the body, not in the head section. -->
<!-- 7/29/2015 -->
<!-- Added a hash of options to the setup call to allow for -->
<!-- some of the issues encountered using backbone.js checkouts. -->
<!--
options: { callback: somefunction, selectorContext: elementOrjQueryObj }