Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Plan Subscription - Paystack #695

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from

Conversation

ObodoakorDavid
Copy link
Contributor

What does the PR do?

This PR adds two endpoint for organisations to be able to pay for subscriptions with paystack.

How should this be manually tested?
Send a POST request to /api/v1/payments/paystack with the request body below.

Request Body


{
  "organization_id": "ad77a415-4f1c-48d7-8702-85a625c5b594",
   "plan_id": "2952977c-0686-4add-b2d1-3ee629509a74",
   "full_name": "string",
   "billing_option": "yearly",
   "redirect_url": "http://boilerplate.com/setting"
}


200 Successful Response:


{
    "status_code": 200,
    "message": "Payment initiated successfully",
    "status": "success",
    "data": {
        "payment_url": "https://checkout.paystack.com/me0ernbggquuw12"
    }
}

Once a payment is initiated, the user can be redirected to the paystack checkout screen to complete payment which would send a request to the server with the payment reference to be verified. Upon successful payment and verification of the payment reference, the server redirects to the provided redirect_url with a param of status which would be either success or failed depending on the payment status.

Error Responses:

400 Bad Request:

{
    "message": [
        "Invalid UUID for plan_id"
    ],
    "error": "Bad Request",
    "status_code": 400
}

401 Unauthorized:

{
    "message": "Your IP Is unauthorized to make this call",
    "error": "Unauthorized",
    "status_code": 401
}

500 Internal Server Error:

{
    "message": "'An error occurred while initiating the payment'",
    "error": "Bad Request",
    "status_code": 400
}

Checklist of what i did

  • Implemented an endpoint to initiate payment via paystack
  • Implemented an endpoint to verify payment.
  • Added unit tests for the payment service.

Reference Issue on Linear
FEAT Plan Subscription - PAYSTACK

.env.example Outdated Show resolved Hide resolved
CFCIfe
CFCIfe previously approved these changes Aug 8, 2024
CFCIfe
CFCIfe previously approved these changes Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants