Skip to content

Commit c4dc493

Browse files
committed
Update: Apple pay retrieve onsessioncreate event data to be accessible from main context
1 parent 1086d13 commit c4dc493

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Resources/views/Gateway/apple_pay.html.twig

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@
6262
customData: customData
6363
};
6464
65+
console.log(JSON.stringify(tokenData));
66+
appleSession.abort();
67+
68+
return;
69+
6570
let headers = new Headers();
6671
headers.append('X-Requested-With', 'XMLHttpRequest');
6772
headers.append('Content-Type', 'application/json; charset=utf-8');
@@ -115,12 +120,18 @@
115120
}
116121
117122
if (typeof ApplePaySession.onsessioncreate == 'function') {
118-
ApplePaySession.onsessioncreate({
123+
let event = {
119124
'amount': orderAmount,
120125
'request': applePayPaymentRequest,
121126
'session': appleSession,
122127
'customData': customData,
123-
});
128+
};
129+
130+
ApplePaySession.onsessioncreate(event);
131+
132+
applePayPaymentRequest = event.request;
133+
appleSession = event.session;
134+
customData = event.customData;
124135
}
125136
126137
appleSession.begin();

0 commit comments

Comments
 (0)