File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 77 </ head >
88 < body >
99 < div id ="paypal-button-container "> </ div >
10+ < p id ="result-message "> </ p >
1011 <!-- Replace the "test" client-id value with your client-id -->
1112 < script src ="https://www.paypal.com/sdk/js?client-id=test¤cy=USD "> </ script >
1213 < script >
1314 paypal
1415 . Buttons ( {
15- createOrder : async ( data ) => {
16+ createOrder : async ( ) => {
1617 try {
1718 const response = await fetch ( '/api/orders' , {
1819 method : 'POST' ,
8889 const transaction =
8990 orderData . purchase_units [ 0 ] . payments . captures [ 0 ] ;
9091 resultMessage (
91- `<h3> Transaction ${ transaction . status } : ${ transaction . id } <br><br>See console for all available details</h3> ` ,
92+ `Transaction ${ transaction . status } : ${ transaction . id } <br><br>See console for all available details` ,
9293 ) ;
9394 console . log (
9495 'Capture result' ,
107108 . render ( '#paypal-button-container' ) ;
108109
109110 // Example function to show a result to the user. Your site's UI library can be used instead,
110- // however alert() should not be used as it will interrupt the JS SDK window
111+ // however alert() should not be used as it will interrupt the JS SDK popup window
111112 function resultMessage ( message ) {
112- const container = document . getElementById ( 'paypal-button-container' ) ;
113- const p = document . createElement ( 'p' ) ;
114- p . innerHTML = message ;
115- container . parentNode . appendChild ( p ) ;
113+ const container = document . getElementById ( 'result-message' ) ;
114+ container . innerHTML = message ;
116115 }
117116 </ script >
118117 </ body >
You can’t perform that action at this time.
0 commit comments