Options
production
Enables/disables production.
site/config/config.php
return [
'ww.merx.production' => true,
];
If set to true
paypal.live…
and stripe.live…
keys are used.
If set to false
paypal.sandbox…
and stripe.test…
keys are used.
You need a valid Merx license to use the plugin in production mode.
Type
boolean
Default
false
license
return [
'ww.merx.license' => 'MERX-XXXXXXXX-XXXXXXXX',
];
You need a valid license to make real purchases.
Type
string
cart.fields
Store page fields in the cart item.
Since 1.4.0
return [
'ww.merx.cart.fields' => ['sku', 'color'],
];
If additional fields of your product page (e.g. a sku field) should be stored in the item of the ProductList
or Cart
, you can use this option.
By default following values are stored in a ProductList
’s or Cart
’s item and are taken from the product page (if a valid id provided):
id
, title
, price
, taxRate
, template
, uid
Type
array
Default
[]
currency
Currency string.
return [
'ww.merx.currency' => 'GBP',
];
Used for Stripe Source and PayPal Payment.
Type
string
Default
EUR
currencySymbol
The Symbol of the desired currency.
return [
'ww.merx.currencySymbol' => '£',
];
Type
string
Default
€
currencyDecimalPoint
Used for formatPrice
helper method.
Overwrites decimal_point
of localeconv
return [
'ww.merx.currencyDecimalPoint' => ',', // e.g. 1234,56 €
];
Type
string
currencyThousandsSeparator
Used for formatPrice
helper method.
Overwrites thousands_sep
of localeconv
return [
'ww.merx.currencyThousandsSeparator' => '.', // e.g. 1.234,56 €
];
Type
string
currencyPositionPrecedes
Used for formatPrice
helper method.
Overwrites p_cs_precedes
of localeconv
return [
'ww.merx.currencyPositionPrecedes' => true, // e.g. €123.45
];
Type
bool
currencySeparateBySpace
Used for formatPrice
helper method.
Overwrites p_sep_by_space
of localeconv
return [
'ww.merx.currencySeparateBySpace' => true, // e.g. € 123.45
];
Type
bool
successPage
The page to be redirected after initializePayment
return [
'ww.merx.successPage' => 'complete-order',
];
Used as the cancel_url
and return_url
for PayPal Payment.
Used as the return_url
for Stripe Transaction.
Type
string
Default
success
ordersPage
The parent page of all order pages.
return [
'ww.merx.ordersPage' => 'all-the-orders',
];
Type
string
Default
orders
stripe.test.publishable_key
return [
'ww.merx.stripe.test.publishable_key' => 'pk_test_xxx…',
];
Type
string
stripe.test.secret_key
stripe.test.secret_key
return [
'ww.merx.stripe.test.secret_key' => 'sk_test_xxx…',
];
Type
string
stripe.live.publishable_key
return [
'ww.merx.stripe.live.publishable_key' => 'pk_live_xxx…',
];
Type
string
stripe.live.secret_key
return [
'ww.merx.stripe.live.secret_key' => 'sk_live_xxx…',
];
Type
string
stripe.webhook_signing_secret
return [
'ww.merx.stripe.webhook_signing_secret' => 'whsec_XXXXXXXXXXXXXXXXXXXXXXXXXXXX',
];
To update payment details for payment methods with delayed payment notifications (e.g. SEPA Direct Debit) you need to use Stripe Webhooks. This option is used to set the Stripe’s Webhook Signing Key
Type
string
paypal.sandbox.clientID
return [
'ww.merx.paypal.sandbox.clientID' => 'xxx…',
];
Type
string
paypal.sandbox.secret
return [
'ww.merx.paypal.sandbox.secret' => 'xxx…',
];
Type
string
paypal.live.clientID
return [
'ww.merx.paypal.live.clientID' => 'xxx…',
];
Type
string
paypal.live.secret
return [
'ww.merx.paypal.live.secret' => 'xxx…',
];
Type
string
paypal.applicationContext
Merges applicationContext on initializePayment.
return [
'ww.merx.paypal.applicationContext' => [
'brand_name' => 'Beautiful Clothes Shop',
],
];
Type
array
Default applicationContext
If this option is not set the following is set as the application context.
$applicationContext = [
'cancel_url' => url(option('ww.merx.successPage')),
'return_url' => url(option('ww.merx.successPage')),
'user_action' => 'PAY_NOW',
'shipping_preference' => 'NO_SHIPPING',
'brand_name' => (string)site()->title(),
];
paypal.purchaseUnits
Provide PayPal with additional information
site/config/config.php
return [
'ww.merx.paypal.purchaseUnits' => function() {
$cart = cart();
return $cart->payPalPurchaseUnits();
},
];
The array returned by this function is used as purchase_units
object of the PayPal’s Create order request. You can use the payPalPurchaseUnits
method of the Cart
class to get a formatted array of all items in the cart.
If you do not set this option, only the total amount of the shopping cart will be transferred to PayPal.
Type
function
Screenshot
If you have the following cart, the PayPal Checkout screen will look like this.
$cart = cart([
[
'id' => 'apple',
'title' => 'Apple',
'quantity' => 6,
'price' => 0.99,
],
[
'id' => 't-shirt',
'title' => 'T-Shirt',
'quantity' => 2,
'price' => 49.99,
]
]);
gateways
Custom payment gateways.
return [
'ww.merx.gateways' => [
'my-payment-provider' => [
'initializePayment' => function(OrderPage $virtualOrderPage): OrderPage
{
return $virtualOrderPage;
},
'completePayment' => function(OrderPage $virtualOrderPage): OrderPage
{
return $virtualOrderPage;
},
],
],
];
More information in the Custom Payment Gateways Cookbook
Type
array