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

  1. API Path: api/payment/saveCard
  2. Method: POST
  3. Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
  4. 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

  1. API Path: api/payment/getSaveCard
  2. Method: GET
  3. Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
  4. 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

  1. API Path: api/payment/deleteCard
  2. Method: DELETE
  3. Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
  4. 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

  1. API Path: api/payment/makePayment
  2. Method: POST
  3. Description: This is a protected route which gets the user details through JWT access token which is provided in the header.
  4. 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

results matching ""

    No results matching ""