-
Notifications
You must be signed in to change notification settings - Fork 62
/
create.ts
38 lines (33 loc) · 1001 Bytes
/
create.ts
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
/**
* @docs https://docs.mollie.com/reference/v2/refunds-api/create-refund
* @docs https://docs.mollie.com/reference/v2/orders-api/create-order-refund
*/
import createMollieClient, { Refund } from '@mollie/api-client';
const mollieClient = createMollieClient({ apiKey: 'test_dHar4XY7LxsDOtmnkVtjNVWXLSlXsM' });
(async () => {
try {
// Create payment refund
const paymentRefund: Refund = await mollieClient.payments_refunds.create({
paymentId: 'tr_WDqYK6vllg',
amount: {
value: '5.95',
currency: 'EUR',
},
});
console.log(paymentRefund);
// Create order refund
const orderRefund: Refund = await mollieClient.orders_refunds.create({
orderId: 'ord_stTC2WHAuS',
lines: [
{
id: 'odl_dgtxyl',
quantity: 1,
},
],
description: 'Required quantity not in stock, refunding one photo book.',
});
console.log(orderRefund);
} catch (error) {
console.warn(error);
}
})();