Update payment processor example to show handling a saved card decline error
This commit is contained in:
parent
f281ed24bc
commit
bc4054f8fd
@ -160,6 +160,11 @@ exports.init = function () {
|
|||||||
// Same as checkout() except using a payment method already on file.
|
// Same as checkout() except using a payment method already on file.
|
||||||
// customerID and paymentMethodID are provided by getSavedPaymentMethods below.
|
// customerID and paymentMethodID are provided by getSavedPaymentMethods below.
|
||||||
await global.apis.util.delay(1000); // Replace this with something useful!
|
await global.apis.util.delay(1000); // Replace this with something useful!
|
||||||
|
var error = false;
|
||||||
|
if (error) {
|
||||||
|
// If you can't charge the payment method, throw an Error with a string to display to the user.
|
||||||
|
throw new Error("The saved card didn't work.");
|
||||||
|
}
|
||||||
global.apis.pos.addReceiptPayment(
|
global.apis.pos.addReceiptPayment(
|
||||||
new global.apis.pos.ReceiptPayment(
|
new global.apis.pos.ReceiptPayment(
|
||||||
(amount / 100).toFixed(2) * 1,
|
(amount / 100).toFixed(2) * 1,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user