Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Multipayment Gateways Laravel Package

musahmusah/laravel-multipayment-gateways

View on GitHub
Deep Wiki
Context7

Making Request to Other Endpoints

Given that our Stripe service only provide access to the most common endpoints, you can make request to other endpoints we have not added to the service by using the HttpClientWrapper class. This class is a wrapper around the GuzzleHttp\Client class and it provides a simple way to make request to any endpoint. The HttpClientWrapper class is available through the Stripe facade, stripe() helper or through dependency injection using the StripeContract interface. The HttpClientWrapper class, is designed to extract some of the configurations from the Stripe service so you that you don't have to pass them when making request to other endpoints.

You can use the HttpClientWrapper class in any of the following ways:

Using Facade

use MusahMusah\LaravelMultipaymentGateways\Facades\Stripe;

// This will make a request to the endpoint: https://api.stripe.com/v1/customers/cus_4QFOF3xrvBT2nU as a get request
$response = Stripe::httpClient()->get('v1/customers/cus_4QFOF3xrvBT2nU');
dd($response);

Using Helper


 // this will make a request to the endpoint: https://api.stripe.com/v1/customers/cus_4QFOF3xrvBT2nU as a get request
 $response = stripe()->httpClient()->get('v1/customers/cus_4QFOF3xrvBT2nU');
 dd($response);

Using Dependency Injection

use MusahMusah\LaravelMultipaymentGateways\Contracts\StripeContract;

class StripePaymentController extends Controller
{
    public function initiatePayment(Request $request, StripeContract $stripe)
    {
        // this will make a request to the endpoint: https://api.stripe.com/v1/customers/cus_4QFOF3xrvBT2nU as a get request
        $response = $stripe->httpClient()->get('v1/customers/cus_4QFOF3xrvBT2nU');
        dd($response);
    }
}

With the above example, you can make request to any Stripe endpoint you want. This ensures the package is flexible and can be used to make request to any endpoint of the payment gateway you are using.

All HTTP Methods Available

The HttpClientWrapper class provides access to all the HTTP methods available in the GuzzleHttp\Client class. The methods are:

  • get
  • post
  • put
  • patch
  • delete
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium