-
Notifications
You must be signed in to change notification settings - Fork 1
/
NPS_jquery.html
72 lines (39 loc) · 1.56 KB
/
NPS_jquery.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript">
jQuery.getScript("https://sandbox.nps.com.ar/sdk/v1/NPS.js",function(){
/**
* Configure Your Client Session
*
* You should configure your client session to be able to start to use NPS.js to identify your site while communicating with NPS.
* To do this, use the call setClientSession. Remember to replace the client session call on sandbox with the production domain when you are ready to create real charges.
*
* You must obtain your client session by calling from server-side the webservice method “CreateClientSession”
*/
NPS.setClientSession("YOUR_CLIENT_SESSION");
// NPS Merchant ID
NPS.setMerchantId("YOUR_MERCHANT_ID");
// Device Fingerprint Must Be Created Or Not
NPS.setUseDeviceFingerprint(false);
var npsSuccessResponseHandler;
npsSuccessResponseHandler = function(paymentMethodToken) {
alert(paymentMethodToken.id);
};
var npsErrorResponseHandler;
npsErrorResponseHandler = function(response) {
console.log(response);
};
PaymentMethodTokenParams = {
card: {
// holder_name: 'John Smith',
number: '4507990000000010',
exp_month: '01',
exp_year: '2019',
// exp_date: '1901', // you can choose exp_date over exp_month+exp_year to send expiry date in one field only
security_code: '123',
}
};
NPS.paymentMethodToken.create(PaymentMethodTokenParams, npsSuccessResponseHandler, npsErrorResponseHandler);
});
// });
// });
</script>