Cashier v10

Aug, 8 2019

We're very excited to announce the immediate availability of Cashier v10. This new Cashier release is a major update with lots of changes to Cashier's internals and public API. Cashier has been upgraded to support the new Payment Intents and Payment Methods APIs from Stripe as well as handle European Strong Customer Authentication (SCA) regulations.

In this blog post, we'll briefly go over some of the major changes. For more thorough information, read the upgrade guide as well as the new documentation.

Payment Intents

Cashier uses the new Stripe Payment Intents API, which means that it now fully supports secondary payment actions like 3D Secure. The new Payment Intents API is now Stripe's preferred way of handling all transactions.

Because of PSD2 & SCA regulations, which were introduced in the EU, banks can now require card payments to provide a secondary confirmation action. Often, this is a 3D Secure confirmation. Because of these regulations, Cashier needed a way to inform users that a secondary payment confirmation action was required, as well as provide an easy method of completing that secondary action.

In Cashier v10, exceptions will be thrown for any payment actions that might trigger a secondary payment action, such as creating a new subscription:

use Laravel\Cashier\Exceptions\IncompletePayment;

try {
  $subscription = $user->newSubscription('default', $planId)
    ->create($paymentMethod);
} catch (IncompletePayment $exception) {
  return redirect()->route(
    'cashier.payment',
    [$exception->payment->id, 'redirect' => route('home')]
  );
}

In the example above, the exception is caught and the user is redirected to the new payment confirmation page that ships with Cashier:

undefined

After confirming the payment, the user will be redirected to the path you specify. Cashier's payment confirmation page can be published to your own application so that you can customize the screen to match the look and feel of your own application.

To learn more about gathering payment methods and creating subscriptions, please refer to the complete Cashier documentation.

Payment Methods

Stripe's new Payment Methods API is the new preferred way of gathering payment method information and exchanging that information for a secure token that can be used to generate charges or create subscriptions.

Per Stripe's recommendations, the previous "Sources" and token based Stripe APIs have been removed from Cashier and replaced by the new Payment Methods API. Stripe provides complete backwards compatibility with the old Sources API, so customers that already subscribed to your application will continue to be charged as expected.

Much More

In addition to support for Payment Intents and Payment Methods, there's a variety of additional changes and improvements like:

We hope you enjoy this new Cashier release!





By Dries Vints

Developer at Laravel working on the first-party open source libraries. Find me on TwitterGitHub or my website.

Follow the RSS Feed.