Skip to content

Checkout, Billing and Reports API Guidelines

Documentation for API Helper Functions

Checkout Payment API (checkoutPayment):

  • Purpose: Initiates a payment transaction.
  • Parameters: Card data, billing details, amount, and user ID.
  • Response: Returns data containing RedirectData and billingDetailsId. RedirectData is used for completing the transaction in an iframe as required by First Atlantic Commerce’s API.
  • Error Handling: Returns error object on failure.

Update Payment After Checkout (updatePaymentAfterCheckout):

  • Purpose: Updates the payment status after checkout.
  • Parameters: User ID, token, payment ID, transaction ID, and billing ID.
  • Response: Returns an updated payment object.
  • Error Handling: Returns error object on failure.

Billing Details APIs:

  • createBillingDetails:
    • Creates new billing details for a user.
    • Requires user object and billing details.
    • Returns the created billing details.
  • getAllBillingDetails:
    • Retrieves all billing details for a user.
    • Requires user object for authorization.
    • Returns an array of billing details.

Report API (getReports):

  • Purpose: Fetches various reports data.
  • Response: Returns an object containing total users, count of recurring payments, total completed amount, and pending payments.
  • Error Handling: Returns error object on failure.

General Notes:

  • All functions use Axios for HTTP requests and handle authorization via token headers.
  • The typical response structure is { message: "Descriptive message", data: requestedData }, except for the checkout API which has specific fields for redirect and billing details ID.
  • Error handling is consistent across functions, returning error details on API call failures.