Skip to content

Commit 49f5dec

Browse files
authored
Merge pull request #154 from academe/master
Document the billingForShipping option.
2 parents 6b42583 + e6e5abe commit 49f5dec

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

Diff for: README.md

+27-12
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,21 @@ $creditCard = new CreditCard([
317317
though *some* banks insist it is present and valid.
318318
* This gateway lives on an extended ASCII ISO 8859-1 back end.
319319
Really. Do any characterset conversions in your merchant site to avoid surprises.
320+
* Both billing and shipping name and address is required.
321+
However, you can use the `billingForShipping` flag to set the shipping details
322+
to what you supply as the billing details.
323+
324+
```php
325+
// Use the billing name and address for the shipping name and address too.
326+
$gateway->setBillingForShipping(true);
327+
328+
// or
329+
330+
$response = $gateway->authorize([
331+
'billingForShipping' => true,
332+
...
333+
]);
334+
```
320335

321336
```php
322337
// Create a unique transaction ID to track this transaction.
@@ -337,7 +352,7 @@ $surchargeXml = '<surcharges>'
337352
// Send the authorize request.
338353
// Some optional parameters are shown commented out.
339354

340-
$response = $gateway->authorize(array(
355+
$response = $gateway->authorize([
341356
'amount' => '9.99',
342357
'currency' => 'GBP',
343358
'card' => $card,
@@ -350,7 +365,7 @@ $response = $gateway->authorize(array(
350365
// 'token' => $token,
351366
// 'cardReference' => $cardReference,
352367
// 'useAuthenticate' => true,
353-
))->send();
368+
])->send();
354369

355370
If `useAuthenticate` is set, then the `authorize` will use the `AUTHENTICATE`/`AUTHORISE`
356371
method of reserving the transaction details.
@@ -460,16 +475,16 @@ The URL for the notification handler is set in the authorize or payment message:
460475

461476
$transactionId = {create a unique transaction id};
462477

463-
$items = array(
464-
array(
478+
$items = [
479+
[
465480
'name' => 'My Product Name',
466481
'description' => 'My Product Description',
467482
'quantity' => 1,
468483
'price' => 9.99,
469-
)
470-
);
484+
]
485+
];
471486

472-
$response = $gateway->purchase(array(
487+
$response = $gateway->purchase([
473488
'amount' => 9.99,
474489
'currency' => 'GBP',
475490
// Just the name and address, NOT CC details.
@@ -479,7 +494,7 @@ $response = $gateway->purchase(array(
479494
'transactionId' => $transactionId,
480495
'description' => 'test',
481496
'items' => $items,
482-
))->send();
497+
])->send();
483498

484499
// Before redirecting, save `$response->getSecurityKey()` in the database,
485500
// retrievable by `$transactionId`.
@@ -1004,15 +1019,15 @@ If you want to include VAT amount in the item array you must use
10041019
`\Omnipay\SagePay\Extend\Item` as follows.
10051020

10061021
```php
1007-
$items = array(
1008-
array(new \Omnipay\SagePay\Extend\Item(array(
1022+
$items = [
1023+
[new \Omnipay\SagePay\Extend\Item([
10091024
'name' => 'My Product Name',
10101025
'description' => 'My Product Description',
10111026
'quantity' => 1,
10121027
'price' => 9.99,
10131028
'vat' => 1.665, // VAT amount, not percentage
1014-
))
1015-
);
1029+
]]
1030+
];
10161031
```
10171032

10181033
# Support

0 commit comments

Comments
 (0)