Skip to main content

Accept payment terms and conditions

POST 

/truckers/payment/terms

Records the acceptance of terms and conditions for processing payments with Stripe.

Actions performed:

  • Records timestamp and IP of acceptance
  • Creates Stripe account for the company if it doesn't exist (using toolsStripeCia.updateOnStripe)
  • Updates payment_settings.tos_acceptance in the company
  • Enables Stripe payments if everything is successful

Validations:

  • User must be authenticated (valid JWT)
  • User must belong to a valid company
  • The company must exist in the database

Technical flow:

  1. Gets user and company data
  2. Prepares acceptance data (timestamp, IP)
  3. If no Stripe account exists, creates one
  4. Updates terms accepted record
  5. Saves changes to the company

Possible responses:

  • 200 OK: Terms accepted successfully
  • 401 Unauthorized:
    • Invalid JWT token
    • User doesn't belong to valid company
    • Error creating Stripe account

Request example:

// Frontend: Send terms acceptance
const acceptTerms = async () => {
try {
const response = await axios.post(
'/truckers/payment/terms',
{},
{ headers: { Authorization: `Bearer ${token}` } }
);

if (response.data.success) {
proceedToPayments(); // Continue to payments section
}
} catch (error) {
handleError(error);
}
};

Important notes:

  • This endpoint is required to enable Stripe payments
  • Can only be called once (acceptance is permanent)
  • Records server IP, not client IP

Responses

Terms successfully accepted