Skip to content

Instantly share code, notes, and snippets.

@zkoch
Created March 25, 2016 18:32
Show Gist options
  • Save zkoch/e700bf7815113e537009 to your computer and use it in GitHub Desktop.
Save zkoch/e700bf7815113e537009 to your computer and use it in GitHub Desktop.
var methods = ["//android.com/pay", "visa", "mastercard", "amex", "discover"];
var request = {
"items": [
{
"id": "basket",
"label": "Sub-total",
"amount": {
"currencyCode": "USD",
"value": "55.00"
}
},
{
"id": "tax",
"label": "Sales tax",
"amount": {
"currencyCode": "USD",
"value": "5.00"
}
},
{
"id": "total",
"label": "Total due",
"amount": {
"currencyCode": "USD",
"value": "60.00" // This amount is always total shown
}
}
],
shippingOptions: [
{
"id": "free",
"label": "Free Shipping!",
"amount": {
"currencyCode": "USD",
"value": "0.00"
}
}
]
};
var options = {
requestShipping: true
};
var methodData = {
"//android.com/pay": {
"gateway": "stripe",
"stripe:publishableKey": "pk_test_VKUbaXb3LHE7GdxyOBMNwXqa",
"stripe:version": "2015-10-16 (latest)"
}
};
var pr = new PaymentRequest(methods, request, options, methodData);
pr.show().then(function(paymentResponse) {
console.log(paymentResponse);
paymentResponse.complete(true);
}).catch(function(err) {
console.log("I am sad", err.message);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment