Skip to content

Commit 097f008

Browse files
authored
Merge pull request #54 from AltaPay/support-new-parameters
Support extra_merchant_data and AuthorisationExpiryDate
2 parents d8f9b39 + f9d8326 commit 097f008

File tree

6 files changed

+38
-3
lines changed

6 files changed

+38
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [3.4.9] - 2025-04-22
8+
### Added
9+
- Provide `setCustomerCreatedDate` method to set `extra_merchant_data` for the `createPaymentRequest` callback config.
10+
- Include `AuthorisationExpiryDate` in `Transaction` class.
11+
712
## [3.4.8] - 2025-03-13
813
### Added
914
- Provide `setClientJavaEnabled` and `setClientColorDepth` methods to set `customer_info[client_java_enabled]` and `customer_info[client_color_depth]` for the customer object.

docs/ecommerce/payment_request.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Because this call does not happen in the browser, you do not need to worry about
1010
* [Example](#example)
1111
+ [Optional](#optional)
1212
* [Optional parameters for invoice payments](#optional-parameters-for-invoice-payments)
13+
* [Extra merchant data](#extra-merchant-data)
1314
+ [Required on specific payments](#required-on-specific-payments)
1415
* [Mandatory parameters if MCC is 6012](#mandatory-parameters-if-mcc-is-6012)
1516
* [Mandatory parameters for invoice payments](#mandatory-parameters-for-invoice-payments)
@@ -73,8 +74,10 @@ $request->setCurrency('SEK');
7374
| setCookie(string) | Additionally a cookie parameter can be sent to createPaymentRequest, which is then passed back as the complete cookie for the callbacks.<br />For example, if the cookie parameter is set to: "PHPSESSID=asdfasdfdf23; mycookie=mycookievalue", the Cookie header in the callback to your page will be:<br />Cookie: PHPSESSID=asdfasdfdf23; mycookie=mycookievalue | string
7475
| setPaymentSource(string) | The source of the payment. Default is "eCommerce" | string - [See Payment sources](../types/paymentsources.md)
7576
| setCustomerInfo(Customer) | Customer info | Customer object [See customer info](../request/customerinfo.md) |
77+
| setCustomerCreatedDate(Date) | This is the date when the customer account was first created in your shopping system. Fraud detection services use this parameter in the fraud detection calculations. | Date (yyyy-mm-dd)
7678
| setConfig(Config) | used to overwrite the terminal settings | Config object [See config](../request/config.md)
77-
| orderLines(array or OrderLine) | Order lines | array of OrderLine objects - [See OrderLine](../request/orderline.md)
79+
| setOrderLines(array) | Order lines | array of OrderLine objects - [See OrderLine](../request/orderline.md)
80+
| setAgreement(array) | This parameters should be provided only in case the type parameter is subscription, subscriptionAndCharge or subscriptionAndReserve | array
7881

7982
##### Optional parameters for invoice payments
8083

@@ -83,6 +86,12 @@ $request->setCurrency('SEK');
8386
| setOrganisationNumber(string) | If the organisation_number parameter is given the organisation number field in the invoice payment form is pre-populated, and if no other payment options is enabled on the terminal the form will auto submit. | string
8487
| setAccountOffer(string) | To require having account enabled for an invoice payment for this specific customer, set this to required. To disable account for this specific customer, set to disabled. | string
8588

89+
##### Extra merchant data
90+
91+
| Method | Description | Type |
92+
|---|---|---|
93+
| setExtraMerchantData(JSON) | Additional merchant provided information that will be passed to Klarna. Field has to be sent as JSON object specified in [Klarna docs](https://docs.klarna.com/api/extra-merchant-data/)| JSON ([Schema](https://docs.klarna.com/api/extra-merchant-data.json))
94+
8695
### Required on specific payments
8796

8897
##### Mandatory parameters if MCC is 6012

docs/types/transaction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
| `$object->UpdatedDate` | | DateTime
3737
| `$object->PaymentNature` | | string
3838
| `$object->PaymentSchemeName` | | string
39+
| `$object->AuthorisationExpiryDate` | | DateTime
3940
| `$object->PaymentSource` | | string
4041
| `$object->PaymentNatureService` | array of `\Altapay\Response\Embeds\PaymentNatureService` objects | array
4142
| `$object->FraudRiskScore` | | float

src/AbstractApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ abstract class AbstractApi
5555
/**
5656
* PHP API version
5757
*/
58-
const PHP_API_VERSION = '3.4.8';
58+
const PHP_API_VERSION = '3.4.9';
5959

6060
/**
6161
* Event dispatcher

src/Api/Ecommerce/PaymentRequest.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,20 @@ public function setCustomerCreatedDate($customerCreatedDate)
257257
return $this;
258258
}
259259

260+
/**
261+
* Additional merchant provided information that will be passed to Klarna.
262+
*
263+
* @param string $extraMerchantData // JSON-encoded string
264+
*
265+
* @return $this
266+
*/
267+
public function setExtraMerchantData($extraMerchantData)
268+
{
269+
$this->unresolvedOptions['extra_merchant_data'] = $extraMerchantData;
270+
271+
return $this;
272+
}
273+
260274
/**
261275
* Configure options
262276
*
@@ -285,7 +299,8 @@ protected function configureOptions(OptionsResolver $resolver)
285299
'shipping_method',
286300
'organisation_number',
287301
'account_offer',
288-
'orderLines'
302+
'orderLines',
303+
'extra_merchant_data'
289304
]);
290305

291306
$resolver->setAllowedValues('language', Types\LanguageTypes::getAllowed());

src/Response/Embeds/Transaction.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@ class Transaction extends AbstractResponse
294294
*/
295295
public $AuthenticationResult;
296296

297+
/**
298+
* @var DateTime
299+
*/
300+
public $AuthorisationExpiryDate;
301+
297302
/**
298303
* @param string $IsTokenized
299304
*

0 commit comments

Comments
 (0)