Download the PHP package gr4vy/gr4vy-php without Composer
On this page you can find all versions of the php package gr4vy/gr4vy-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gr4vy/gr4vy-php
More information about gr4vy/gr4vy-php
Files in gr4vy/gr4vy-php
Package gr4vy-php
Short Description Welcome to the Gr4vy PHP SDK
License MIT
Homepage https://openapi-generator.tech
Informations about the package gr4vy-php
Gr4vy SDK for PHP
Gr4vy provides any of your payment integrations through one unified API. For more details, visit gr4vy.com.
Installation
The Gr4vy PHP SDK can be installed via Composer.
Getting Started
To make your first API call, you will need to request a Gr4vy instance to be set up. Please contact our sales team for a demo.
Once you have been set up with a Gr4vy account you will need to head over to the Integrations panel and generate a private key. We recommend storing this key in a secure location but in this code sample we simply read the file from disk.
Environment
The SDK defaults the environment to "sandbox", to send transactions to production, set the environment in Gr4vyConfig
:
Gr4vy Embed
To create a token for Gr4vy Embed, call the config->getEmbedToken()
function
with the amount, currency, optional buyer information and optional checkout session for Gr4vy Embed.
Or, generate a checkout session and Embed Token with a single call:
You can now pass this token to your front end where it can be used to authenticate Gr4vy Embed.
The buyerId
and buyerExternalIdentifier
fields can be used to allow the
token to pull in previously stored payment methods for a user. A buyer needs to
be created before it can be used in this way.
Checkout Sessions
A checkout session can be used across Embed sessions to track retries or shopping cart updates. To achieve this the same checkoutSessionId
can be used in multiple getEmbedToken
calls.
NOTE: a checkout session is valid for 1h from creation.
Initialization
The client can be initialized with the Gr4vy ID (gr4vyId
) and the private key.
Alternatively, you can set the host
of the server to use directly.
Your API key can be created in your admin panel on the Integrations tab.
Multi merchant
In a multi-merchant environment, the merchant account ID can be set by passing merchantAccountId
to the Config:
Making API calls
This library conveniently maps every API path to a seperate function. For example, GET /buyers?limit=100
would be:
To create or update a resource an array
should be sent with the request data.
Similarly, to update a buyer you will need to pass in the BuyerUpdateRequest
.
Generate API bearer token
The SDK can be used to create API access tokens for use with other request libraries.
The first parameter is the location of your private key. The second parameter is an array of scopes for the token.
The resulting token can be used as a bearer token in the header of the HTTP request made to the API.
Logging & Debugging
The SDK makes it easy possible to the requests and responses to the console.
This will print debug output for the request to the console.
Development
Tests
To run the tests, store a private key for the spider environment and then run the following commands.
Publishing
Publishing of this project is done through Packagist. New versions are released by creating a new Git tag.
License
This library is released under the MIT License.
All versions of gr4vy-php with dependencies
ext-curl Version *
ext-json Version *
ext-mbstring Version *
guzzlehttp/guzzle Version >=6.5.5
lcobucci/jwt Version ^4.1.5