Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

157
Vistas
nodejs - how to handle payment

Background:
I am working on making nodejs function for payment using stripe.

My clients would have their own reward point, which can turn into cash dollar for payment

Current Design
Customer Table(mySQL)

-id: string(primary key)
-rewardPoints: int

Therefore I am working on 2 api seperately.

/transaction/debit-points 
   -this api is used to debit the reward point of clients when they want to turn it into cash dollar(debit the rewardPoints in Customer table)

/payment
   -this api will use stripe api to handle some credit card payment etc

Example
Let's say 100 reward points can turn into $1 cash dollar

Customer A is going to settle payment which is $200.
Customer A have 1000 reward points and want to turn all of it into cash dollar in this payment.

At first, I will use /transaction/debit-points to debit all 1000 reward points for the customer, and then use /payment to settle the payment.

1. /transaction/debit-points
2. /payment (run if /transaction/debit-points is successful)

If /payment fails, I want to reverse the effect of /transaction/debit-points, is it possible to do it in nodejs?

Or is there any better way?

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda