This repository has been archived by the owner on Jan 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Create Transaction
Samuel Fontebasso edited this page Sep 24, 2017
·
3 revisions
Create a transaction to start the payment request process with the product/service, value, quantity, etc.
This transaction will initially have the status of new
. This transaction will only have its status changed when the integrator sets its form of payment.
After you create the charge, charge_id
will be returned, which is the unique identifier of the transaction and will be used to associate with the form of payment, also known as transactionReferenceCode
.
To retrieve the transaction reference code we used the getTransactionReferenceCode()
method of object response.
- authorize
Returns: Omnipay\Gerencianet\Message\Response
Hierarchical structure of parameters that can be used:
├── items
│ ├── name
│ ├── quantity
│ └── price
├── shippings
│ ├── name
│ └── value
│ └── payee_code
└── metadata
└── custom_id
└── notification_url
Parameters that can be used to create a transaction
Attribute | Description | Required | Type |
---|---|---|---|
items | Item being sold. The same transaction can have unlimited items. | Yes | Array List |
shippings | Determines the shipping value(s) of a transaction. The same transaction can have unlimited shipping values. | No | Array List |
metadata | Defines transaction-specific data. | No | Array |
$gateway = Omnipay::create("Gerencianet");
$gateway->initialize(array(
'clientId' => '{YOUR-CLIENT-ID}',
'secret' => '{YOUR-SECRET}',
'testMode' => true
));
$options = array(
'items' => array(
array(
'name' => 'Item 1',
'quantity' => 1,
'price' => 10
),
array(
'name' => 'Item 2',
'quantity' => 2,
'price' => 20
),
),
);
$response = $gateway->authorize($options)->send();
$charge_id = $response->getTransactionReference();