summaryrefslogtreecommitdiff
path: root/src/pages/api/shop/midtrans-payment.js
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-03-28 16:32:45 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-03-28 16:32:45 +0700
commitf15a7f8a4387d215abd1051ee520adca8944fa05 (patch)
treea51a50ba27a53ff03da38c388e36a17149ad60fa /src/pages/api/shop/midtrans-payment.js
parent8ca9069251873e87338f1c7f581b418bebb11e9a (diff)
checkout, quotation
Diffstat (limited to 'src/pages/api/shop/midtrans-payment.js')
-rw-r--r--src/pages/api/shop/midtrans-payment.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/pages/api/shop/midtrans-payment.js b/src/pages/api/shop/midtrans-payment.js
index be676d38..1772e9e0 100644
--- a/src/pages/api/shop/midtrans-payment.js
+++ b/src/pages/api/shop/midtrans-payment.js
@@ -31,6 +31,20 @@ export default async function handler(req, res) {
serverKey: process.env.MIDTRANS_SERVER_KEY
})
+ let itemDetails = transaction.products.map((product) => ({
+ id: product.code,
+ price: Math.round(product.price.priceDiscount),
+ quantity: product.quantity,
+ name: product.name?.substring(0, 50)
+ }))
+
+ itemDetails.push({
+ id: 'TAX',
+ price: transaction.amountTax,
+ quantity: 1,
+ name: 'PPN 11%'
+ })
+
const parameter = {
transaction_details: {
order_id: transaction.name?.replaceAll('/', '-'),
@@ -39,12 +53,6 @@ export default async function handler(req, res) {
credit_card: {
secure: true
},
- item_details: transaction.products.map((product) => ({
- id: product.code,
- price: Math.round(product.price.priceDiscount),
- quantity: product.quantity,
- name: product.name?.substring(0, 50)
- })),
customer_details: {
first_name: transaction.address.customer.name,
email: transaction.address.customer.email || '',