Skip to content

ngygbr/mpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mock Payment Processor


Mock Payment Processor written in GO for simulate the lifecycle of a transaction.

Usage


In the root directory:
go run main.go

In the nextjs directory:
npm install
npm run dev

Run locally:
Use the localhost based THE_URL variable in nextjs/pages/index.tsx

API Docs


Healthcheck

Informs about the API's condition

Request Method: GET
Request URL: /healthcheck

Login

Retrieve the access token

Request Method: GET
Request URL: /login

Get Transaction

Retrieve a transaction by ID

Request Method: GET
Request URL: /api/transaction/{id}

Delete Transaction

Delete a transaction by ID

Request Method: DELETE
Request URL: /api/transaction/{id}

Settle Transaction

Set the transaction status to settled

Request Method: POST
Request URL: /api/transaction/{id}/settle

Reject Transaction

Set the transaction status to rejected

Request Method: POST
Request URL: /api/transaction/{id}/reject

Get All Transaction

Retrieve all transactions

Request Method: GET
Request URL: /api/transactions

Delete All Transaction

Delete all transactions

Request Method: DELETE
Request URL: /api/transactions

Credit Card Transaction

Create a credit card transaction

Request Method: POST
Request URL: /api/transaction/creditcard

Plugin Type Description Required
amount uint64 Amount true
payment_method object Method of the payment true
billing_address object Address of costumer true

Example request

{
  "amount": int,
  "payment_method": {
    "credit_card": {
      "card_number": string,
      "holder_name": string,
      "exp_date": string,
      "cvc": string
    }
  },
  "billing_address": {
    "first_name": string,
    "last_name": string,
    "postal_code": string,
    "city": string,
    "address_line_1": string,
    "email": string,
    "phone": string
  }
}
ACH Transaction

Create an ach transaction

Request Method: POST
Request URL: /api/transaction/ach

Plugin Type Description Required
amount uint64 Amount true
payment_method object Method of the payment true
billing_address object Address of costumer true

Example request

{
  "amount": int,
  "payment_method": {
    "ach": {
      "account_type": string,
      "account_number": string,
      "routing_number": string,
      "sec_code": string
    }
  },
  "billing_address": {
    "first_name": string,
    "last_name": string,
    "postal_code": string,
    "city": string,
    "address_line_1": string,
    "email": string,
    "phone": string
  }
}
Apple Pay Transaction

Create an applepay transaction

Request Method: POST
Request URL: /api/transaction/applepay

Plugin Type Description Required
amount uint64 Amount true
payment_method object Method of the payment true
billing_address object Address of costumer true

Example request

{
  "amount": int,
  "payment_method": {
    "apple_pay": {
      "payment_token": {
        "identifier": string,
        "payment_data": string
      }
    }
  },
  "billing_address": {
    "first_name": string,
    "last_name": string,
    "postal_code": string,
    "city": string,
    "address_line_1": string,
    "email": string,
    "phone": string
  }
}
Google Pay Transaction

Create an googlepay transaction

Request Method: POST
Request URL: /api/transaction/googlepay

Plugin Type Description Required
amount uint64 Amount true
payment_method object Method of the payment true
billing_address object Address of costumer true

Example request

{
  "amount": int,
  "payment_method": {
    "google_pay": {
      "encrypted_payment": {
        "payment_id": string,
        "payment_data": string
      }
    }
  },
  "billing_address": {
    "first_name": string,
    "last_name": string,
    "postal_code": string,
    "city": string,
    "address_line_1": string,
    "email": string,
    "phone": string
  }
}

Status codes

Message Code
Success 100
Limit exceeded 201
Card blocked 202
Daily limit exceeded 203
Fraud detected 204
Error occured 206

Special Cards

Error Card Number
Limit exceeded 4455444455551111
Card blocked 0000000000000000
Daily limit exceeded 7755444455551111
Fraud detected 8888888888888888

Releases

No releases published

Packages

No packages published

Languages