njoguamos / laravel-cashapp
A laravel package scaffolding Cash App API.
Requires
- php: ^8.1 | ^8.2 | ^8.3
- illuminate/contracts: ^10.0
- saloonphp/saloon: ^v3.6.0
- spatie/laravel-package-tools: ^1.16.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
This package is auto-updated.
Last update: 2024-04-15 06:59:32 UTC
README
Why Use this Package?
- All requests to the Network and Management APIs are automatically signed.
Installation
Installation Method
You can install this package via composer.
composer require njoguamos/laravel-cashapp
Migrations
You can publish and run the migrations with:
php artisan vendor:publish --tag="laravel-cashapp-migrations"
php artisan migrate
Config
You can publish the config file with:
php artisan vendor:publish --tag="laravel-cashapp-config"
You need to understand ande the following keys in the environment variables in your application.
Key | type | required | default | description |
---|---|---|---|---|
CASHAPP_PRODUCTION |
boolen |
false |
false |
Determine if production or staging api should be used. The default is false to avoid tampering with production api by accident. |
CASHAPP_REGION |
string |
false |
PDX |
A character code representing the region closest to where your own services are hosted. Must be supported regions. An InvalidRegionException exception is thrown if an invalid code is provided. |
CASHAPP_CLIENT_ID |
string |
true |
null |
Here you specify the <client_id> associated with your cash app account. |
Example in your .env
CASHAPP_PRODUCTION=true CASHAPP_REGION=ATL #Atlanta, United States CASHAPP_CLIENT_ID=CS-CI_ACKIl7VOyOUwAg...
Usage
Responses
All response return by this package are are instance of Saloon\Http\Response
which has the following keys methods.
Method | Description |
---|---|
$response->ok() |
Determine if the response code was "OK". |
$response->body() |
Get the body of the response as string. |
$response->status() |
Get the status code of the response. |
$response->json() |
Get the JSON decoded body of the response as an array or scalar value. |
$response->xml() |
Convert the XML response into a SimpleXMLElement. |
1 Network API
1.1 Brands
List Brands
Get a list of brands matching the given query parameters. API Reference
use NjoguAmos\CashApp\CashApp; # Defaults $response = CashApp::getBrands(); # With params $response = CashApp::getBrands(limit: 20);
A successful response body $response->body()
will be formatted as follows.
{ "brands": [ { "id": "string", "name": "string", "created_at": "2021-01-01T00:00:00Z", "updated_at": "2021-01-01T00:00:00Z", "reference_id": "example-id", "color": "#ffffff", "profile_image_url": "https://franklin-assets.s3.amazonaws.com/merchants/assets/v3/generic/m_category_business.png", "metadata": { "my-meta": "meta-value" } } ], "cursor": "string" }
Query Parameters
params | type | required | default | description |
---|---|---|---|---|
cursor | string |
false | null | A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. |
limit | integer |
false | 50 | Maximum number of brands to return. A number >=1 and <= 100 |
reference_id | string |
false | null | Filters results to only include brands with a reference_id matching the given value. The string should be >= 1 characters and <= 1024 characters. |
Testing
composer test
Changelog
Please see releases for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.