Skip to content

Commit 442e524

Browse files
authored
Improve the check for instrument declined use case (#68)
1 parent dcd953d commit 442e524

File tree

1 file changed

+1
-6
lines changed
  • advanced-integration/public

1 file changed

+1
-6
lines changed

advanced-integration/public/app.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,8 @@ async function onApproveCallback(data, actions) {
5555
orderData?.purchase_units?.[0]?.payments?.authorizations?.[0];
5656
const errorDetail = orderData?.details?.[0];
5757

58-
const isHostedFieldsComponent = typeof data.card === "object";
59-
6058
// this actions.restart() behavior only applies to the Buttons component
61-
if (
62-
errorDetail?.issue === "INSTRUMENT_DECLINED" &&
63-
isHostedFieldsComponent === false
64-
) {
59+
if (errorDetail?.issue === "INSTRUMENT_DECLINED" && !data.card && actions) {
6560
// (1) Recoverable INSTRUMENT_DECLINED -> call actions.restart()
6661
// recoverable state, per https://developer.paypal.com/docs/checkout/standard/customize/handle-funding-failures/
6762
return actions.restart();

0 commit comments

Comments
 (0)