The PortPos class is designed to interact with the PortPos payment gateway API. It supports operations such as generating invoices, validating IPN (Instant Payment Notification), and retrieving invoice details. This class handles the communication with the PortPos API endpoints and simplifies the integration process.
"name" => "Product Title",// This title displyed over the payment page
"description" => "Product Descriptions",// This customer can see from payment page
],
"billing" => [
"customer" => [
"name" => "Jhon Doe",
"email" => "email@example.com",
"phone" => "8801710000000",
"address" => [
"street" => "Road 06, Gulshan1,",
"city" => "Dhaka",
"state" => "Dhaka",
"zipcode" => 1212,
"country" => "BGD"
]
]
],
"shipping" => [
"customer" => [
"name" => "Jhon Doe",
"email" => "email@example.com",
"phone" => "8801710000000",
"address" => [
"street" => "Road 06, Gulshan1,",
"city" => "Dhaka",
"state" => "Dhaka",
"zipcode" => 1212,
"country" => "BGD"
]
]
],
"customs" => [
["value_a" => "Test 1"],
['value_b' => "Test 2"]
]
]
Returns: The API response as an object on success, or false on failure. The response typically includes invoice details such as the invoice ID, status, and payment information.
IPN Validate
public function ipnValidate($invoiceId, $amount)
Validates an IPN (Instant Payment Notification) received from PortPos.
Parameters:
$invoiceId PortPos InvoiceId (string): Provide the PortPos Invoice Id
$amount (float): The PortPos Invoice amount
Returns: The API response as an object on success, or false on failure. This method is used to verify that the payment notification received is valid and matches the expected invoice details.
Retrieve Invoice
public function getInvoice($invoiceId)
Retrieves details of an existing invoice from the PortPos API.
Parameters:
$invoiceId (string): The unique identifier of the invoice to retrieve.
Returns: The API response as an object on success, or false on failure. The response includes comprehensive invoice details such as the amount, status, payer information, etc.
Set Mode
public function setMode($mode)
Sets the API mode for subsequent requests.
Parameters:
$mode (string): The mode of operation. Accepts 'sandbox' for testing purposes or 'production' for real transactions.
No return value.
PortPos Service Class
<?php
namespace App\Services;//modify the namespace accroding to your