Download the PHP package payarc/payarc-sdk-php without Composer
On this page you can find all versions of the php package payarc/payarc-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download payarc/payarc-sdk-php
More information about payarc/payarc-sdk-php
Files in payarc/payarc-sdk-php
Package payarc-sdk-php
Short Description Payarc PHP Sdk
License MIT
Homepage https://payarc.com/
Informations about the package payarc-sdk-php
Payarc SDK for PHP
The Payarc SDK allows developers to integrate Payarc's payment processing capabilities into their applications with ease. This SDK provides a comprehensive set of APIs to handle transactions, customer management, and candidate merchant management.
Table of Contents
- Requirements
- Installation
- Dependencies
- Usage
- API Reference
- Examples
- License
Requirements
PHP 8.1 or later.
Installation
You can install the Payarc SDK using composer.Run the following command:
[!WARNING] There is no stable version of this package yet. Use this command to install the package.
To use the bindings, use Composer's autoload:
Dependencies
The bindings require the following extensions in order to work properly:
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.
Usage
Before you can use the Payarc SDK, you need to initialize it with your API key and the URL base point. This is required for authenticating your requests and specifying the endpoint for the APIs. For each environment (prod, sandbox) both parameters have different values. This information should stay on your server and security measures must be taken not to share it with your customers. Provided examples use package symfony/dotenv to store this information and provide it on the constructor. It is not mandatory to use this approach as your setup could be different. In case you want to take benefits of candidate merchant functionality you need so-called Agent identification token. This token could be obtained from the portal.
You have to create .env file in root of your project and update the following rows after =
then install symfony/dotenv package
You have to create object from SDK to call different methods depends on business needs. Optional you can load .env file into configuration by adding the following code:
then you create instance of the SDK
if no errors you are good to go.
API Reference
- Documentation for existing payment API provided by Payarc can be found on https://docs.payarc.net/
- Documentation for existing candidate merchant management API can be found on https://docs.apply.payarc.net/
Examples
SDK is build around object payarc. From this object you can access properties and function that will support your operations.
Object Payarc has the following services:
charges - to manipulate payments
batches - to manipulate batches
customers - to manipulate customers
deposits - to manipulate deposits
applications - to manipulate candidate merchants
split_campaigns - to manipulate split campaigns
billing
- plan - to manipulate plans
- plan_subscription - to manipulate Plan subscriptions
disputes - to manipulate disputes
user_settings - to manipulate user settings
payarcConnect - to interact with a terminal running Payarc Connect
Service Payarc->charges
Service Payarc->charges is used to manipulate payments in the system. This Service has the following functions:
create - this function will create a payment intent or charge accepting various configurations and parameters. See examples for some use cases.
retrieve - this function returns json object 'Charge' with details
list - returns an object with attribute 'charges' a list of json object holding information for charges and object in attribute 'pagination'
createRefund - function to perform a refund over existing charge
adjustSplits - function to modify splits for existing charge (Only for Merchants configured with instructional funding)
createSplit - function to create splits
listSplits - function to retrieves a list of instructional funding allocations associated with a specific merchant account.
Service Payarc->payee is used to manipulate payees in the system. This Service has the following functions:
create - this function to create process of connecting your payee with Payarc
list - this function returns all payees for the current agent
delete - this function to delete payee record by id
Service Payarc->batches
Service Payarc->batches is used to manipulate payments in the system. This Service has the following functions:
retrieve - this function returns json object 'Batch' with details
list - returns an object with attribute 'batches' a list of json object holding information for batches and object in attribute 'pagination'
Service Payarc->customer
Service Payarc->customer is representing your customers with personal details, addresses and credit cards and/or bank accounts. Saved for future needs
create - this function will create object stored in the database for a customer. it will provide identifier unique for each in order to identify and inquiry details. See examples and docs for more information
retrieve - this function extract details for specific customer from database
list - this function allows you to search amongst customers you had created. It is possible to search based on some criteria. See examples and documentation for more details
update - this function allows you to modify attributes of customer object.
delete - this function allows you to delete customer object.
Service Payarc->applications
Service Payarc->applications is used by Agents and ISVs to manage candidate merchant when acquiring new customer. As such you can create, list, get details, and manage documents required in boarding process.
create - this function add new candidate into database. See documentation for available attributes, possible values for some of them and which are mandatory.
list - returns a list of application object representing future merchants. Use this function to find the interested identifier.
retrieve - based on identifier or an object returned from list function, this function will return details
delete - in case candidate merchant is no longer needed it will remove information for it.
add_document - this function is adding base64 encoded document to existing candidate merchant. For different types of document required in the process contact Payarc. See examples how the function could be invoked
delete_document - this function removes document, when document is no longer valid.
list_sub_agents - this function is usefull to create candidate in behalf of other agent.
submit - this function initialize the process of sing off contract between Payarc and your client
Service Payarc->deposits
Service Payarc->deposits is used to manipulate deposits in the system. This Service has the following functions:
list - this function returns a list of deposit summaries for agent based on the specified date range. Mids and account_ids are optional parameters.
Service Payarc->billing
This Service is aggregating other services responsible for recurrent payments. Nowadays, they are plan and plan_subscription.
Service Payarc->billing->plan
This Service contains information specific for each plan like identification details, rules for payment request and additional information. This SERVICE has methods for:
create - you can programmatically created new objects to meet client's needs,
list - inquiry available plans,
retrieve - collect detailed information for a plan,
update - modify details of a plan,
delete - remove plan when no longer needed,
create_subscription: issue a subscription for a customer from a plan.
Based on plans you can create subscription. Time scheduled job will request and collect payments (charges) according plan schedule from customer.
Service Payarc->user_settings->agent->webhooks
This Service is used to manipulate user settings in the system. This SERVICE has methods for:
create - this function will create object stored in the database for webhooks in form of key value pair,
list - this function allows you to search amongst user settings you had created,
update - this function allows you to modify attributes of user settings object,
delete - this function allows you to delete user settings object.
Creating a Charge
Example: Create a Charge with Minimum Information
To create a payment(charge) from a customer, minimum information required is:
amountconverted in cents,currencyequal to 'usd',sourcethe credit card which will be debited with the amount above.
For credit card minimum needed attributes are card number and expiration date. For full list of attributes see API documentation.
This example demonstrates how to create a charge with the minimum required information:
Example: Create a Charge by Token
To create a payment(charge) from a customer, minimum information required is:
amountconverted in cents,currencyequal to 'usd',sourcean object that has attributetoken_id. this can be obtained by the CREATE TOKEN API for token creation. This example shows how to create a charge using a token:
Example: Create a Charge by Card ID
Charge can be generated over specific credit card (cc) if you know the cc's ID and customer's ID to which this card belongs. This example demonstrates how to create a charge using a card ID:
Example: Create a Charge with Split (Instructional Funding)
This example demonstrates how to create a charge with split instructions. Merchants configured with instructional funding are required to include the splits array in the request payload. At least one valid split instruction must be provided — otherwise, the request may result in errors and could delay funding of the transaction.
Example: Create Split Instructional Funding
This example demonstrates how to transfer money to my payees via instructional funding
Example: Adjust Splits for Charge with Instructional Funding
This example demonstrates how to adjust splits for an existing charge with instructional funding by charge id.
Example: Listing Splits for Charge with Instructional Funding
This example demonstrates how to list splits for an existing charge with instructional funding by charge id. It provides a detailed breakdown of the amount or percentage assigned to each allocation, along with its status and timestamps.
Example: Add a Tip to a Charge
This example demonstrates how to add a tip to an existing charge.
Manage Payee
Create new Payee
In the process of connecting your payee with Payarc, a selection is made based on Payarc's criteria. The process begins with filling information for the payee and creating an entry in the database. Here is an example of how this process could start:
Retrieve Information for Payees
List all payees for the current agent:
Example: Delete a Payee
This example demonstrates how to delete an existing payee when only the ID is known:
Example: Create a Charge by Bank account ID
This example shows how to create an ACH charge when you know the bank account
Example make ACH charge with new bank account. Details for bank account are send in attribute source.
Listing Charges
Example: List Charges with No Constraints
This example demonstrates how to list all charges without any constraints:
Listing Charges by Agent
Example: List Charges with No Constraints by Agent (Payfac)
This example demonstrates how to list all charges by agent without any constraints:
Example: List Charges with Constraints by Agent (Traditional)
This example demonstrates how to list all charges by agent with date constraints:
Retrieving a Charge
Example: Retrieve a Charge
This example shows how to retrieve a specific charge by its ID:
Example: Retrieve an ACH Charge
his example shows how to retrieve a specific ACH charge by its ID:
Refunding a Charge
Example: Refund a Charge
This example demonstrates how to refund either charge or ACH charge by its ID:
- for regular charge use
ch_prefix and for ACH charge useach_prefix.
Example: List Batch Reports by Agent with Constraints
This example demonstrates how to retrieve batch settlement reports for merchants based on a specified date range. The response contains detailed transaction and settlement information for each merchant account within the given date range.
Example: List Batch Report Details by Agent
This example demonstrates how to retrieve detailed transaction information for a specific merchant’s batch report based on the Merchant_Account_Number, Batch_Reference_Number, and the specified date. It provides a list of individual transactions for that batch, along with batch totals. Get parameters for desired batch report here
Managing Customers
Example: Create a Customer with Credit Card Information
This example shows how to create a new customer with credit card information:
Example: Update a Customer
This example demonstrates how to update an existing customer's information when only ID is known:
Example: Update an Already Found Customer
This example shows how to update a customer object:
Example: List Customers with a Limit
This example demonstrates how to list customers with a specified limit:
Example: Add a New Card to a Customer
This example shows how to add a new card to an existing customer:
Example: Add a New Bank Account to a Customer
This example shows how to add new bank account to a customer. See full list of bank account attributes in API documentation.
Example: Delete Customer
This example shows how to delete customer. See more details in API documentation.
Manage Candidate Merchants
Create new Candidate Merchant
In the process of connecting your clients with Payarc a selection is made based on Payarc's criteria. Process begins with filling information for the merchant and creating an entry in the database. Here is an example how this process could start
In this example attribute Lead is an object representing the business as the attribute Owners is and array of objects representing the owners of this business. Note this is the minimum information required. For successful boarding you should provide as much information as you can, for reference see documentation. In some case the logged user has to create application in behalf of some other agent. in this case the object_id of this agent must be sent in the object sent to function payarc->applications->create.To obtain the list of agent you can use function list_sub_agents as it is shown on examples:
Retrieve Information for Candidate Merchant
To continue with onboarding process you might need to provide additional information or to inquiry existing leads. In the SDK following functions exists: list and retrieve.
List all candidate merchant for current agent
Retrieve data for current candidate merchant
Update properties of candidate merchant
Documents management
SDK is providing possibility of adding or removing documents with add_document and delete_document respectively.
Example for adding supportive documents to candidate merchant
In this example we search for all candidate merchants and on the last added in the system we attach a document (Payarc logo) that will be used in on boarding process. See documentation for document attributes. In case document is no longer needed you can see those examples
Again we search for the last candidate and remove first found (if exists) document. In case we already know the document ID, for example if we retrieve information for candidate you can use
Signature
As agent or ISV the process is completed once the contract between Payarc and your client is sent to this client for signature. Once all documents and data is collected method submit of the candidate merchant must be invoked, here is an example
Lead Status
Returns the status of an application
Split Payment
As ISV you can create campaigns to manage financial details around your processing merchants. In the SDK the object representing this functionality is split_campaigns this object has functions to create. list, update campaigns. Here below are examples related to manipulation of campaign.
List all campaigns
To inquiry all campaigns available for your agent
as result a list of campaigns is returned. based on this list you can update details
List all processing merchants
Use this function to get collection of processing merchants. Later on you can assign campaigns to them
Create and retrieve details for campaign
Use this function to create new campaign
as result the new campaign is returned use it as an object of reference to object_id. IF you need to query details about the campaign see the example below.
Update campaign details
In case you need to update details of the campaign use update function. in the examples below you can reference campaign by id or as an object
Recurrent Payments Setup
Recurrent payments, also known as subscription billing, are essential for any service-based business that requires regular, automated billing of customers. By setting up recurrent payments through our SDK, you can offer your customers the ability to easily manage subscription plans, ensuring timely and consistent revenue streams. This setup involves creating subscription plans, managing customer subscriptions, and handling automated billing cycles. Below, we outline the steps necessary to integrate recurrent payments into your application using our SDK.
Creating Subscription Plans
The first step in setting up recurrent payments is to create subscription plans. These plans define the billing frequency, pricing, and any trial periods or discounts. Using our SDK, you can create multiple subscription plans to cater to different customer needs. Here is an example of how to create a plan:
In this example a new plan is created in attribute name client friendly name of the plan must be provided. Attribute amount is number in cents. in interval you specify how often the request for charge will occurs. Information in statement_descriptor will be present in the reason for payment request. For more attributes and details check API documentation.
Updating Subscription Plan
Once plan is created sometimes it is required details form it to be changed. The SDK allow you to manipulate object plan or to refer to the object by ID. here are examples how to change details of a plan:
Update plan when know the ID
Creating Subscriptions
Once you have created subscription plans, the next step is to manage customer subscriptions. This involves subscribing customers to the plans they choose and managing their billing information. Our SDK makes it easy to handle these tasks. Here's how you can subscribe a customer to a plan:
Create a subscription over plan object
Create a subscription with plan id
This code subscribes a customer to the premium plan using their saved payment method. The SDK handles the rest, including storing the subscription details and scheduling the billing cycle.
Listing Subscriptions
To collect already created subscriptions you can use method list as in the example
Updating Subscription
To manipulate subscription SDK is providing few methods update and cancel, both can be used with identifier of subscription or over subscription object. Examples of their invocations:
Update subscription with ID
Cancel subscription with ID
Manage Disputes
A dispute in the context of payment processing refers to a situation where a cardholder questions the validity of a transaction that appears on their statement. This can lead to a chargeback, where the transaction amount is reversed from the merchant's account and credited back to the cardholder. A cardholder sees a transaction on their account that they believe is incorrect or unauthorized. This could be due to various reasons such as fraudulent activity, billing errors, or dissatisfaction with a purchase. The cardholder contacts their issuing bank to dispute the transaction. They may provide details on why they believe the transaction is invalid. The issuing bank investigates the dispute. This may involve gathering information from the cardholder and reviewing the transaction details. The issuing bank communicates the dispute to the acquiring bank (the merchant's bank) through the card network (in your case Payarc). The merchant is then required to provide evidence to prove the validity of the transaction, such as receipts, shipping information, or communication with the customer. Based on the evidence provided by both the cardholder and the merchant, the issuing bank makes a decision. If the dispute is resolved in favor of the cardholder, a chargeback occurs, and the transaction amount is deducted from the merchant's account and credited to the cardholder. If resolved in favor of the merchant, the transaction stands. This documentation should help you understand how to use the Payarc SDK to manage charges and customers. If you have any questions, please refer to the Payarc API documentation or contact support.
Inquiry Dispute
The SDK provide a function to list your disputes. you can provide query parameters to specify the constraints over the function. when sent with no parameters it returns all disputes in the past one month
You can get details for a dispute by retrieve function. the identifier is returned by list function
Submit Cases
In order to resolve the dispute in your(merchant's) flavour, the merchant is required to provide evidence to prove the validity of the transaction, such as receipts, shipping information, or communication with the customer. The SDK provides a function add_document that allows you to provide files and write messages to prove that you have rights to keep the mony for the transaction. First parameter of this function is the identifier of the dispute for which the evidence is. Next parameter is an object with following attributes:
DocumentDataBase64: base46 representation of the files that will be used as evidencetext: short text to describe the evidencemimeType: type of the provided filemessage: Description of submitted case For more information for parameters and their attributes check documentation
List Deposits
Example: List Deposits by Agent with Constraints
This example demonstrates how to retrieve deposit summaries for agent based on the specified date range and optional constraints on mids and account_ids.
Managing Webhooks on Agent Level
Webhooks management is available for agents only. To use this functionality you need to provide agent token on the constructor of the SDK.
There are 4 type of webhooks that could be created:
| Enum Value | Keys | Description |
|---|---|---|
UserSettingKey::ONBOARDING_WEBHOOK |
merchant.onboarded.webhook | Onboarding Webhook URL |
UserSettingKey::LEAD_UPDATE_WEBHOOK |
lead.updated.webhook | Lead Update Webhook URL |
UserSettingKey::LEAD_UPDATE_CATEGORY_WEBHOOK |
lead.category.updated.webhook | Lead Category Update Webhook URL |
UserSettingKey::LEAD_UNDERWRITING_UPDATED_WEBHOOK |
lead.underwriting.updated.webhook | Lead Underwriting Update Webhook URL |
Example: Create Webhook
This example demonstrates how to create a webhook:
Example: List Webhooks
This example demonstrates how to list all webhooks:
Example: Update Webhook
This example demonstrates how to update a webhook:
This example demonstrates how to update a webhook by object:
Example: Delete Webhook
This example demonstrates how to delete a webhook:
Payarc Connect
The following functionality will pertain only to user who are utilizing the Payarc Connect integration:
Login
This function must be called and completed before any other functionality can be used.
Sale
Initiate a sale remotely on your PAX terminal
| Parameter | Usage |
|---|---|
| TenderType | CREDIT, DEBIT |
| ECRRefNum | Unique code for this transaction provided by the user. This code will be used later for voids. |
| Amount | Amount to capture. Format is $$$$$$$CC |
| DeviceSerialNo | Serial number of your PAX terminal |
Void
Initiate a void remotely on your PAX terminal
| Parameter | Usage |
|---|---|
| PayarcTransactionId | Unique code of a previous transaction. Required to do a void. Charge ID on Payarc Portal. |
| DeviceSerialNo | Serial number of your PAX terminal |
Refund
Initiate a refund remotely on your PAX terminal
| Parameter | Usage |
|---|---|
| Amount | Amount to capture. Format is $$$$$$$CC |
| PayarcTransactionId | Unique code of a previous transaction. Required to do a refund. Charge ID on Payarc Portal. |
| DeviceSerialNo | Serial number of your PAX terminal |
Blind Credit
Initiate a blind credit remotely on your PAX terminal
| Parameter | Usage |
|---|---|
| ECRRefNum | Unique code for this transaction provided by the user. |
| Amount | Amount to capture. Format is $$$$$$$CC |
| Token | Required for Refund. Found in PaxResponse.ExtData |
| ExpDate | Required for Refund. Found in PaxResponse.ExtData. Expiration date of card used in sale |
| DeviceSerialNo | Serial number of your PAX terminal |
Auth
Initiate an auth remotely on your PAX terminal
| Parameter | Usage |
|---|---|
| ECRRefNum | Unique code for this transaction provided by the user |
| Amount | Amount to capture. Format is $$$$$$$CC |
| DeviceSerialNo | Serial number of your PAX terminal |
Post Auth
Initiate a post auth remotely on your PAX terminal
| Parameter | Usage |
|---|---|
| ECRRefNum | Unique code for this transaction provided by the user |
| OrigRefNum | This number is obtained from the paymentResponse object from an auth transaction. |
| Amount | Amount to capture. Cannot exceed auth amount. If you need to exceed the auth amount, perform another sale and the auth will fall off. Format is $$$$$$$CC |
| DeviceSerialNo | Serial number of your PAX terminal |
Last Transaction
Returns the response object from the last transaction
Server Info
Returns the status of the server
Terminals
Returns a list of registered terminal for merchant
License
Licensed under the MIT license.
All versions of payarc-sdk-php with dependencies
ext-curl Version *
ext-json Version *
ext-mbstring Version *
php Version ^8.1
symfony/dotenv Version ^6.4.x-dev