Paystack PHP SDK

Transaction
in package
implements ResourceInterface Uses ResourcePath

Interfaces, Classes, Traits and Enums

ResourceInterface

Table of Contents

$callbackUrl  : mixed
$data  : mixed
$httpClient  : mixed
__construct()  : mixed
addMetadata()  : $this
Add metadata to the request data
getAmount()  : int
getEmail()  : string
getReference()  : null
Returns the transaction code/id used
initialize()  : stdClass
This method must be called to request for payment. which return an initial transaction obj
isSuccessful()  : bool
Like verify(), but it only checks to see if a transactions is successful returning boolean
list()  : stdClass
Get the list of all transactions
setAmount()  : $this
Set transaction amount in kobo(NGN) or pesewas(GHS)
setCallbackUrl()  : $this
To set callback URL, can be used to override callback URL set on paystack dashboard
setEmail()  : $this
setPlan()  : $this
Ignore setting amount when setting plan and vice versa. Plan takes precedence
setReference()  : Transaction
Sets the transaction reference code/id
verify()  : StdClass
Is used to Check if a transaction is successful and return the transaction object data

Properties

Methods

addMetadata()

Add metadata to the request data

public addMetadata([array<string|int, mixed> $metadata = [] ]) : $this

Method can be called chained more than once. Last call with repeated property overwrites the former

Parameters
$metadata : array<string|int, mixed> = []
Return values
$this

getAmount()

public getAmount() : int
Return values
int

getEmail()

public getEmail() : string
Return values
string

getReference()

Returns the transaction code/id used

public getReference([bool $afterInitialize = false ]) : null
Parameters
$afterInitialize : bool = false
Return values
null

isSuccessful()

Like verify(), but it only checks to see if a transactions is successful returning boolean

public isSuccessful(string $reference) : bool
Parameters
$reference : string
Tags
throws
GuzzleException
throws
JsonException
Return values
bool

list()

Get the list of all transactions

public list([int $numberOfRecords = 50 ][, int $page = 1 ][, array<string|int, mixed> $otherOptions = [] ]) : stdClass
Parameters
$numberOfRecords : int = 50

number of record per page

$page : int = 1

page number

$otherOptions : array<string|int, mixed> = []
Tags
link
https://paystack.com/docs/api/#transaction-list
throws
GuzzleException
throws
JsonException
Return values
stdClass

setAmount()

Set transaction amount in kobo(NGN) or pesewas(GHS)

public setAmount(int $amount) : $this

NOTE: Setting plan overwrites your defined amount

Parameters
$amount : int
Return values
$this

setCallbackUrl()

To set callback URL, can be used to override callback URL set on paystack dashboard

public setCallbackUrl(string $callbackUrl) : $this
Parameters
$callbackUrl : string
Return values
$this

setEmail()

public setEmail(string $email) : $this
Parameters
$email : string
Return values
$this

setPlan()

Ignore setting amount when setting plan and vice versa. Plan takes precedence

public setPlan(string $plan) : $this
Parameters
$plan : string
Return values
$this

setReference()

Sets the transaction reference code/id

public setReference(string $reference) : Transaction
Parameters
$reference : string
Return values
Transaction

Search results