Download the PHP package getcandy/stripe without Composer

On this page you can find all versions of the php package getcandy/stripe. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package stripe

This addon enables Stripe payments on your GetCandy storefront.

Alpha Release

This addon is currently in Alpha, whilst every step is taken to ensure this is working as intended, it will not be considered out of Alpha until more tests have been added and proved.

Tests required:

Requirements

Installation

Require the composer package

Publish the configuration

This will publish the configuration under config/getcandy/stripe.php.

Publish the views (optional)

GetCandy Stripe comes with some helper components for you to use on your checkout, if you intend to edit the views they provide, you can publish them.

Enable the driver

Set the driver in config/getcandy/payments.php

Add your Stripe credentials

Make sure you have the Stripe credentials set in config/services.php

Keys can be found in your Stripe account https://dashboard.stripe.com/apikeys

Configuration

Below is a list of the available configuration options this package uses in config/getcandy/stripe.php

Key Default Description
policy automatic Determines the policy for taking payments and whether you wish to capture the payment manually later or take payment straight away. Available options manual or automatic

Backend Usage

Creating a PaymentIntent

This method will create a Stripe PaymentIntent from a Cart and add the resulting ID to the meta for retrieval later. If a PaymentIntent already exists for a cart this will fetch it from Stripe and return that instead to avoid duplicate PaymentIntents being created.

Fetch an existing PaymentIntent

Both these methods will return a Stripe\PaymentIntent object.

Storefront Usage

This addon provides some useful components you can use in your Storefront, they are built using Laravel Livewire and AlpineJs so bear that in mind.

If you are using the Demo Store, this is already set up for you so you can refer to the source code to see what's happening.

Set up the scripts

Place this in the <head> of your Storefront.

Add the payment component

Wherever you want the payment form to appear, add this component:

The returnUrl is where we want Stripe to redirect us afer they have processed the payment on their servers.

Do NOT point this to the order confirmation page, as you'll see below

Process the result

You'll notice above we've told Stripe to redirect back to the checkout page, this is because although Stripe has either taken payment or allocated funds based on your policy, we still need GetCandy to process the result and create the transactions it needs against the order.

When Stripe redirects us we should have two parameters passed in the query string. payment_intent_client_secret and payment_intent. We can then check for these values and pass them off using GetCandy's Payments driver.

So, assuming we are using Livewire and on a CheckoutPage component (like on the Demo Store)

And that should be it, you should then see the order in GetCandy with the correct Transactions.

If you have set your policy to manual you'll need to go into the Hub and manually capture the payment.


Contributing

Contributions are welcome, if you are thinking of adding a feature, please submit an issue first so we can determine whether it should be included.

Testing

Currently we use a manual MockClient to mock the responses the Stripe API will return. This is likely to be improved upon as tests are written, but it should be apparent what this is doing, so feel free to add your own responses.


All versions of stripe with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
getcandy/core Version ^2.0-beta12
stripe/stripe-php Version ^7.114
livewire/livewire Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package getcandy/stripe contains the following files

Loading the files please wait ....