paydock logo on transparent background
  • Solutions

    Solutions

    For Banks

    For Merchants

    Generic selectors
    Exact matches only
    Search in title
    Search in content
    Post Type Selectors
    post
    page
    • Expand Market Share
    • Elevate Merchant Experience
    • Offer the Latest Payment Technology
    • Rocket Launch New Merchant Services
    • Minimising Payment Tech Risk
    • Ever Fresh Payment Experiences
    • Deep Security and Stability Uplift
    • Reporting and Reconciliation Fixes
  • Our Platform

    Our Platform​

    Paydock

    Quick Contact

    Generic selectors
    Exact matches only
    Search in title
    Search in content
    Post Type Selectors
    post
    page
    • Our Platform
    • Features
    • For Banks
    • For Merchants
    • Our Platform
    • Features
    • Contact Support
    • Our Helpdesk
    • Contact Us
  • Developers

    Developers

    Paydock

    Resources

    Generic selectors
    Exact matches only
    Search in title
    Search in content
    Post Type Selectors
    post
    page
    • Status Page
    • Documentation
    • Support
    • Our Helpdesk
    • Release Notes
    • Changelog
    • GitHub
    • Boilerplates
    • NPM
    • Responsible Disclosure
  • About

    About

    Paydock

    Newsroom

    Generic selectors
    Exact matches only
    Search in title
    Search in content
    Post Type Selectors
    post
    page
    • Values
    • Careers at Paydock
    • Our Team
    • About Us - Our History
    • Newsroom
    • Contact Us
    • Blogs
    • Press Releases
    • Podcasts
  • Search

    Generic selectors
    Exact matches only
    Search in title
    Search in content
    Post Type Selectors
    post
    page

    Most Searched

    • Features
    • Contact Us
    • Banks
    • Merchants
Get Started
Log In

php SDK

  • Press Releases
PHP logo on top of website code.

Following on from our .Net & Java SDKs, we’ve now released our php SDK. This provides a friendly way to access Paydock, making it even easier to use Paydock.

 

You can pull this down through composer on Packagist

The code is open source on github.

Providing the right interface

One of the questions when putting together a new SDK is how to support this in a way that is as language friendly as possible. What we’ve put together for a strongly typed language like .Net, just doesn’t make as much sense for a dynamically typed language like php.

The simplest approach to this would be to simply map through the request, serialised as json, eg something like this:

1 $request = [“amount” => 100, “currency” => “AUD”, “token” => “token_id”]
2 $response = Charges::Create($request);

This works fine with simpler requests, but it tends to make it hard with larger, more complex request. In those cases, it’s easy to create a situation where you send through either too many parameters or too few. Also, when you can send through nested sets of parameters, it’s easy to send through parameters encoded at the wrong depth, e.g.:

1 // missing items object
2 $request = [“amount” => 100, “currency” => “AUD”, “token” => “token_id”, “transfer” => [“amount” => 25, “destination” => “account_id”]]
3 // correct structure
4 $request = [“amount” => 100, “currency” => “AUD”, “token” => “token_id”, “transfer” => [ “items” => [“amount” => 25, “destination” => “account_id”]]]

For this reason we settled on a fluent style interface.

Fluent interface

Using a fluent interface, you build up a request through a number of calls. Some good examples of fluent interfaces are things like LINQ in .Net:

1 var topOrders = orders.Where(o => o.Currency = “AUD”)
2 .OrderBy(o => o.Amount)
3 .Take(100)
4 .Select(o => o.Email);

These are often a very natural way of searching for data, but also work well to build up complex requests.

In order to make this as clear as possible, we’ve followed certain conventions. An example of this in the SDK is creating a charge with bank account details:

1 $response = $svc->create("John","Smith","[email protected]","+61414111111")
2 ->withBankAccount(self::bsbGateway, "test", "012003", "456456")
3 ->includeAddress("1 something st", "", "NSW", "Australia", "Sydney"2000")
4 ->call();

The first call is part of the call specifies the action (create). If this needs additional data, this is send through as with<Something>. Optional data is added through include<something>. And finally call() makes the actual call.

This made the API more complex to build, but provided a better experience of using the API.

As always, we’re open to improving this, so please raise any issues or concerns on on github and we’ll jump on it!

More from the Vault

  • Press Releases
  • 15 Apr 2025

Paydock Announces Leadership Changes to Accelerate Growth

[London, 15th April 2025] Paydock, the world’s first and only fully bank-grade payments enablement platform,

Paydock and Forter partnership
  • Press Releases
  • 15 Nov 2024

Paydock and Forter: Empowering Merchants and Financial Institutions with Seamless Payments and Fraud Prevention

Paydock and Forter: Empowering Merchants and Financial Institutions with Seamless Payments and Fraud Prevention Paydock

Aevi and Paydock partnership
  • Press Releases
  • 30 Oct 2024

Aevi and Paydock Unite to Revolutionize Omnichannel Payment

[London, 29th October 2024] Paydock, a leading eCommerce payment orchestration platform, has announced a strategic

Contacts

Orchestrate without clutter, confusion or code. Connect a world of payments and
commerce services to your business.

Contacts

Orchestrate without clutter, confusion or code. Connect a world of payments and commerce services to your business.

Sales

[email protected]

Support

[email protected]

Partnerships

[email protected]

Talent & Careers

[email protected]

Phone: 02035144739

Media, General

[email protected]

Accounts

[email protected]

Payments fly, profits rise and progress soars.

By creating a new money system that runs on our desire for more, we are the commerce orchestrators ensuring everyone walks away a winner.

  • Merchants plug-in
  • Paydock opens the door
  • Build meaningful payment experiences
Get started now
See all features
white paydock logo on transparent background
👋 we are hiring self-motivated people to join our team

Solutions

  • For Banks
  • For Merchants

Our Platform

  • Our Platform
  • Features

Developers

  • Status Page
  • Documentation
  • Support
  • Helpdesk
  • Release Notes
  • Changelog

About

  • Values
  • Careers at Paydock
  • Team
  • About Us - Our History
  • Newsroom
  • Contact Us
  • Solutions
    • For Banks
      • Expand Market Share
      • Elevate Merchant Experience
      • Offer the Latest Payment Technology
      • Rocket Launch New Merchant Services
    • For Merchants
      • Eliminating Payment Tech Risk
      • Ever Fresh Payment Experiences
      • Deep Security and Stability Uplift
      • Reporting and Reconciliation Fixes
      • Be A Master Merchant
  • Our Platform
    • Features
  • Developers
    • Status page
    • Paydock Documentation
    • Paydock Support
    • Our Helpdesk
  • About
    • Our Values
    • Careers
    • Our Team
    • About Us
    • Newsroom
    • Contact Us
Black Linkedin Logo On Transparent Background Black X Logo On Transparent Background Black Youtube Logo On Transparent Background Black Instagram Logo On Transparent Background

Paydock Holdings Pty Limited
L40,
2 Park Street,
Sydney,
NSW 2000,
Australia

 

 

Paydock Ltd
Arquen House,
4-6 Spicer Street,
St. Albans,
Hertfordshire,
England,
AL3 4PQ

Copyright © Paydock 2023. All Rights Reserved | Privacy Policy | Website Terms of Use 

Manage Cookie Consent
We collect cookies to analyse our website traffic and performance.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}