midsonlajeanty/php-natcash-sdk

Minimum SDK to process payment with Natcom Natcash Payment Gateway

Maintainers

Package info

github.com/midsonlajeanty/php-natcash-sdk

pkg:composer/midsonlajeanty/php-natcash-sdk

Statistics

Installs: 5

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-02-04 03:03 UTC

This package is auto-updated.

Last update: 2026-04-13 23:41:41 UTC


README

Natcash Logo

Build Status Total Downloads Latest Stable Version License

Minimum SDK to process payment with Natcom Natcash Payment Gateway

Features

  • Create Payment Transaction and get gateway URL (Natcash Checkout)
  • Get Transaction Details by Order ID

Getting started

composer require midsonlajeanty/php-natcash-sdk 

Usage

Init Payment and get Payment URL (Natcash Checkout)

use Mds\Natcash\Config;
use Mds\Natcash\Natcash;
use Mds\Natcash\PaymentRequest;

// Natcash Merchant Credentials
$configArray = [
    'privateKey' => PRIVATE_KEY,
    'partnerCode' => PARTNER_CODE,
    'functionCode' => FUNCTION_CODE,
    'username' => USERNAME,
    'password' => PASSWORD,
    'callbackUrl' => CALLBACK_URL,
];

$config = Config::fromArray($configArray);

// Payment Request
$paymentArray = [
    'orderNumber' => 'ORDER-001',
    'amount' => 10,
];
$payment = PaymentRequest::fromArray($paymentArray);

// Init SDK with config
$natcash = new Natcash($config, DEBUG);

// Make Payment with payment request and Amount
$response = $natcash->makePayment($payment);

// Get Payment URL  (Natcash Checkout)
$response->getRedirect();

Get Transaction Details by Order ID

use Mds\Natcash\Config;
use Mds\Natcash\Natcash;
use Mds\Natcash\PaymentRequest;

// Natcash Merchant Credentials
$configArray = [
    'privateKey' => PRIVATE_KEY,
    'partnerCode' => PARTNER_CODE,
    'functionCode' => FUNCTION_CODE,
    'username' => USERNAME,
    'password' => PASSWORD,
    'callbackUrl' => CALLBACK_URL,
];

$config = Config::fromArray($configArray);

// Init SDK with config
$natcash = new Natcash($config, DEBUG);

// Verify Webhook Payload Signature
$isValid = $natcash->verifyPayloadSignature('WEBHOOK_ORDER_NUMBER', 'WEBHOOK_CODE', 'WEBHOOK_SIGNATURE');

if ($isValid) {
    print_r("Signature is valid." . PHP_EOL . PHP_EOL);

    // Get Payment Details with OrderId provided by your app.
    $details = $natcash->getTransactionDetailsByOrderId($orderNumber);

} else {
    print_r("Signature is invalid." . PHP_EOL);
}

Contributing

You have a lot of options to contribute to this project ! You can :