-
Notifications
You must be signed in to change notification settings - Fork 1
/
CreatePreAuthPayment.js
46 lines (43 loc) · 1.03 KB
/
CreatePreAuthPayment.js
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
const TokenPay = require('../../dist');
const tokenPay = new TokenPay.Client({
apiKey: 'api-key',
secretKey: 'secret-key',
baseUrl: 'https://api-gateway.tokenpay.com.tr'
});
const request = {
price: 100.0,
paidPrice: 100.0,
walletPrice: 0.0,
installment: 1,
conversationId: '456d1297-908e-4bd6-a13b-4be31a6e47d5',
currency: TokenPay.Model.Currency.TRY,
paymentGroup: TokenPay.Model.PaymentGroup.ListingOrSubscription,
paymentPhase: TokenPay.Model.PaymentPhase.PreAuth,
card: {
cardHolderName: 'Haluk Demir',
cardNumber: '5258640000000001',
expireYear: '2044',
expireMonth: '07',
cvc: '000'
},
items: [
{
name: 'Item 1',
price: 30.0,
subMerchantId: 1
},
{
name: 'Item 2',
price: 50.0,
subMerchantId: 1
},
{
name: 'Item 3',
price: 20.0,
subMerchantId: 1
}
]
};
tokenPay.payment().createPayment(request)
.then(result => console.info('Pre auth payment successful', result))
.catch(err => console.error('Payment failed', err));