Last active
July 18, 2017 01:29
-
-
Save jonathanGB/435470fbbcf1a3d8d0fe176a9a94add1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const methodData = [{ | |
supportedMethods: ["basic-card"], | |
data: { | |
supportedNetworks: ['visa', 'mastercard'], | |
supportedTypes: ['debit'] | |
} | |
}, { | |
supportedMethods: ["https://example.com/bobpay"], | |
data: { | |
merchantIdentifier: "XXXX", | |
bobPaySpecificField: true | |
} | |
}]; | |
const details = { | |
id: "super-store-order-123-12312", | |
displayItems: [{ | |
label: "Sub-total", | |
amount: { currency: "USD", value: "55.00" }, // US$55.00 | |
}, { | |
label: "Sales Tax", | |
amount: { currency: "USD", value: "5.00" }, // US$5.00 | |
}], | |
total: { | |
label: "Total due", | |
amount: { currency: "USD", value: "60.00" }, // US$60.00 | |
} | |
} | |
const options = { | |
requestShipping: true | |
} | |
const request = new PaymentRequest(methodData, details, options); | |
request.show() | |
.then(res => console.log(`waddup: ${res}`)) | |
.catch(err => console.error(`err: ${err}`)); | |
setTimeout(() => { | |
request.abort() | |
.then(() => console.log("it's all good [aborted]")) | |
.catch(err => console.error(`error aborting: ${err}`)) | |
}, 2000); | |
const request2 = new PaymentRequest(methodData, details, options); | |
request2.show() | |
.then(res => console.log(`waddup: ${res}`)) | |
.catch(err => console.error(`err: ${err}`)); | |
setTimeout(() => { | |
request2.abort() | |
.then(() => console.log("it's all good [aborted 2]")) | |
.catch(err => console.error(`error aborting: ${err}`)) | |
}, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment