File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 7
7
</ head >
8
8
< body >
9
9
< div id ="paypal-button-container "> </ div >
10
+ < p id ="result-message "> </ p >
10
11
<!-- Replace the "test" client-id value with your client-id -->
11
12
< script src ="https://www.paypal.com/sdk/js?client-id=test¤cy=USD "> </ script >
12
13
< script >
13
14
paypal
14
15
. Buttons ( {
15
- createOrder : async ( data ) => {
16
+ createOrder : async ( ) => {
16
17
try {
17
18
const response = await fetch ( '/api/orders' , {
18
19
method : 'POST' ,
88
89
const transaction =
89
90
orderData . purchase_units [ 0 ] . payments . captures [ 0 ] ;
90
91
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` ,
92
93
) ;
93
94
console . log (
94
95
'Capture result' ,
107
108
. render ( '#paypal-button-container' ) ;
108
109
109
110
// 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
111
112
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 ;
116
115
}
117
116
</ script >
118
117
</ body >
You can’t perform that action at this time.
0 commit comments