File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
standard-integration/public Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 12
12
paypal
13
13
. Buttons ( {
14
14
// Sets up the transaction when a payment button is clicked
15
- createOrder : function ( ) {
15
+ createOrder ( ) {
16
16
return fetch ( "/my-server/create-paypal-order" , {
17
- method : "post " ,
17
+ method : "POST " ,
18
18
headers : {
19
19
"Content-Type" : "application/json" ,
20
20
} ,
33
33
. then ( ( order ) => order . id ) ;
34
34
} ,
35
35
// Finalize the transaction after payer approval
36
- onApprove : function ( data ) {
36
+ onApprove ( data ) {
37
37
return fetch ( "/my-server/capture-paypal-order" , {
38
- method : "post " ,
38
+ method : "POST " ,
39
39
headers : {
40
40
"Content-Type" : "application/json" ,
41
41
} ,
52
52
JSON . stringify ( orderData , null , 2 )
53
53
) ;
54
54
const transaction = orderData . purchase_units [ 0 ] . payments . captures [ 0 ] ;
55
- alert (
56
- "Transaction " +
57
- transaction . status +
58
- ": " +
59
- transaction . id +
60
- "\n\nSee console for all available details"
61
- ) ;
55
+ alert ( `Transaction ${ transaction . status } : ${ transaction . id } \n\nSee console for all available details` ) ;
62
56
// When ready to go live, remove the alert and show a success message within this page. For example:
63
57
// var element = document.getElementById('paypal-button-container');
64
58
// element.innerHTML = '<h3>Thank you for your payment!</h3>';
You can’t perform that action at this time.
0 commit comments