Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

160
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!