briqpay/legacy-php-sdk

dev-master 2022-05-09 16:00 UTC

This package is not auto-updated.

Last update: 2025-04-23 05:02:10 UTC


README

This is the API documentation for Briqpay. You can find out more about us and our offering at our website https://briqpay.com In order to get credentials to the playgrund API Please register at https://app.briqpay.com # Introduction Briqpay Checkout is an inline checkout solution for your b2b ecommerce. Briqpay Checkout gives you the flexibility of controlling your payment methods and credit rules while optimizing the UX for your customers # SDKs Briqpay offers standard SDKs to PHP and .NET based on these swagger definitions. You can download them respively or use our swagger defintitions to codegen your own versions. #### For .NET Install-Package Briqpay #### For PHP composer require briqpay/php-sdk # Standard use-case As a first step of integration you will need to create a checkout session. \n\nIn this session you provide Briqpay with the basic information necessary. In the response from briqpay you will recieve a htmlsnippet that is to be inserted into your frontend. The snippet provided by briqpay will render an iframe where the user will complete the purchase. Once completed, briqpay will redirect the customer to a confirmation page that you have defined. alt # JavaScript SDK The first step of integration is to add our JS to your site just before closing the `<head> tag. This ensures that our JS library is avaliable to load the checkout. <script src=\"https://api.briqpay.com/briq.min.js\"></script> Briqpay offers a few methods avaliable through our Javascript SDK. The library is added by our iframe and is avalable on window._briqpay If you offer the posibility to update the cart or order amonts on the checkout page, the JS library will help you. If your store charges the customer different costs and fees depening on their shipping location, you can listen to the addressupdateevent in order to re-calculate the total cost. `javascript window._briqpay.subscribe('addressupdate', function (data) { console.log(data) }) If your frontend needs to perform an action whe the signup has completed, listen to thesignup_finalizedevent.javascript window._briqpay.subscribe('signup_finalized', function (status) { // redirect or handle status 'success' / 'failure' }) If you allow customers to change the total cart value, you can utilise the JS library to suspend the iframe while you perform a backen update call towards our services. As described below: ![alt](https://cdn.briqpay.com/static/developer-portal/suspend-resume.png) The iframe will auto-resume after 7 seconds if you dont call_briqpay.resume()before # Test Data In order to verify your integration you will neeed to use test data towards our credit engine. ## Company identication numbers * 1111111111 - To recieve a high credit scoring company ( 100 in rating) * 2222222222 - To test the enviournment with a bad credit scoring company (10 in rating) ## Card details In our playground setup your account is by default setup with a Stripe integration. In order to test out the card form you can use the below card numbers: * 4000002500003155 - To mock 3ds authentication window * 4000000000000069 Charge is declined with an expired_card code. You can use any valid expiry and CVC code # Authentication Briqpay utilizes JWT in order to authenticate calls to our platform. Authentication tokens expire after 48 hours, and at that point you can generate a new token for the given resource using the/auth`` endpoint. - Basic Auth - only used on the auth endpoint in order to get the Bearer Token - JWT Bearer Token - All calls towards the API utlizes this method\"

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/briqpay/php-sdk.git"
    }
  ],
  "require": {
    "briqpay/php-sdk": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: basicAuth
$config = Briqpay\Configuration::getDefaultConfiguration()
    ->setUsername('YOUR_USERNAME')
    ->setPassword('YOUR_PASSWORD');

$apiInstance = new Briqpay\Api\AuthenticationApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->getAuthToken();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthenticationApi->getAuthToken: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: basicAuth
$config = Briqpay\Configuration::getDefaultConfiguration()
    ->setUsername('YOUR_USERNAME')
    ->setPassword('YOUR_PASSWORD');

$apiInstance = new Briqpay\Api\AuthenticationApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sessionid = "sessionid_example"; // string | Session id for the new bearer token

try {
    $result = $apiInstance->getAuthTokenForSession($sessionid);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthenticationApi->getAuthTokenForSession: ', $e->getMessage(), PHP_EOL;
}
// Configure HTTP basic authorization: basicAuth
$config = Briqpay\Configuration::getDefaultConfiguration()
    ->setUsername('YOUR_USERNAME')
    ->setPassword('YOUR_PASSWORD');

$apiInstance = new Briqpay\Api\AuthenticationApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$sessionid = "sessionid_example"; // string | Session id for the new bearer token

try {
    $result = $apiInstance->getSignupSessionAuth($sessionid);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AuthenticationApi->getSignupSessionAuth: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to https://playground-api.briqpay.com/

ClassMethodHTTP requestDescription
AuthenticationApigetAuthTokenGET /authGenerate bearer token
AuthenticationApigetAuthTokenForSessionGET /auth/{sessionid}Generate a new auth token for session
AuthenticationApigetSignupSessionAuthGET /auth/signup/{sessionid}Get a new auth token for a signup session
CheckoutApicancelRecurringTokenPOST /checkout/v1/recurring/token/cancelCancel a recurring token
CheckoutApicreateSessionPOST /checkout/v1/sessionsCreate a payment session
CheckoutApipatchCheckoutSessionPOST /checkout/v1/sessions/patchPatch a session
CheckoutApipurchaseDecisionPOST /v2/session/{sessionid}/decision/purchaseApprove or deny a purchase a session
CheckoutApireadRecurringTokenPOST /checkout/v1/recurring/tokenRead a recurring token
CheckoutApireadSessionPOST /checkout/v1/readsessionRead session
CheckoutApiupdateSessionPOST /checkout/v1/sessions/updateUpdate a session
CheckoutApiyourchargewebhookPostPOST /yourchargewebhookCharge result
HostedPageApicreateHostedPagePOST /hostedpage/v1/checkoutCreate a hosted checkout page
OrderManagementApicaptureOrderPOST /order-management/v1/capture-orderCapture a placed order
OrderManagementApirefundOrderPOST /order-management/v1/refund-orderRefunding a captured
SignupApicreateSignupPOST /signup/v1/sessionCreate a new signup session
SignupApireadSignupGET /signup/v1/sessionRead an ongoing signup session
SignupApisendValidateResponsePOST /signup/v1/hooks/validatedValidation Result
SignupApiyoursignupwebhookPostPOST /yoursignupwebhookSignupWebhook Request

Documentation For Models

Documentation For Authorization

basicAuth

  • Type: HTTP basic authentication

bearerAuth

  • Type: HTTP bearer authentication

Author

hello@briqpay.com