Verify acceptance of payment terms
GET/truckers/payment/terms
Check if the carrier has accepted the terms and conditions to process payments with Stripe.
Typical Flow:
- The frontend calls this endpoint upon login or when accessing the payments section.
- If there is no acceptance (success=false), it shows the terms modal.
- The user must accept the terms to continue with the payment process.
Validations performed:
- User must be authenticated (valid JWT).
- User must belong to a registered company.
- Checks the
payment_settings.tos_acceptance.acceptedfield in the company.
Possible Responses:
- 200 OK:
success=true: Terms already accepted.success=false: Terms not accepted.
- 401 Unauthorized:
- Invalid JWT token.
- User does not belong to a registered company.
Usage Example:
// Frontend: Check terms when loading the payments section
const checkTerms = async () => {
try {
const response = await axios.get('/truckers/payment/terms', {
headers: { Authorization: `Bearer ${token}` }
});
if (!response.data.success) {
showTermsModal(); // Show terms modal
}
} catch (error) {
handleError(error);
}
};
Responses
- 200
- 401
Terms acceptance status
Unauthorized or terms not accepted. Possible causes:
- Invalid JWT token
- User does not belong to a registered company
- Terms not previously accepted