Simple SDK package for Atome Payment API. Use as standalone or with Laravel

0.0.2 2024-01-05 21:52 UTC

This package is auto-updated.

Last update: 2024-11-06 00:02:28 UTC


README

Latest Version on Packagist Total Downloads GitHub Actions

SDK for Atome payment gateway. Can use as standalone package or use with laraditz/bayar laravel package.

Installation

composer require gerbang-bayar/atome

Available Request Methods

Below are all methods available under this package.

  • checkConfiguration(string $countryCode, ?string $callbackUrl = null): Response
  • createPayment(array $args): Response
  • getPayment(string $referenceId): Response
  • cancelPayment(string $referenceId): Response
  • refundPayment(string $referenceId): Response

Usage

Create Payment

To create payment and get the payment URL to be redirected to.

use GerbangBayar\Atome\Atome;


// Instantiate connector
$atome = new Atome(username: $username, password: $password, sandbox: false);

$response = $atome->createPayment(
    referenceId: 'someuniquereferenceid',
    currency: 'MYR',
    amount: 1000, // in cents
    callbackUrl: 'https://callbackurl.here',
    paymentResultUrl: 'https:/returnurl.here',
    customerInfo: [
        'name' => 'Raditz Farhan',
        'phone' => '6012345678',
        'email' => 'raditzfarhan@gmail.com'
    ],
    shippingAddress: [
        'countryCode' => 'MY',
        'lines' => [
            'No 1, Taman ABC',
            'Jalan DCEF'
        ],
        'postCode' => '12345'
    ],
    items: [
        [
            'itemId' => 'ITEMSKU',
            'name' => 'Item 1',
            'quantity' => 1,
            'price' => 1000,
        ]
    ]
);

See the documentation for more details.

Use with Laravel

You can use this package with laraditz/bayar as a provider.

Add configuration to config/services.php

'atome' => [
    'username' => env('ATOME_USERNAME'),
    'password' => env('ATOME_PASSWORD'),
    'sandbox' => env('ATOME_SANDBOX', false),
],

Add provider event listener

protected $listen = [
    \Laraditz\Bayar\Events\AtomeCallbackReceived::class => [
        // register your listener here
    ],
];

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email raditzfarhan@gmail.com instead of using the issue tracker.

Credits

License

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