socinal / php-kore
A PHP library to integrate any PHP project with Socinal
Requires
- phpseclib/phpseclib: ~3.0
This package is not auto-updated.
Last update: 2025-08-27 19:44:19 UTC
README
Index
- Requirements
- Installation
- Class:
PIX
- Function:
newPixChargeInstantWithoutAmount
- Function:
newPixChargeInstantWithAmount
- Function:
newPixChargeInstantWithdrawWithAmount
- Function:
newPixChargeInstantWithdrawWithoutAmount
- Function:
newPixChargeInstantChangeWithAmount
- Function:
newPixChargeInstantChangeWithoutAmount
- Function:
newPixChargeStatic
- Class:
TED
- Domain
- Function:
newTransfer
- Class:
BankSlip
- BankSlip Domain
- Function BankSlip:
new
- Function BankSlip:
list
- Function BankSlip:
get
- Function BankSlip:
setPaid
- Function BankSlip:
setProtested
Requirements
- PHP 7.0 or greater
Installation
Run in your project directory this command to install with composer:
composer require socinal/php-kore
- Now everything is ready to use.
- If your project doesn't have "composer" installed, you can clone this repository and install by yourself on your project.
Class: PIX
Description: Default class to use Kore's Pix functions, used to generate charges, transfer values, etc.
How to Use:
$class = new \Socinal\PhpKore\Ring\Charges\Pix($priv, $drone, $environment);
Parameters:
Name | Type | Required | Description |
---|---|---|---|
$priv | string | Yes | Private key to sign request body |
$drone | string | Yes | Drone ID generated and provided by Socinal |
$environment | string | No | Environment to be used - Accept: PROD or DEV - Default: DEV |
Function: newPixChargeInstantWithoutAmount
Description: Generates a Instant Pix Charge without a predefined amount, or with a suggested amount. Payer will be able to edit amount at payment.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\Pix($priv, $drone, 'DEV');
$class->newPixChargeInstantWithoutAmount($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | An array with the data needed to generate the charge |
Data:
Key | Type | Required | Description | Example |
---|---|---|---|---|
expiration | int | No | Charge's expiration time in secods | 3600 |
payer_document | string | No | Payer document | "09432312054" |
payer_name | string | No, only if payer document was informed | Payer name | "Fulano da Silva" |
amount | int | No | Suggested amount | 10000 (R$100,00) |
pix_key | string | Yes | Recipient PIX key | "12345678911" |
txid | string | Yes | Transaction identifier | "098765432111" |
message | string | No | Optional message to payer | "Mensagem ao usuário" |
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Function: newPixChargeInstantWithAmount
Description: Generates a Instant Pix Charge with a predefined amount. Payer will not be able to edit amount at payment.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\Pix($priv, $drone, 'DEV');
$class->newPixChargeInstantWithAmount($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | An array with the data needed to generate the charge |
Data:
Key | Type | Required | Description | Example |
---|---|---|---|---|
expiration | int | No | Charge's expiration time in secods | 3600 |
payer_document | string | No | Payer document | "09432312054" |
payer_name | string | No, only if payer document was informed | Payer name | "Fulano da Silva" |
amount | int | Yes | Charge amount | 10000 (R$100,00) |
pix_key | string | Yes | Recipient PIX key | "12345678911" |
txid | string | Yes | Transaction identifier | "098765432111" |
message | string | No | Optional message to payer | "Mensagem ao usuário" |
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Function: newPixChargeInstantWithdrawWithAmount
Description: Generates a Instant Pix Charge for "Withdrawal" with a predefined amount. Payer will not be able to edit amount at payment.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\Pix($priv, $drone, 'DEV');
$class->newPixChargeInstantWithdrawWithAmount($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | An array with the data needed to generate the charge |
Data:
Key | Type | Required | Description | Example |
---|---|---|---|---|
expiration | int | No | Charge's expiration time in secods | 3600 |
payer_document | string | No | Payer document | "09432312054" |
payer_name | string | No, only if payer document was informed | Payer name | "Fulano da Silva" |
amount | int | Yes | Suggested amount | 10000 (R$100,00) |
txid | string | Yes | Transaction identifier | "098765432111" |
pix_key | string | Yes | Recipient PIX key | "12345678911" |
message | string | No | Optional message to payer | "Mensagem ao usuário" |
ispb | string | Yes | ISPB of the withdrawal service provider institution | "33233" |
agent_type | string | Yes | Indicates the type of agent to whom the service will be facilitated. Accept: "agtot", "agtec" or "agpss" | "agtot" |
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Function: newPixChargeInstantWithdrawWithoutAmount
Description: Generates a Instant Pix Charge for "Withdrawal" without a predefined amount, or with a suggested amount. Payer will be able to edit amount at payment.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\Pix($priv, $drone, 'DEV');
$class->newPixChargeInstantWithdrawWithoutAmount($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | An array with the data needed to generate the charge |
Data:
Key | Type | Required | Description | Example |
---|---|---|---|---|
expiration | int | Yes | Charge's expiration time in secods | 3600 |
payer_document | string | No | Payer document | "09432312054" |
payer_name | string | No, only if payer document was informed | Payer name | "Fulano da Silva" |
amount | int | No | Suggested amount | 10000 (R$100,00) |
txid | string | Yes | Transaction identifier | "098765432111" |
pix_key | string | Yes | Recipient PIX key | "12345678911" |
message | string | No | Optional message to payer | "Mensagem ao usuário" |
ispb | string | Yes | ISPB of the withdrawal service provider institution | "33233" |
agent_type | string | Yes | Indicates the type of agent to whom the service will be facilitated. Accept: "agtot", "agtec" or "agpss" | "agtot" |
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Function: newPixChargeInstantChangeWithAmount
Description: Generates a Instant Pix Charge for "Change" with a predefined amount. Payer will not be able to edit amount at payment.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\Pix($priv, $drone, 'DEV');
$class->newPixChargeInstantChangeWithAmount($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | An array with the data needed to generate the charge |
Data:
Key | Type | Required | Description | Example |
---|---|---|---|---|
expiration | int | Yes | Charge's expiration time in secods | 3600 |
payer_document | string | No | Payer document | "09432312054" |
payer_name | string | No, only if payer document was informed | Payer name | "Fulano da Silva" |
amount | int | No | Suggested amount | 10000 (R$100,00) |
txid | string | Yes | Transaction identifier | "098765432111" |
pix_key | string | Yes | Recipient PIX key | "12345678911" |
message | string | No | Optional message to payer | "Mensagem ao usuário" |
ispb | string | Yes | ISPB of the withdrawal service provider institution | "33233" |
agent_type | string | Yes | Indicates the type of agent to whom the service will be facilitated. Accept: "agtot" or "agtec" | "agtot" |
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Function: newPixChargeInstantChangeWithoutAmount
Description: Generates a Instant Pix Charge for "Change" without a predefined amount, or with a suggested amount. Payer will be able to edit amount at payment.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\Pix($priv, $drone, 'DEV');
$class->newPixChargeInstantChangeWithoutAmount($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | An array with the data needed to generate the charge |
Data:
Key | Type | Required | Description | Example |
---|---|---|---|---|
expiration | int | Yes | Charge's expiration time in secods | 3600 |
payer_document | string | No | Payer document | "09432312054" |
payer_name | string | No, only if payer document was informed | Payer name | "Fulano da Silva" |
amount | int | No | Suggested amount | 10000 (R$100,00) |
txid | string | Yes | Transaction identifier | "098765432111" |
pix_key | string | Yes | Recipient PIX key | "12345678911" |
message | string | No | Optional message to payer | "Mensagem ao usuário" |
ispb | string | Yes | ISPB of the withdrawal service provider institution | "33233" |
agent_type | string | Yes | Indicates the type of agent to whom the service will be facilitated. Accept: "agtot" or "agtec" | "agtot" |
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Function: newPixChargeStatic
Description: Generates a Static PIX Charge with or without a predefined amount.
Como usar:
$class = new \Socinal\PhpKore\Ring\Charges\Pix($priv, $drone, 'DEV');
$class->newPixChargeStatic($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | An array with the data needed to generate the charge |
Data:
Key | Type | Required | Description | Example |
---|---|---|---|---|
amount | int | No | Charge amount or suggested amount | 10000 (R$100,00) |
pix_key | string | Yes | Recipient PIX Key | "12345678911" |
txid | string | Yes | Transaction identifier | "098765432111" |
message | string | No | Optional message to payer | "Mensagem ao usuário" |
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Class: TED
Description: Default class to use Kore's TED functions, used to transfer values via TED operation.
How to Use:
$class = new \Socinal\PhpKore\Ring\Transactions\Ted($priv, $drone, $environment);
Parameters:
Name | Type | Required | Description |
---|---|---|---|
$priv | string | Yes | Private key to sign request body |
$drone | string | Yes | Drone ID generated and provided by Socinal |
$environment | string | No | Environment to be used - Accept: PROD or DEV - Default: DEV |
Domain:
Account Types:
Type | Description |
---|---|
ica | Individual checking account |
isa | Individual savings account |
jca | Joint checking account |
jsa | Joint savings account |
p2p | Account at the same institution |
Function: newTransfer
Description: Make a TED operation to transfer values to any account.
How to use:
$class = new \Socinal\PhpKore\Ring\Transactions\Ted($priv, $drone, 'DEV');
$class->newTransfer($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | An array with the data needed to generate the charge |
Data:
Key | Type | Required | Description | Example |
---|---|---|---|---|
recipient_bank_code | string | Yes | Recipient bank code in COMPE code pattern | "001" |
recipient_bank_branch | string | Yes | Recipient bank branch | "0001" |
recipient_bank_account | string | Yes | Recipient bank account | "1234123-1" |
recipient_bank_account_type | string | Yes | Recipient Bank Account type - Accept: ica,isa,jca,jsa or p2p - Domain | "ica" |
recipient_document | string | No | Recipient document | "12345678911" |
recipient_name | string | No | Recipient name | "Fulano de Tal" |
amount | int | Yes | Amount to transfer | 10000 (R$100,00) |
transaction_type | string | Yes | Transfer between accounts with different ownerships or same ownership - Accept: same or another | "same" |
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Class: BankSlip
Description: Default class to use Kore's Bank Slip functions, used to manage bank slip charges.
How to Use:
$class = new \Socinal\PhpKore\Ring\Charges\BankSlip($priv, $drone, $environment);
Parameters:
Name | Type | Required | Description |
---|---|---|---|
$priv | string | Yes | Private key to sign request body |
$drone | string | Yes | Drone ID generated and provided by Socinal |
$environment | string | No | Environment to be used - Accept: PROD or DEV - Default: DEV |
BankSlip Domain:
Fee Types:
Type | Description |
---|---|
percent | Monthly percentage |
amount | Amount per day (calendar days) |
none | No fee applied |
Fine Types:
Type | Description |
---|---|
percent | Percentage over total amount |
amount | Fixed amount |
Function BankSlip: new
Description: Generates a new Bank Slip.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\BankSlip($priv, $drone, 'DEV');
$class->new($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | An array with the data needed to generate the charge |
Data:
Key | Type | Required | Description | Example |
---|---|---|---|---|
due_date | date | Yes | Bank slip due date | 2025-03-15 |
limit_date | date | Yes | Bank slip limit date for payment | 2025-03-15 |
amount | integer | Yes | Bank slip amount | 1000 (R$10,00) |
account | string | Yes | Company's checking account | 12345-6 |
wallet | string | Yes | Bank wallet number | 001 |
company_use | string | Yes | Internal/Custom ID use | 1234567890 |
payer_name | string | Yes | Bank slip payer name | John Doe |
payer_document | string | Yes | Payer brazilian document | 123456789011 |
payer_street | string | No | Payer address line | Rua das Flores |
payer_complement | string | No | Payer address complement | Apt 123 |
payer_city | string | No | Payer city | Sao Paulo |
payer_state | string | No | Payer state - Accept only Brazilian states in UF standart | SP |
payer_number | string | No | Payer address number | 1230 |
payer_zipcode | string | No | Payer address zipcode | 11100010 |
reduction_amount | integer | No | Reduction amount | 0 |
fee_type | string | Yes | Type of fee applied to the charge - Accept: percent, amount or none - Domain | percent |
fee_amount | integer | No | Required if fee_type is not equal to percent or amount | 10 |
our_number | string | No | Bank slip number, if set as null, will generate a number automatically | 0009 |
fine_type | string | No | Type of fine applied to the charge - Accept: percent or amount - Domain | percent |
fine_amount | integer | No | Required if fine_type is set | 1000 |
fine_date | string | No | Required if fine_type is set - Date from which the fine is charged | 2025-03-18 |
discount1_date | date | No | Required if discount1_amount is set - First discount limit date | 2025-03-10 |
discount1_amount | integer | No | Required if discount1_date is set - First discount fixed amount | 1000 |
discount2_date | date | No | Required if discount2_amount is set - Second discount limit date | 2025-03-12 |
discount2_amount | integer | No | Required if discount2_date is set - Second discount fixed amount | 1000 |
discount3_date | date | No | Required if discount3_amount is set - Third discount limit date | 2025-03-13 |
discount3_amount | integer | No | Required if discount3_date is set - Third discount fixed amount | `1000 |
document_number | string | No | Recipient document number | 2187abvc |
description | string | No | Bank slip description | Invoice 4000 payment |
final_recipient_name | string | No | Final recipient name | Jane Doe LTDA |
final_recipient_document | string | No | Final recipient document | 1231213123 |
final_recipient_company_name | string | No | Final recipient company name | Jane Doe Foods |
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Function BankSlip: list
Description: List all generated bank slips.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\BankSlip($priv, $drone, 'DEV');
$class->list($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | An array with the data needed to generate the charge |
Data:
Key | Type | Required | Description | Example |
---|---|---|---|---|
due_date | date | No | Bank slip due date | 2025-03-15 |
digitable_line | string | No | Bank slip digitable line | 2312378182371261623... |
our_number | string | No | Bank slip our number | 123000123 |
status | string | No | Accept: pending,registered,canceled,paid,manual | paid |
page | string | No | Which page want to be seen | 1 |
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Function BankSlip: get
Description: Get a specific bank slip data.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\BankSlip($priv, $drone, 'DEV');
$class->get($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | Array with one or more Bank slip IDs to get data |
Example:
$data = ['id_bankslip_1','id_bankslip_2','id_bankslip_3']
$class = new \Socinal\PhpKore\Ring\Charges\BankSlip($priv, $drone, 'DEV');
$class->get($data);
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Function BankSlip: setPaid
Description: Set a specific bank slip as paid.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\BankSlip($priv, $drone, 'DEV');
$class->setPaid($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | Array with one or more Bank slip IDs to be marked as paid |
Example:
$data = ['id_bankslip_1','id_bankslip_2','id_bankslip_3']
$class = new \Socinal\PhpKore\Ring\Charges\BankSlip($priv, $drone, 'DEV');
$class->setPaid($data);
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.
Function BankSlip: setProtested
Description: Set a specific bank slip as protested.
How to use:
$class = new \Socinal\PhpKore\Ring\Charges\BankSlip($priv, $drone, 'DEV');
$class->setProtested($data);
Parameters:
Name | Type | Required | Default | Description |
---|---|---|---|---|
$data | array | Yes | — | Array with one or more Bank slip IDs to be marked as protested |
Example:
$data = ['id_bankslip_1','id_bankslip_2','id_bankslip_3']
$class = new \Socinal\PhpKore\Ring\Charges\BankSlip($priv, $drone, 'DEV');
$class->setProtested($data);
Return:
Type: array
Additional notes:
- Throws an
Exception
if any requested data is missing or has invalid value.