Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

midtrans-client

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

midtrans-client - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

2

package.json
{
"name": "midtrans-client",
"version": "1.0.2",
"version": "1.0.3",
"description": "Official Midtrans Payment API Client for Node JS",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -297,3 +297,4 @@ Midtrans Client - Node JS

"credit_card":{
"token_id": 'CREDIT_CARD_TOKEN' // change with your card token
"token_id": 'CREDIT_CARD_TOKEN', // change with your card token
"authentication": true
}

@@ -310,5 +311,13 @@ };

#### Credit Card 3DS Authentication
The credit card charge result may contains `redirect_url` for 3DS authentication. 3DS Authentication should be handled on Frontend please refer to [API docs](https://api-docs.midtrans.com/#card-features-3d-secure)
For full example on Credit Card 3DS transaction refer to:
- [Express App examples](/examples/expressApp) that implement Snap & Core Api
### 2.3 Handle HTTP Notification
> **IMPORTANT NOTE**: To update transaction status on your backend/database, **DO NOT** solely rely on frontend callbacks! For security reason to make sure the status is authentically coming from Midtrans, only update transaction status based on HTTP Notification or API Get Status.
Create separated web endpoint (notification url) to receive HTTP POST notification callback/webhook.

@@ -413,3 +422,18 @@ HTTP notification will be sent whenever transaction status is changed.

## 3. Examples
## 3. Handling Error / Exception
When using function that result in Midtrans API call e.g: `core.charge(...)` or `snap.createTransaction(...)`
there's a chance it may throw error (`MidtransError` object), the error object will contains below properties that can be used as information to your error handling logic:
```javascript
snap.createTransaction(parameter)
.then((res)=>{
})
.catch((e)=>{
e.message // basic error message string
e.httpStatusCode // HTTP status code e.g: 400, 401, etc.
e.ApiResponse // JSON of the API response
e.rawHttpClientData // raw Axios response object
})
```
## 4. Examples
Examples are available on [/examples](/examples) folder.

@@ -416,0 +440,0 @@ There are:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc