socinal/php-kore

A PHP library to integrate any PHP project with Socinal

v0.0.2 2025-08-27 19:42 UTC

This package is not auto-updated.

Last update: 2025-08-27 19:44:19 UTC


README

Index

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:

NameTypeRequiredDescription
$privstringYesPrivate key to sign request body
$dronestringYesDrone ID generated and provided by Socinal
$environmentstringNoEnvironment 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:

NameTypeRequiredDefaultDescription
$dataarrayYesAn array with the data needed to generate the charge

Data:

KeyTypeRequiredDescriptionExample
expirationintNoCharge's expiration time in secods3600
payer_documentstringNoPayer document"09432312054"
payer_namestringNo, only if payer document was informedPayer name"Fulano da Silva"
amountintNoSuggested amount10000 (R$100,00)
pix_keystringYesRecipient PIX key"12345678911"
txidstringYesTransaction identifier"098765432111"
messagestringNoOptional 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:

NameTypeRequiredDefaultDescription
$dataarrayYesAn array with the data needed to generate the charge

Data:

KeyTypeRequiredDescriptionExample
expirationintNoCharge's expiration time in secods3600
payer_documentstringNoPayer document"09432312054"
payer_namestringNo, only if payer document was informedPayer name"Fulano da Silva"
amountintYesCharge amount10000 (R$100,00)
pix_keystringYesRecipient PIX key"12345678911"
txidstringYesTransaction identifier"098765432111"
messagestringNoOptional 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:

NameTypeRequiredDefaultDescription
$dataarrayYesAn array with the data needed to generate the charge

Data:

KeyTypeRequiredDescriptionExample
expirationintNoCharge's expiration time in secods3600
payer_documentstringNoPayer document"09432312054"
payer_namestringNo, only if payer document was informedPayer name"Fulano da Silva"
amountintYesSuggested amount10000 (R$100,00)
txidstringYesTransaction identifier"098765432111"
pix_keystringYesRecipient PIX key"12345678911"
messagestringNoOptional message to payer"Mensagem ao usuário"
ispbstringYesISPB of the withdrawal service provider institution"33233"
agent_typestringYesIndicates 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:

NameTypeRequiredDefaultDescription
$dataarrayYesAn array with the data needed to generate the charge

Data:

KeyTypeRequiredDescriptionExample
expirationintYesCharge's expiration time in secods3600
payer_documentstringNoPayer document"09432312054"
payer_namestringNo, only if payer document was informedPayer name"Fulano da Silva"
amountintNoSuggested amount10000 (R$100,00)
txidstringYesTransaction identifier"098765432111"
pix_keystringYesRecipient PIX key"12345678911"
messagestringNoOptional message to payer"Mensagem ao usuário"
ispbstringYesISPB of the withdrawal service provider institution"33233"
agent_typestringYesIndicates 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:

NameTypeRequiredDefaultDescription
$dataarrayYesAn array with the data needed to generate the charge

Data:

KeyTypeRequiredDescriptionExample
expirationintYesCharge's expiration time in secods3600
payer_documentstringNoPayer document"09432312054"
payer_namestringNo, only if payer document was informedPayer name"Fulano da Silva"
amountintNoSuggested amount10000 (R$100,00)
txidstringYesTransaction identifier"098765432111"
pix_keystringYesRecipient PIX key"12345678911"
messagestringNoOptional message to payer"Mensagem ao usuário"
ispbstringYesISPB of the withdrawal service provider institution"33233"
agent_typestringYesIndicates 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:

NameTypeRequiredDefaultDescription
$dataarrayYesAn array with the data needed to generate the charge

Data:

KeyTypeRequiredDescriptionExample
expirationintYesCharge's expiration time in secods3600
payer_documentstringNoPayer document"09432312054"
payer_namestringNo, only if payer document was informedPayer name"Fulano da Silva"
amountintNoSuggested amount10000 (R$100,00)
txidstringYesTransaction identifier"098765432111"
pix_keystringYesRecipient PIX key"12345678911"
messagestringNoOptional message to payer"Mensagem ao usuário"
ispbstringYesISPB of the withdrawal service provider institution"33233"
agent_typestringYesIndicates 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:

NameTypeRequiredDefaultDescription
$dataarrayYesAn array with the data needed to generate the charge

Data:

KeyTypeRequiredDescriptionExample
amountintNoCharge amount or suggested amount10000 (R$100,00)
pix_keystringYesRecipient PIX Key"12345678911"
txidstringYesTransaction identifier"098765432111"
messagestringNoOptional 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:

NameTypeRequiredDescription
$privstringYesPrivate key to sign request body
$dronestringYesDrone ID generated and provided by Socinal
$environmentstringNoEnvironment to be used - Accept: PROD or DEV - Default: DEV

Domain:

Account Types:

TypeDescription
icaIndividual checking account
isaIndividual savings account
jcaJoint checking account
jsaJoint savings account
p2pAccount 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:

NameTypeRequiredDefaultDescription
$dataarrayYesAn array with the data needed to generate the charge

Data:

KeyTypeRequiredDescriptionExample
recipient_bank_codestringYesRecipient bank code in COMPE code pattern"001"
recipient_bank_branchstringYesRecipient bank branch"0001"
recipient_bank_accountstringYesRecipient bank account"1234123-1"
recipient_bank_account_typestringYesRecipient Bank Account type - Accept: ica,isa,jca,jsa or p2p - Domain"ica"
recipient_documentstringNoRecipient document"12345678911"
recipient_namestringNoRecipient name"Fulano de Tal"
amountintYesAmount to transfer10000 (R$100,00)
transaction_typestringYesTransfer 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:

NameTypeRequiredDescription
$privstringYesPrivate key to sign request body
$dronestringYesDrone ID generated and provided by Socinal
$environmentstringNoEnvironment to be used - Accept: PROD or DEV - Default: DEV

BankSlip Domain:

Fee Types:

TypeDescription
percentMonthly percentage
amountAmount per day (calendar days)
noneNo fee applied

Fine Types:

TypeDescription
percentPercentage over total amount
amountFixed 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:

NameTypeRequiredDefaultDescription
$dataarrayYesAn array with the data needed to generate the charge

Data:

KeyTypeRequiredDescriptionExample
due_datedateYesBank slip due date2025-03-15
limit_datedateYesBank slip limit date for payment2025-03-15
amountintegerYesBank slip amount1000 (R$10,00)
accountstringYesCompany's checking account12345-6
walletstringYesBank wallet number001
company_usestringYesInternal/Custom ID use1234567890
payer_namestringYesBank slip payer nameJohn Doe
payer_documentstringYesPayer brazilian document123456789011
payer_streetstringNoPayer address lineRua das Flores
payer_complementstringNoPayer address complementApt 123
payer_citystringNoPayer citySao Paulo
payer_statestringNoPayer state - Accept only Brazilian states in UF standartSP
payer_numberstringNoPayer address number1230
payer_zipcodestringNoPayer address zipcode11100010
reduction_amountintegerNoReduction amount0
fee_typestringYesType of fee applied to the charge - Accept: percent, amount or none - Domainpercent
fee_amountintegerNoRequired if fee_type is not equal to percent or amount10
our_numberstringNoBank slip number, if set as null, will generate a number automatically0009
fine_typestringNoType of fine applied to the charge - Accept: percent or amount - Domainpercent
fine_amountintegerNoRequired if fine_type is set1000
fine_datestringNoRequired if fine_type is set - Date from which the fine is charged2025-03-18
discount1_datedateNoRequired if discount1_amount is set - First discount limit date2025-03-10
discount1_amountintegerNoRequired if discount1_date is set - First discount fixed amount1000
discount2_datedateNoRequired if discount2_amount is set - Second discount limit date2025-03-12
discount2_amountintegerNoRequired if discount2_date is set - Second discount fixed amount1000
discount3_datedateNoRequired if discount3_amount is set - Third discount limit date2025-03-13
discount3_amountintegerNoRequired if discount3_date is set - Third discount fixed amount`1000
document_numberstringNoRecipient document number2187abvc
descriptionstringNoBank slip descriptionInvoice 4000 payment
final_recipient_namestringNoFinal recipient nameJane Doe LTDA
final_recipient_documentstringNoFinal recipient document1231213123
final_recipient_company_namestringNoFinal recipient company nameJane 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:

NameTypeRequiredDefaultDescription
$dataarrayYesAn array with the data needed to generate the charge

Data:

KeyTypeRequiredDescriptionExample
due_datedateNoBank slip due date2025-03-15
digitable_linestringNoBank slip digitable line2312378182371261623...
our_numberstringNoBank slip our number123000123
statusstringNoAccept: pending,registered,canceled,paid,manualpaid
pagestringNoWhich page want to be seen1

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:

NameTypeRequiredDefaultDescription
$dataarrayYesArray 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:

NameTypeRequiredDefaultDescription
$dataarrayYesArray 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:

NameTypeRequiredDefaultDescription
$dataarrayYesArray 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.