This SilverStripe module is depreciated please consider using the
silverstripe-omnipay
module instead.
The Omnipayable module is designed to provide simple payment forms for SilverStripe using Omnipay.
The following forms are currently implemented:
- GoCardless
- PayPal Express Checkout
- PayPal Payments Pro
- Stripe
- SilverStripe 3.0 or newer.
- Omnipay 0.8 or newer.
The Omnipayable module can be installed via Composer.
To do so, simply add it to the composer.json
file in the root of your SilverStripe installation:
{
"require": {
"studiobonito/silverstripe-omnipayable": "0.2.*"
}
}
Then run composer to update your dependencies:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar update
Copy the 'omnipayable' folder to the root of your SilverStripe installation.
There is a factory method provided to with form creation. This will create the correct form for the currently configured gateway:
$form = OmnipayableForm::create($this, 'PaymentForm');
Alternatively you can create the form directly:
$form = new OmnipayableForm_GoCardless($this, 'PaymentForm');
Once the form is created you can set the amount that will be charged:
$form->setAmount('10.00');
class Page_Controller extends ContentController
{
public static $allowed_actions = array(
'PaymentForm'
);
public function PaymentForm()
{
$form = OmnipayableForm::create($this, 'PaymentForm');
$form->setAmount('10.00');
return $form;
}
}
When adding the form to a Controller
remember to add the forms name to the $allowed_actions
array.
The base form provides form fields for all of the currently supported properties of the Omnipay CreditCard
object.
Each gateway specific form is intended to show only the relevant subset of fields that apply to that gateway.
The following is a list of all the base form fields and their type:
- FirstName
TextField
- LastName
TextField
- Company
TextField
- Email
EmailField
- Number
CreditCardField
- Cvv
TextField
- ExpiryMonth
DropdownField
- ExpiryYear
DropdownField
- StartMonth
DropdownField
- StartYear
DropdownField
- IssueNumber
TextField
- Type
DropdownField
- BillingAddress1
TextField
- BillingAddress2
TextField
- BillingCity
TextField
- BillingPostcode
TextField
- BillingState
TextField
- BillingCountry
DropdownField
- BillingPhone
PhoneField
- ShippingAddress1
TextField
- ShippingAddress2
TextField
- ShippingCity
TextField
- ShippingPostcode
TextField
- ShippingState
TextField
- ShippingCountry
DropdownField
- ShippingPhone
PhoneField