midtrans-client
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"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: |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30290
449