Skip to content

Instantly share code, notes, and snippets.

@isaiahbaca
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save isaiahbaca/db3bb99942ce2351420c to your computer and use it in GitHub Desktop.

Select an option

Save isaiahbaca/db3bb99942ce2351420c to your computer and use it in GitHub Desktop.
$( document ).ready(function() {
$("a#invoice").click(function(){
breakdown = [
{name: "Red #353", amount: 5.99, quantity: 2},
{name: "Blue #533", amount: 4.99, quantity: 1},
{name: "NM Sales Tax", amount: 0.55, quantity: 1}
]
billing = {
street : "123 Billing",
street2 : "",
city : "City Of Billing",
state : "Billing State",
zip : "91010"
}
shipping = {
street : "123 shipping",
street2 : "",
city : "City Of shipping",
state : "Shipping State",
zip : "91010"
}
custom_fields = [
{name: "custom_field", required: true},
{name: "another_one", required: true},
{name: "optional_one", required: false}
]
properties= {
requires_shipping_address : true,
requires_billing_address : true,
shipping_address : shipping,
billing_address : billing,
request_custom_data : custom_fields,
item_details : 'Really more like offer details. This will Show up on hosted PCP.',
name : 'Sets offer/token name. Will also show up on hosted PCP',
item_quantity: : 9999,
expires_in_seconds : 999999,
auth_only : false
/* estimated_fulfillment_days : 1 ### Only use if auth only is set to true */
/* url : 'http://exmaple.com/signup' ###Only set if you dont want to use PCP */
}
atpay.invoice("[email protected]", "Your Mary Kay Order", "Please review your order details below:", breakdown, properties,
function(response){
console.log(response)
}
);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment