Routes - Payment
File Name : payment.js
File Path : /server/routes/payment.js
Payment route contains saveCard, getSaveCard, makePayment and deleteCard . These functionalities are included in Payment Controller.
Save Card Route
- API Path: api/payment/saveCard
- Method: POST
- Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
Parameters:
- Name: req
- Type: Object
Name Type cardName string cardNumber string cardExpiry string cardCvv string - Name: jwtAccessToken
- In: Header
- Type: String
- Description: JWT access token is used to check the authenticity of the user.
Name: res
- Type: Object
- Description: res is nothing but the response object in which you can save the Card details of the user in stripe and get the stripeCusId and saved it to the database.
Response:
- Http Code: 200
- Name: returnObj
- Type: Object
Name Type success boolean message string data array
Get Save Card Route
- API Path: api/payment/getSaveCard
- Method: GET
- Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
Parameters:
- Name: req
Type: Object
Name: jwtAccessToken
- In: Header
- Type: String
- Description: JWT access token is used to check the authenticity of the user.
Name: res
- Type: Object
- Description: res is nothing but the response object which gets you the save card details to the user.
Response:
- Http Code: 200
- Name: returnObj
- Type: Object
Name Type success boolean message string data array
Delete Card Route
- API Path: api/payment/deleteCard
- Method: DELETE
- Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
Parameters:
- Name: req
- Type: Object
Name Type cardId string - Name: jwtAccessToken
- In: Header
- Type: String
- Description: JWT access token is used to check the authenticity of the user.
Name: res
- Type: Object
- Description: res is nothing but the response object which you gets the all card details except deleted card to the user.
Response:
- Http Code: 200
- Name: returnObj
- Type: Object
Name Type success boolean message string data array
Payment and Place Order Route
- API Path: api/payment/makePayment
- Method: POST
- Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
Parameters:
- Name: req
- Type: Object
Name Type cardId string cart array totalAmount number deliveryAddress string deliveryGpsLoc array - Name: jwtAccessToken
- In: Header
- Type: String
- Description: JWT access token is used to check the authenticity of the user.
Name: res
- Type: Object
- Description: res is nothing but the response object in which get the current place order to the user.
Response:
- Http Code: 200
- Name: returnObj
- Type: Object
Name Type success boolean message string data array