diff options
Diffstat (limited to 'src/pages/api/shop/midtrans-payment.js')
| -rw-r--r-- | src/pages/api/shop/midtrans-payment.js | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/pages/api/shop/midtrans-payment.js b/src/pages/api/shop/midtrans-payment.js index 1772e9e0..12aaa51f 100644 --- a/src/pages/api/shop/midtrans-payment.js +++ b/src/pages/api/shop/midtrans-payment.js @@ -22,6 +22,7 @@ export default async function handler(req, res) { {}, { Token: auth.token } ) + if (!transaction?.id) { return res.status(400).json({ error: 'No Data' }) } @@ -48,7 +49,7 @@ export default async function handler(req, res) { const parameter = { transaction_details: { order_id: transaction.name?.replaceAll('/', '-'), - gross_amount: transaction.amountTotal + gross_amount: Math.floor(transaction.amountTotal) }, credit_card: { secure: true @@ -56,17 +57,7 @@ export default async function handler(req, res) { customer_details: { first_name: transaction.address.customer.name, email: transaction.address.customer.email || '', - phone: transaction.address.customer.phone || '', - billing_address: { - first_name: transaction.address.invoice.name, - email: transaction.address.invoice.email || '', - phone: transaction.address.invoice.phone || '' - }, - shipping_address: { - first_name: transaction.address.shipping.name, - email: transaction.address.shipping.email || '', - phone: transaction.address.shipping.phone || '' - } + phone: transaction.address.customer.phone || '' } } |
