Skip to content
Shabab Haider Siddique edited this page May 25, 2021 · 2 revisions

VoidPayment

class VoidPayment extends ResultObject

To void an authorized payment you use a VoidPayment object. You can retrieve individual void for a specific Payment. VoidPayment are identified by a UUID.

Properties

Name Modifier & Type Description
id private string Unique ID of payment
type private string Can be either "authorization" or "purchase"
created private string Payment creation time as defined in RFC 3339 Section 5.6. UTC timezone.
live private boolean True if payment made in live mode. False if test mode.
parentId private string ID of parent payment
status private string Can be either "approved" or "declined"
error private string Returned only if status is declined. Provide human readable information
orderId private string Must be between 2 and 50 character. Provided by merchant.
description private string Maximum 255 characters

Methods

Name Return Type Description
getId() public string Returns payment ID
getType() public string Gets type of payment
getCreated() public string Gets created date of payment
getLive() public boolean Return true if payment is live. False if test
getParentId() public string Get ID of parent Payment
getStatus() public string Return status of payment. (Can be either "approved" or "declined" )
getError() public string Human readable error if any
getOrderId() public string
getDescription() public string
isApproved() public boolean Return true if payment approved
isDeclined() public boolean Return true if payment rejected

Example

Creating VoidPayment

<?php

use Cardinity\Client;
use Cardinity\Method\VoidPayment;

$client = Client::create([
    'consumerKey' => 'YOUR_CONSUMER_KEY',
    'consumerSecret' => 'YOUR_CONSUMER_SECRET',
]);

$method = new VoidPayment\Create(
    $payment->getId(),
    'my description'
);
/** @type Cardinity\Method\VoidPayment\VoidPayment */
$result = $client->call($method);

?>

Get a existing VoidPayment

<?php

use Cardinity\Client;
use Cardinity\Method\VoidPayment;

$client = Client::create([
    'consumerKey' => 'YOUR_CONSUMER_KEY',
    'consumerSecret' => 'YOUR_CONSUMER_SECRET',
]);

$method = new VoidPayment\Get(
    $payment->getId(),
    $void->getId()
);
/** @type Cardinity\Method\VoidPayment\VoidPayment */
$void = $client->call($method);

?>

Get all VoidPayment

<?php

use Cardinity\Client;
use Cardinity\Method\VoidPayment;

$client = Client::create([
    'consumerKey' => 'YOUR_CONSUMER_KEY',
    'consumerSecret' => 'YOUR_CONSUMER_SECRET',
]);

$method = new VoidPayment\GetAll(
    $payment->getId()
);
$result = $client->call($method);
/** @type Cardinity\Method\VoidPayment\VoidPayment */
$void = $result[0];

?>

Clone this wiki locally