22
22
</ section >
23
23
< br >
24
24
< h3 > Core API Credit Card</ h3 >
25
- < form action ="/coreapi " method ="POST " id ="payment-form ">
25
+ < form action ="/coreapi-card-charge-ajax-handler " method ="POST " id ="payment-form ">
26
26
< fieldset >
27
27
< legend > Checkout</ legend >
28
28
< small > < strong > Field that may be presented to customer:</ strong > </ small >
91
91
openDialog ( redirect_url ) ;
92
92
} ,
93
93
onSuccess : function ( response ) {
94
+ document . getElementById ( 'result-json' ) . innerHTML += JSON . stringify ( response , null , 2 ) ;
94
95
console . log ( 'success' ) ;
95
96
console . log ( 'response:' , response ) ;
96
97
closeDialog ( ) ;
97
98
} ,
98
99
onFailure : function ( response ) {
100
+ document . getElementById ( 'result-json' ) . innerHTML += JSON . stringify ( response , null , 2 ) ;
99
101
console . log ( 'fail' ) ;
100
102
console . log ( 'response:' , response ) ;
101
103
closeDialog ( ) ;
102
104
alert ( response . status_message ) ;
103
105
$ ( 'button' ) . removeAttr ( "disabled" ) ;
104
106
} ,
105
107
onPending : function ( response ) {
108
+ document . getElementById ( 'result-json' ) . innerHTML += JSON . stringify ( response , null , 2 ) ;
106
109
console . log ( 'pending' ) ;
107
110
console . log ( 'response:' , response ) ;
108
111
closeDialog ( ) ;
158
161
// data: $("#token_id, #save_cc, #secure").serialize()
159
162
$ . ajax ( {
160
163
type : 'POST' ,
161
- url : '/coreapi' ,
164
+ url : '/coreapi-card-charge-ajax-handler ' ,
162
165
data : $ ( "#token_id, #save_cc, #secure" ) . serialize ( ) ,
163
166
success : function ( response ) {
164
167
console . log ( '3. response charge from backend:' , response ) ;
184
187
} ) ;
185
188
186
189
</ script >
190
+ < pre > < div id ="result-json "> Transaction result:< br > </ div > </ pre >
187
191
188
192
</ body >
189
193
</ html >
0 commit comments