sawirricardo/midtrans-api

Interact with Midtrans API. Included Snap and its Core API.

Maintainers

Package info

github.com/sawirricardo/midtrans-api

pkg:composer/sawirricardo/midtrans-api

Fund package maintenance!

sawirricardo

Statistics

Installs: 16 135

Dependents: 2

Suggesters: 0

Stars: 4

Open Issues: 4

1.0.10 2022-12-08 02:01 UTC

README

Latest Version on Packagist Tests Total Downloads

Interact with Midtrans API. Included Snap and its Core API. If you use Laravel, you can use sawirricardo/laravel-midtrans package, which has more exciting features by default

Support us

Investing on this package is defintely a good move from you. You can support by donating to my wallet

Installation

You can install the package via composer:

composer require sawirricardo/midtrans-api

Usage

$midtransClient = \Sawirricardo\Midtrans\Midtrans::make(
    $serverKey,
    $clientKey,
    $isProduction,
    $is3ds,
    $isSanitized
);
$snapToken = $midtransClient->snap()->create(new \Sawirricardo\Midtrans\Dto\TransactionDto([
        'transaction_details' => [
            'order_id' => 'your-order-id',
            'gross_amount' => 10000,
        ]
    ]));

echo $snapToken->token;
echo $snapToken->redirect_url;

$transactionStatus = $midtransClient->payment()->getStatus('your-order-id-or-transaction-id');

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.