Mollie Payments for WooCommerce - Version 5.0.4

Version Description

  • 08-11-2018 =

IMPORTANT This version requires PHP 5.6 or higher. If you are using an older PHP version, please read this article: PHP & Mollie API v2.

  • Fix - Get test mode higher in scheduled_subscription_payment() process
  • Fix - Add automated option to restore a customer ID from Mollie API
  • Fix - Store sequenceType in the correct position for payments
Download this release

Release Info

Developer davdebcom
Plugin Icon wp plugin Mollie Payments for WooCommerce
Version 5.0.4
Comparing to
See all releases

Code changes from version 5.0.3 to 5.0.4

Files changed (64) hide show
  1. includes/mollie-api-php/README.md +5 -5
  2. includes/mollie-api-php/composer.json +3 -0
  3. includes/mollie-api-php/examples/03-return-page.php +0 -35
  4. includes/mollie-api-php/examples/22-create-mandate-subscription.php +0 -55
  5. includes/mollie-api-php/examples/{38-retrieve-capture.php → captures/get-capture.php} +2 -2
  6. includes/mollie-api-php/examples/{39-list-payment-captures.php → captures/list-captures.php} +2 -2
  7. includes/mollie-api-php/examples/{14-recurring-first-payment.php → customers/create-customer-first-payment.php} +8 -18
  8. includes/mollie-api-php/examples/{12-new-customer-payment.php → customers/create-customer-payment.php} +8 -19
  9. includes/mollie-api-php/examples/{15-recurring-payment.php → customers/create-customer-recurring-payment.php} +6 -16
  10. includes/mollie-api-php/examples/{11-new-customer.php → customers/create-customer.php} +7 -6
  11. includes/mollie-api-php/examples/{23-delete-customer.php → customers/delete-customer.php} +5 -5
  12. includes/mollie-api-php/examples/{13-customer-payments-history.php → customers/list-customer-payments.php} +4 -4
  13. includes/mollie-api-php/examples/{18-update-customer.php → customers/update-customer.php} +4 -2
  14. includes/mollie-api-php/examples/functions.php +23 -0
  15. includes/mollie-api-php/examples/initialize.php +1 -0
  16. includes/mollie-api-php/examples/initialize_with_oauth.php +1 -0
  17. includes/mollie-api-php/examples/{20-list-invoices.php → invoices/list-invoices.php} +2 -2
  18. includes/mollie-api-php/examples/mandates/create-mandate.php +30 -0
  19. includes/mollie-api-php/examples/mandates/list-mandates.php +28 -0
  20. includes/mollie-api-php/examples/{24-revoke-mandate.php → mandates/revoke-mandate.php} +3 -3
  21. includes/mollie-api-php/examples/orders/.gitignore +0 -1
  22. includes/mollie-api-php/examples/{30-cancel-order-line.php → orders/cancel-order-lines.php} +6 -5
  23. includes/mollie-api-php/examples/{28-cancel-order.php → orders/cancel-order.php} +2 -2
  24. includes/mollie-api-php/examples/{26-new-order.php → orders/create-order.php} +20 -8
  25. includes/mollie-api-php/examples/orders/list-methods.php +28 -0
  26. includes/mollie-api-php/examples/{29-list-orders.php → orders/list-orders.php} +2 -2
  27. includes/mollie-api-php/examples/{35-refund-order-completely.php → orders/refund-order-completely.php} +2 -2
  28. includes/mollie-api-php/examples/{36-refund-order-partially.php → orders/refund-order-partially.php} +2 -2
  29. includes/mollie-api-php/examples/{27-handle-order-status-change.php → orders/webhook.php} +25 -9
  30. includes/mollie-api-php/examples/{04-ideal-payment.php → payments/create-ideal-payment.php} +5 -17
  31. includes/mollie-api-php/examples/{10-oauth-new-payment.php → payments/create-payment-oauth.php} +14 -23
  32. includes/mollie-api-php/examples/{01-new-payment.php → payments/create-payment.php} +4 -15
  33. includes/mollie-api-php/examples/{06-list-activated-methods.php → payments/list-methods.php} +4 -2
  34. includes/mollie-api-php/examples/{05-payments-history.php → payments/list-payments.php} +4 -4
  35. includes/mollie-api-php/examples/{07-refund-payment.php → payments/refund-payment.php} +5 -5
  36. includes/mollie-api-php/examples/payments/return.php +29 -0
  37. includes/mollie-api-php/examples/{02-webhook-verification.php → payments/webhook.php} +3 -14
  38. includes/mollie-api-php/examples/profiles/create-profile.php +30 -0
  39. includes/mollie-api-php/examples/profiles/delete-profile.php +23 -0
  40. includes/mollie-api-php/examples/{08-oauth-list-profiles.php → profiles/list-profiles.php} +3 -2
  41. includes/mollie-api-php/examples/{19-update-profile.php → profiles/update-profile.php} +4 -2
  42. includes/mollie-api-php/examples/{09-oauth-list-settlements.php → settlements/list-settlements.php} +3 -2
  43. includes/mollie-api-php/examples/{31-ship-order-completely.php → shipments/create-shipment-all.php} +3 -3
  44. includes/mollie-api-php/examples/{32-ship-order-partially.php → shipments/create-shipment-partial.php} +0 -0
  45. includes/mollie-api-php/examples/{33-get-shipment.php → shipments/get-shipment.php} +2 -2
  46. includes/mollie-api-php/examples/{34-list-order-shipments.php → shipments/list-shipments.php} +2 -2
  47. includes/mollie-api-php/examples/{37-update-shipment-tracking.php → shipments/update-shipment.php} +2 -2
  48. includes/mollie-api-php/examples/{17-cancel-subscription.php → subscriptions/cancel-subscription.php} +9 -6
  49. includes/mollie-api-php/examples/{16-recurring-subscription.php → subscriptions/create-subscription.php} +15 -9
  50. includes/mollie-api-php/examples/{25-update-subscription.php → subscriptions/update-subscription.php} +3 -7
  51. includes/mollie-api-php/src/MollieApiClient.php +1 -1
  52. includes/mollie-api-php/src/Resources/Customer.php +18 -1
  53. includes/mollie-api-php/src/Resources/Order.php +31 -0
  54. includes/mollie-api-php/src/Resources/Settlement.php +22 -0
  55. includes/mollie-api-php/vendor/autoload.php +1 -1
  56. includes/mollie-api-php/vendor/composer/autoload_real.php +7 -7
  57. includes/mollie-api-php/vendor/composer/autoload_static.php +3 -3
  58. includes/mollie/wc/gateway/abstract.php +2 -2
  59. includes/mollie/wc/gateway/abstractsubscription.php +163 -52
  60. includes/mollie/wc/payment/order.php +29 -2
  61. includes/mollie/wc/payment/payment.php +25 -4
  62. includes/mollie/wc/plugin.php +1 -1
  63. mollie-payments-for-woocommerce.php +1 -1
  64. readme.txt +10 -1
includes/mollie-api-php/README.md CHANGED
@@ -83,7 +83,7 @@ header("Location: " . $payment->getCheckoutUrl(), true, 303);
83
  ```
84
  _This header location should always be a GET, thus we enforce 303 http response code_
85
 
86
- For a payment create example, see [Example 1 - New Payment](https://github.com/mollie/mollie-api-php/blob/master/examples/01-new-payment.php).
87
 
88
  ## Retrieving payments ##
89
  We can use the `$payment->id` to retrieve a payment and check if the payment `isPaid`.
@@ -103,12 +103,12 @@ Or retrieve a collection of payments.
103
  $payments = $mollie->payments->page();
104
  ```
105
 
106
- For an extensive example of listing payments with the details and status, see [Example 5 - Payments History](https://github.com/mollie/mollie-api-php/blob/master/examples/05-payments-history.php).
107
 
108
  ## Payment webhook ##
109
 
110
  When the status of a payment changes the `webhookUrl` we specified in the creation of the payment will be called.
111
- There we can use the `id` from our POST parameters to check te status and act upon that, see [Example 2 - Webhook verification](https://github.com/mollie/mollie-api-php/blob/master/examples/02-webhook-verification.php).
112
 
113
 
114
  ## Multicurrency ##
@@ -142,7 +142,7 @@ $method = $mollie->methods->get(\Mollie\Api\Types\PaymentMethod::IDEAL, ["includ
142
  ```
143
 
144
  _`$method->issuers` will be a list of objects. Use the property `$id` of this object in the
145
- API call, and the property `$name` for displaying the issuer to your customer. For a more in-depth example, see [Example 4 - iDEAL payment](https://github.com/mollie/mollie-api-php/blob/master/examples/04-ideal-payment.php)._
146
 
147
  Create a payment with the selected issuer:
148
 
@@ -181,7 +181,7 @@ $refund = $payment->refund([
181
  ]);
182
  ```
183
 
184
- For a working example, see [Example 7 - Refund payment](https://github.com/mollie/mollie-api-php/blob/master/examples/07-refund-payment.php).
185
 
186
  ## API documentation ##
187
  If you wish to learn more about our API, please visit the [Mollie Developer Portal](https://www.mollie.com/en/developers). API Documentation is available in English.
83
  ```
84
  _This header location should always be a GET, thus we enforce 303 http response code_
85
 
86
+ For a payment create example, see [Example - New Payment](https://github.com/mollie/mollie-api-php/blob/master/examples/payments/create-payment.php).
87
 
88
  ## Retrieving payments ##
89
  We can use the `$payment->id` to retrieve a payment and check if the payment `isPaid`.
103
  $payments = $mollie->payments->page();
104
  ```
105
 
106
+ For an extensive example of listing payments with the details and status, see [Example - List Payments](https://github.com/mollie/mollie-api-php/blob/master/examples/payments/list-payments.php).
107
 
108
  ## Payment webhook ##
109
 
110
  When the status of a payment changes the `webhookUrl` we specified in the creation of the payment will be called.
111
+ There we can use the `id` from our POST parameters to check te status and act upon that, see [Example - Webhook](https://github.com/mollie/mollie-api-php/blob/master/examples/payments/webhook.php).
112
 
113
 
114
  ## Multicurrency ##
142
  ```
143
 
144
  _`$method->issuers` will be a list of objects. Use the property `$id` of this object in the
145
+ API call, and the property `$name` for displaying the issuer to your customer. For a more in-depth example, see [Example - iDEAL payment](https://github.com/mollie/mollie-api-php/blob/master/examples/payments/create-ideal-payment.php)._
146
 
147
  Create a payment with the selected issuer:
148
 
181
  ]);
182
  ```
183
 
184
+ For a working example, see [Example - Refund payment](https://github.com/mollie/mollie-api-php/blob/master/examples/payments/refund-payment.php).
185
 
186
  ## API documentation ##
187
  If you wish to learn more about our API, please visit the [Mollie Developer Portal](https://www.mollie.com/en/developers). API Documentation is available in English.
includes/mollie-api-php/composer.json CHANGED
@@ -72,5 +72,8 @@
72
  "psr-4": {
73
  "Tests\\": "tests"
74
  }
 
 
 
75
  }
76
  }
72
  "psr-4": {
73
  "Tests\\": "tests"
74
  }
75
+ },
76
+ "scripts": {
77
+ "test": "./vendor/bin/phpunit tests"
78
  }
79
  }
includes/mollie-api-php/examples/03-return-page.php DELETED
@@ -1,35 +0,0 @@
1
- <?php
2
- /*
3
- * Example 3 - How to show a return page to the customer.
4
- *
5
- * In this example we retrieve the order stored in the database.
6
- * Here, it's unnecessary to use the Mollie API Client.
7
- */
8
- $status = database_read($_GET["order_id"]);
9
-
10
- /*
11
- * Determine the url parts to these example files.
12
- */
13
- $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http";
14
- $hostname = $_SERVER['HTTP_HOST'];
15
- $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
16
-
17
- echo "<p>Your payment status is '" . htmlspecialchars($status) . "'.</p>";
18
- echo "<p>";
19
- echo '<a href="' . $protocol . '://' . $hostname . $path . '/01-new-payment.php">Create payment with example 1</a><br>';
20
- echo '<a href="' . $protocol . '://' . $hostname . $path . '/04-ideal-payment.php">Create iDEAL payment with example 4</a><br>';
21
- echo '<a href="' . $protocol . '://' . $hostname . $path . '/05-payments-history.php">List payments with example 5</a><br>';
22
- echo "</p>";
23
-
24
- /*
25
- * NOTE: This example uses a text file as a database. Please use a real database like MySQL in production code.
26
- */
27
- function database_read($orderId)
28
- {
29
- $orderId = intval($orderId);
30
- $database = dirname(__FILE__) . "/orders/order-{$orderId}.txt";
31
-
32
- $status = @file_get_contents($database);
33
-
34
- return $status ? $status : "unknown order";
35
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/mollie-api-php/examples/22-create-mandate-subscription.php DELETED
@@ -1,55 +0,0 @@
1
- <?php
2
- /*
3
- * Example 22 - Create a customer, mandate and subscription via the Mollie API.
4
- */
5
-
6
- try {
7
- /*
8
- * Initialize the Mollie API library with your API key or OAuth access token.
9
- */
10
- require "initialize.php";
11
-
12
- /*
13
- * Customer creation parameters.
14
- *
15
- * See: https://docs.mollie.com/reference/v2/customers-api/create-customer
16
- */
17
- $customer = $mollie->customers->create([
18
- "name" => 'Example name',
19
- "email" => 'info@example.com',
20
- ]);
21
-
22
- echo "<p>Customer created with id " . $customer->id . "</p>";
23
-
24
- $mandate = $customer->createMandate([
25
- "method" => \Mollie\Api\Types\MandateMethod::DIRECTDEBIT,
26
- "consumerAccount" => 'NL34ABNA0243341423',
27
- "consumerName" => 'B. A. Example',
28
- ]);
29
-
30
- echo "<p>Mandate created with id " . $mandate->id . "</p>";
31
-
32
- /*
33
- * Generate a unique subscription id for this example. It is important to include this unique attribute
34
- * in the webhookUrl (below) so new payments can be associated with this subscription.
35
- */
36
- $subscriptionId = time();
37
-
38
- $subscription = $customer->createSubscription([
39
- "amount" => [
40
- "value" => "10.00", // You must send the correct number of decimals, thus we enforce the use of strings
41
- "currency" => "EUR"
42
- ],
43
- "times" => 12, // recurring membership for 1 year
44
- "interval" => "1 months", // every month
45
- "description" => "Subscription #{$subscriptionId}",
46
- "webhookUrl" => "https://example.com/webhook.php?subscription_id={$subscriptionId}",
47
- "metadata" => [
48
- "subscription_id" => $subscriptionId,
49
- ],
50
- ]);
51
-
52
- echo "<p>Subscription created with id " . $subscription->id . "</p>";
53
- } catch (\Mollie\Api\Exceptions\ApiException $e) {
54
- echo "API call failed: " . htmlspecialchars($e->getMessage());
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/mollie-api-php/examples/{38-retrieve-capture.php → captures/get-capture.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 38 - Retrieve a payment capture using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * Retrieve a capture with ID 'cpt_4qqhO89gsT' for payment with
1
  <?php
2
  /*
3
+ * Retrieve a payment capture using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Retrieve a capture with ID 'cpt_4qqhO89gsT' for payment with
includes/mollie-api-php/examples/{39-list-payment-captures.php → captures/list-captures.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 39 - List captures for a payment using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * List captures for payment with ID 'tr_WDqYK6vllg'.
1
  <?php
2
  /*
3
+ * List captures for a payment using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * List captures for payment with ID 'tr_WDqYK6vllg'.
includes/mollie-api-php/examples/{14-recurring-first-payment.php → customers/create-customer-first-payment.php} RENAMED
@@ -1,17 +1,17 @@
1
  <?php
2
  /*
3
- * Example 14 - How to create a first payment to allow recurring payments later.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "initialize.php";
11
 
12
  /*
13
  * Retrieve the last created customer for this example.
14
- * If no customers are created yet, run example 11.
15
  */
16
  $customer = $mollie->customers->page(null, 1)[0];
17
 
@@ -28,10 +28,10 @@ try {
28
  $hostname = $_SERVER['HTTP_HOST'];
29
  $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
30
 
31
- /*
32
  * Customer Payment creation parameters.
33
  *
34
- * See: https://docs.mollie.com/reference/v2/customers-api/create-customer-payment
35
  */
36
  $payment = $customer->createPayment([
37
  "amount" => [
@@ -39,8 +39,8 @@ try {
39
  "currency" => "EUR"
40
  ],
41
  "description" => "First payment - Order #{$orderId}",
42
- "redirectUrl" => "{$protocol}://{$hostname}{$path}/03-return-page.php?order_id={$orderId}",
43
- "webhookUrl" => "{$protocol}://{$hostname}{$path}/02-webhook-verification.php",
44
  "metadata" => [
45
  "order_id" => $orderId,
46
  ],
@@ -64,14 +64,4 @@ try {
64
  header("Location: " . $payment->getCheckoutUrl(), true, 303);
65
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
66
  echo "API call failed: " . htmlspecialchars($e->getMessage());
67
- }
68
-
69
- /*
70
- * NOTE: This example uses a text file as a database. Please use a real database like MySQL in production code.
71
- */
72
- function database_write($orderId, $status)
73
- {
74
- $orderId = intval($orderId);
75
- $database = dirname(__FILE__) . "/orders/order-{$orderId}.txt";
76
- file_put_contents($database, $status);
77
- }
1
  <?php
2
  /*
3
+ * How to create a first payment to allow recurring payments later.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Retrieve the last created customer for this example.
14
+ * If no customers are created yet, run the create-customer example.
15
  */
16
  $customer = $mollie->customers->page(null, 1)[0];
17
 
28
  $hostname = $_SERVER['HTTP_HOST'];
29
  $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
30
 
31
+ /**
32
  * Customer Payment creation parameters.
33
  *
34
+ * @See: https://docs.mollie.com/reference/v2/customers-api/create-customer-payment
35
  */
36
  $payment = $customer->createPayment([
37
  "amount" => [
39
  "currency" => "EUR"
40
  ],
41
  "description" => "First payment - Order #{$orderId}",
42
+ "redirectUrl" => "{$protocol}://{$hostname}{$path}/payments/return.php?order_id={$orderId}",
43
+ "webhookUrl" => "{$protocol}://{$hostname}{$path}/payments/webhook.php",
44
  "metadata" => [
45
  "order_id" => $orderId,
46
  ],
64
  header("Location: " . $payment->getCheckoutUrl(), true, 303);
65
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
66
  echo "API call failed: " . htmlspecialchars($e->getMessage());
67
+ }
 
 
 
 
 
 
 
 
 
 
includes/mollie-api-php/examples/{12-new-customer-payment.php → customers/create-customer-payment.php} RENAMED
@@ -1,17 +1,17 @@
1
  <?php
2
  /*
3
- * Example 12 - How to create a new customer in the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "initialize.php";
11
 
12
  /*
13
  * Retrieve the last created customer for this example.
14
- * If no customers are created yet, run example 11.
15
  */
16
  $customer = $mollie->customers->page(null, 1)[0];
17
 
@@ -28,11 +28,10 @@ try {
28
  $hostname = $_SERVER['HTTP_HOST'];
29
  $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
30
 
31
- /*
32
- * Customer Payment creation parameters.
33
  *
34
- * Linking customers to payments has a few benefits, see:
35
- * https://docs.mollie.com/reference/v2/customers-api/create-customer-payment
36
  */
37
  $payment = $customer->createPayment([
38
  "amount" => [
@@ -40,8 +39,8 @@ try {
40
  "currency" => "EUR"
41
  ],
42
  "description" => "Order #{$orderId}",
43
- "redirectUrl" => "{$protocol}://{$hostname}{$path}/03-return-page.php?order_id={$orderId}",
44
- "webhookUrl" => "{$protocol}://{$hostname}{$path}/02-webhook-verification.php",
45
  "metadata" => [
46
  "order_id" => $orderId,
47
  ]
@@ -60,13 +59,3 @@ try {
60
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
61
  echo "API call failed: " . htmlspecialchars($e->getMessage());
62
  }
63
-
64
- /*
65
- * NOTE: This example uses a text file as a database. Please use a real database like MySQL in production code.
66
- */
67
- function database_write($orderId, $status)
68
- {
69
- $orderId = intval($orderId);
70
- $database = dirname(__FILE__) . "/orders/order-{$orderId}.txt";
71
- file_put_contents($database, $status);
72
- }
1
  <?php
2
  /*
3
+ * How to create a new customer in the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Retrieve the last created customer for this example.
14
+ * If no customers are created yet, run create-customer example.
15
  */
16
  $customer = $mollie->customers->page(null, 1)[0];
17
 
28
  $hostname = $_SERVER['HTTP_HOST'];
29
  $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
30
 
31
+ /**
32
+ * Linking customers to payments has a few benefits
33
  *
34
+ * @see https://docs.mollie.com/reference/v2/customers-api/create-customer-payment
 
35
  */
36
  $payment = $customer->createPayment([
37
  "amount" => [
39
  "currency" => "EUR"
40
  ],
41
  "description" => "Order #{$orderId}",
42
+ "redirectUrl" => "{$protocol}://{$hostname}{$path}/payments/return.php?order_id={$orderId}",
43
+ "webhookUrl" => "{$protocol}://{$hostname}{$path}/payments/webhook.php",
44
  "metadata" => [
45
  "order_id" => $orderId,
46
  ]
59
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
60
  echo "API call failed: " . htmlspecialchars($e->getMessage());
61
  }
 
 
 
 
 
 
 
 
 
 
includes/mollie-api-php/examples/{15-recurring-payment.php → customers/create-customer-recurring-payment.php} RENAMED
@@ -1,17 +1,17 @@
1
  <?php
2
  /*
3
- * Example 15 - How to create an on-demand recurring payment.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "initialize.php";
11
 
12
  /*
13
  * Retrieve the last created customer for this example.
14
- * If no customers are created yet, run example 11.
15
  */
16
  $customer = $mollie->customers->page(null, 1)[0];
17
 
@@ -27,10 +27,10 @@ try {
27
  $hostname = $_SERVER['HTTP_HOST'];
28
  $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
29
 
30
- /*
31
  * Customer Payment creation parameters.
32
  *
33
- * See: https://docs.mollie.com/reference/v2/customers-api/create-customer-payment
34
  */
35
  $payment = $customer->createPayment([
36
  "amount" => [
@@ -38,7 +38,7 @@ try {
38
  "currency" => "EUR"
39
  ],
40
  "description" => "On-demand payment - Order #{$orderId}",
41
- "webhookUrl" => "{$protocol}://{$hostname}{$path}/02-webhook-verification.php",
42
  "metadata" => [
43
  "order_id" => $orderId,
44
  ],
@@ -61,13 +61,3 @@ try {
61
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
62
  echo "API call failed: " . htmlspecialchars($e->getMessage());
63
  }
64
-
65
- /*
66
- * NOTE: This example uses a text file as a database. Please use a real database like MySQL in production code.
67
- */
68
- function database_write($orderId, $status)
69
- {
70
- $orderId = intval($orderId);
71
- $database = dirname(__FILE__) . "/orders/order-{$orderId}.txt";
72
- file_put_contents($database, $status);
73
- }
1
  <?php
2
  /*
3
+ * How to create an on-demand recurring payment.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Retrieve the last created customer for this example.
14
+ * If no customers are created yet, run the create-customer example.
15
  */
16
  $customer = $mollie->customers->page(null, 1)[0];
17
 
27
  $hostname = $_SERVER['HTTP_HOST'];
28
  $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
29
 
30
+ /**
31
  * Customer Payment creation parameters.
32
  *
33
+ * @See: https://docs.mollie.com/reference/v2/customers-api/create-customer-payment
34
  */
35
  $payment = $customer->createPayment([
36
  "amount" => [
38
  "currency" => "EUR"
39
  ],
40
  "description" => "On-demand payment - Order #{$orderId}",
41
+ "webhookUrl" => "{$protocol}://{$hostname}{$path}/payments/webhook.php",
42
  "metadata" => [
43
  "order_id" => $orderId,
44
  ],
61
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
62
  echo "API call failed: " . htmlspecialchars($e->getMessage());
63
  }
 
 
 
 
 
 
 
 
 
 
includes/mollie-api-php/examples/{11-new-customer.php → customers/create-customer.php} RENAMED
@@ -1,24 +1,25 @@
1
  <?php
2
  /*
3
- * Example 11 - How to create a new customer in the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
- /*
 
12
  * Customer creation parameters.
13
  *
14
- * See: https://docs.mollie.com/reference/v2/customers-api/create-customer
15
  */
16
  $customer = $mollie->customers->create([
17
  "name" => "Luke Skywalker",
18
  "email" => "luke@example.org",
19
- "metadata" => array(
20
  "isJedi" => TRUE,
21
- ),
22
  ]);
23
  echo "<p>New customer created " . htmlspecialchars($customer->id) . " (" . htmlspecialchars($customer->name) . ").</p>";
24
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
1
  <?php
2
  /*
3
+ * How to create a new customer in the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
+
12
+ /**
13
  * Customer creation parameters.
14
  *
15
+ * @See https://docs.mollie.com/reference/v2/customers-api/create-customer
16
  */
17
  $customer = $mollie->customers->create([
18
  "name" => "Luke Skywalker",
19
  "email" => "luke@example.org",
20
+ "metadata" => [
21
  "isJedi" => TRUE,
22
+ ],
23
  ]);
24
  echo "<p>New customer created " . htmlspecialchars($customer->id) . " (" . htmlspecialchars($customer->name) . ").</p>";
25
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
includes/mollie-api-php/examples/{23-delete-customer.php → customers/delete-customer.php} RENAMED
@@ -1,16 +1,16 @@
1
  <?php
2
  /*
3
- Example 23 - Delete a customer from mollie api.
4
- */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "initialize.php";
11
 
12
- $mollie->customers->delete("customer_id");
13
- echo "Customer deleted!";
14
 
15
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
16
  echo "API call failed: " . htmlspecialchars($e->getMessage());
1
  <?php
2
  /*
3
+ * Delete a customer from the Mollie API.
4
+ */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
+ $mollie->customers->delete("cst_fE3F6nvX");
13
+ echo "<p>Customer deleted!</p>";
14
 
15
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
16
  echo "API call failed: " . htmlspecialchars($e->getMessage());
includes/mollie-api-php/examples/{13-customer-payments-history.php → customers/list-customer-payments.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- * Example 13 - How to retrieve your customers' payments history.
4
  */
5
 
6
  try {
@@ -9,7 +9,7 @@ try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
- require "initialize.php";
13
 
14
  /*
15
  * Determine the url parts to these example files.
@@ -20,7 +20,7 @@ try {
20
 
21
  /*
22
  * Retrieve the last created customer for this example.
23
- * If no customers are created yet, run example 11.
24
  */
25
  $customer = $mollie->customers->page(null, 1)[0];
26
 
@@ -47,7 +47,7 @@ try {
47
  }
48
 
49
  if ($payment->canBeRefunded() && $payment->amountRemaining->currency === 'EUR' && $payment->amountRemaining->value >= '2.00') {
50
- echo " (<a href=\"{$protocol}://{$hostname}{$path}/07-refund-payment.php?payment_id=" . htmlspecialchars($payment->id) . "\">refund</a>)";
51
  }
52
 
53
  echo "</li>";
1
  <?php
2
  /*
3
+ * How to retrieve your customers' payments history.
4
  */
5
 
6
  try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
+ require "../initialize.php";
13
 
14
  /*
15
  * Determine the url parts to these example files.
20
 
21
  /*
22
  * Retrieve the last created customer for this example.
23
+ * If no customers are created yet, run create-customer example.
24
  */
25
  $customer = $mollie->customers->page(null, 1)[0];
26
 
47
  }
48
 
49
  if ($payment->canBeRefunded() && $payment->amountRemaining->currency === 'EUR' && $payment->amountRemaining->value >= '2.00') {
50
+ echo " (<a href=\"{$protocol}://{$hostname}{$path}/payments/refund-payment.php?payment_id=" . htmlspecialchars($payment->id) . "\">refund</a>)";
51
  }
52
 
53
  echo "</li>";
includes/mollie-api-php/examples/{18-update-customer.php → customers/update-customer.php} RENAMED
@@ -1,17 +1,19 @@
1
  <?php
2
  /*
3
- * Example 18 - Updating an existing customer via the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
 
11
  /*
12
  * Retrieve an existing customer by his customerId
13
  */
14
  $customer = $mollie->customers->get("cst_cUe8HjeBuz");
 
15
  /**
16
  * Customer fields that can be updated.
17
  *
1
  <?php
2
  /*
3
+ * Updating an existing customer via the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
+
12
  /*
13
  * Retrieve an existing customer by his customerId
14
  */
15
  $customer = $mollie->customers->get("cst_cUe8HjeBuz");
16
+
17
  /**
18
  * Customer fields that can be updated.
19
  *
includes/mollie-api-php/examples/functions.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * NOTE: The examples are using a text file as a database.
4
+ * Please use a real database like MySQL in production code.
5
+ */
6
+
7
+ function database_read($orderId)
8
+ {
9
+ $orderId = intval($orderId);
10
+ $database = dirname(__FILE__) . "/database/order-{$orderId}.txt";
11
+
12
+ $status = @file_get_contents($database);
13
+
14
+ return $status ? $status : "unknown order";
15
+ }
16
+
17
+ function database_write($orderId, $status)
18
+ {
19
+ $orderId = intval($orderId);
20
+ $database = dirname(__FILE__) . "/database/order-{$orderId}.txt";
21
+
22
+ file_put_contents($database, $status);
23
+ }
includes/mollie-api-php/examples/initialize.php CHANGED
@@ -7,6 +7,7 @@ ini_set('display_startup_errors', 1);
7
  error_reporting(E_ALL);
8
 
9
  require_once __DIR__ . "/../vendor/autoload.php";
 
10
 
11
  /*
12
  * Initialize the Mollie API library with your API key.
7
  error_reporting(E_ALL);
8
 
9
  require_once __DIR__ . "/../vendor/autoload.php";
10
+ require_once __DIR__ . "/functions.php";
11
 
12
  /*
13
  * Initialize the Mollie API library with your API key.
includes/mollie-api-php/examples/initialize_with_oauth.php CHANGED
@@ -8,6 +8,7 @@ ini_set('display_startup_errors', 1);
8
  error_reporting(E_ALL);
9
 
10
  require_once __DIR__ . "/../vendor/autoload.php";
 
11
 
12
  /*
13
  * Initialize the Mollie API library with OAuth.
8
  error_reporting(E_ALL);
9
 
10
  require_once __DIR__ . "/../vendor/autoload.php";
11
+ require_once __DIR__ . "/functions.php";
12
 
13
  /*
14
  * Initialize the Mollie API library with OAuth.
includes/mollie-api-php/examples/{20-list-invoices.php → invoices/list-invoices.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 22 - Create a customer, mandate and subscription via the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "initialize_with_oauth.php";
11
 
12
  /*
13
  * Get all the activated methods for this API key.
1
  <?php
2
  /*
3
+ * List the Mollie invoices.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize_with_oauth.php";
11
 
12
  /*
13
  * Get all the activated methods for this API key.
includes/mollie-api-php/examples/mandates/create-mandate.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Create a customer mandate via the Mollie API.
4
+ */
5
+
6
+ try {
7
+ /*
8
+ * Initialize the Mollie API library with your API key or OAuth access token.
9
+ */
10
+ require "../initialize.php";
11
+
12
+ /*
13
+ * Retrieve the last created customer for this example.
14
+ * If no customers are created yet, run create-customer example.
15
+ */
16
+ $customer = $mollie->customers->page(null, 1)[0];
17
+
18
+ /*
19
+ * Create a SEPA Direct Debit mandate for the customer
20
+ */
21
+ $mandate = $customer->createMandate([
22
+ "method" => \Mollie\Api\Types\MandateMethod::DIRECTDEBIT,
23
+ "consumerAccount" => 'NL34ABNA0243341423',
24
+ "consumerName" => 'B. A. Example',
25
+ ]);
26
+
27
+ echo "<p>Mandate created with id " . $mandate->id . " for customer " . $customer->name . "</p>";
28
+ } catch (\Mollie\Api\Exceptions\ApiException $e) {
29
+ echo "API call failed: " . htmlspecialchars($e->getMessage());
30
+ }
includes/mollie-api-php/examples/mandates/list-mandates.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * List all customer mandates
4
+ */
5
+
6
+ try {
7
+ /*
8
+ * Initialize the Mollie API library with your API key or OAuth access token.
9
+ */
10
+ require "../initialize.php";
11
+
12
+ /*
13
+ * Retrieve an existing customer by his customerId
14
+ */
15
+ $customer = $mollie->customers->get("cst_cUa8HjKBus");
16
+
17
+ /*
18
+ * List the mandates of this customer
19
+ */
20
+ echo "<ul>";
21
+ foreach ($customer->mandates() as $mandate) {
22
+ echo "<li>" . htmlspecialchars($mandate->id) . " - " . htmlspecialchars($mandate->method) . ": " . htmlspecialchars($mandate->status) . "</li>";
23
+ }
24
+ echo "</ul>";
25
+
26
+ } catch (\Mollie\Api\Exceptions\ApiException $e) {
27
+ echo "API call failed: " . htmlspecialchars($e->getMessage());
28
+ }
includes/mollie-api-php/examples/{24-revoke-mandate.php → mandates/revoke-mandate.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- Example 24 - Revoke a customer mandate
4
- */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "initialize.php";
11
 
12
  /*
13
  * Retrieve an existing customer by his customerId
1
  <?php
2
  /*
3
+ * Revoke a customer mandate
4
+ */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Retrieve an existing customer by his customerId
includes/mollie-api-php/examples/orders/.gitignore DELETED
@@ -1 +0,0 @@
1
- *.txt
 
includes/mollie-api-php/examples/{30-cancel-order-line.php → orders/cancel-order-lines.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 30 - Cancel an order line using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * Cancel an order line with ID "odl_dgtxyl" for order ID "ord_8wmqcHMN4U"
@@ -23,9 +23,10 @@ try {
23
  if ($line && $line->isCancelable) {
24
  $order->cancelLines([
25
  'lines' => [
26
- 'id' => $lineId,
27
- // # You can set a quantity if you like:
28
- // 'quantity' => 1,
 
29
  ],
30
  ]);
31
 
1
  <?php
2
  /*
3
+ * Cancel order lines using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Cancel an order line with ID "odl_dgtxyl" for order ID "ord_8wmqcHMN4U"
23
  if ($line && $line->isCancelable) {
24
  $order->cancelLines([
25
  'lines' => [
26
+ [
27
+ 'id' => $lineId,
28
+ 'quantity' => 1, // optional parameter
29
+ ]
30
  ],
31
  ]);
32
 
includes/mollie-api-php/examples/{28-cancel-order.php → orders/cancel-order.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 28 - Cancel an order using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * Cancel the order with ID "ord_pbjz8x"
1
  <?php
2
  /*
3
+ * Cancel an order using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Cancel the order with ID "ord_pbjz8x"
includes/mollie-api-php/examples/{26-new-order.php → orders/create-order.php} RENAMED
@@ -1,13 +1,26 @@
1
  <?php
2
  /*
3
- * Example 26 - How to create a new order in the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  /*
13
  * Order creation parameters.
@@ -38,14 +51,13 @@ try {
38
  "email" => "luke@skywalker.com",
39
  ],
40
  "metadata" => [
41
- "order_id" => "1337",
42
- "description" => "Lego cars"
43
  ],
44
  "consumerDateOfBirth" => "1958-01-31",
45
- "locale" => "nl_NL",
46
- "orderNumber" => "1337",
47
- "redirectUrl" => "https://example.org/redirect",
48
- "webhookUrl" => "https://example.org/webhook",
49
  "method" => "ideal",
50
  "lines" => [
51
  [
1
  <?php
2
  /*
3
+ * How to create a new order in the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
+
12
+ /*
13
+ * Generate a unique order id for this example. It is important to include this unique attribute
14
+ * in the redirectUrl (below) so a proper return page can be shown to the customer.
15
+ */
16
+ $orderId = time();
17
+
18
+ /*
19
+ * Determine the url parts to these example files.
20
+ */
21
+ $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http";
22
+ $hostname = $_SERVER['HTTP_HOST'];
23
+ $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
24
 
25
  /*
26
  * Order creation parameters.
51
  "email" => "luke@skywalker.com",
52
  ],
53
  "metadata" => [
54
+ "order_id" => $orderId
 
55
  ],
56
  "consumerDateOfBirth" => "1958-01-31",
57
+ "locale" => "en_US",
58
+ "orderNumber" => $orderId,
59
+ "redirectUrl" => "{$protocol}://{$hostname}{$path}/orders/return.php?order_id={$orderId}",
60
+ "webhookUrl" => "{$protocol}://{$hostname}{$path}/orders/webhook.php",
61
  "method" => "ideal",
62
  "lines" => [
63
  [
includes/mollie-api-php/examples/orders/list-methods.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * How to get the currently activated payment methods for the Orders API.
4
+ */
5
+
6
+ try {
7
+ /*
8
+ * Initialize the Mollie API library with your API key.
9
+ *
10
+ * See: https://www.mollie.com/dashboard/developers/api-keys
11
+ */
12
+ require "../initialize.php";
13
+
14
+ /*
15
+ * Get all the activated methods for this API key.
16
+ * To get methods that are compatible with the Orders API
17
+ * we are passing the 'resource' parameter.
18
+ */
19
+ $methods = $mollie->methods->all(['resource' => 'orders']);
20
+ foreach ($methods as $method) {
21
+ echo '<div style="line-height:40px; vertical-align:top">';
22
+ echo '<img src="' . htmlspecialchars($method->image->size1x) . '" srcset="' . htmlspecialchars($method->image->size2x) . ' 2x"> ';
23
+ echo htmlspecialchars($method->description) . ' (' . htmlspecialchars($method->id) . ')';
24
+ echo '</div>';
25
+ }
26
+ } catch (\Mollie\Api\Exceptions\ApiException $e) {
27
+ echo "API call failed: " . htmlspecialchars($e->getMessage());
28
+ }
includes/mollie-api-php/examples/{29-list-orders.php → orders/list-orders.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- * Example 29 - List orders using the Mollie API.
4
  */
5
 
6
  use Mollie\Api\Resources\OrderCollection;
@@ -9,7 +9,7 @@ try {
9
  /*
10
  * Initialize the Mollie API library with your API key or OAuth access token.
11
  */
12
- require "./initialize.php";
13
 
14
  /*
15
  * List the most recent orders
1
  <?php
2
  /*
3
+ * List orders using the Mollie API.
4
  */
5
 
6
  use Mollie\Api\Resources\OrderCollection;
9
  /*
10
  * Initialize the Mollie API library with your API key or OAuth access token.
11
  */
12
+ require "../initialize.php";
13
 
14
  /*
15
  * List the most recent orders
includes/mollie-api-php/examples/{35-refund-order-completely.php → orders/refund-order-completely.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 35 - Refund all eligible items for an order using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * Refund all eligible items for an order with ID "ord_8wmqcHMN4U".
1
  <?php
2
  /*
3
+ * Refund all eligible items for an order using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Refund all eligible items for an order with ID "ord_8wmqcHMN4U".
includes/mollie-api-php/examples/{36-refund-order-partially.php → orders/refund-order-partially.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 36 - Refund some items for an order using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * Refund 1 item of order line "odl_dgtxyl" for an order with ID "ord_8wmqcHMN4U".
1
  <?php
2
  /*
3
+ * Refund some items for an order using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Refund 1 item of order line "odl_dgtxyl" for an order with ID "ord_8wmqcHMN4U".
includes/mollie-api-php/examples/{27-handle-order-status-change.php → orders/webhook.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 27 - Handle an order status change using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * After your webhook has been called with the order ID in its body, you'd like
@@ -15,19 +15,35 @@ try {
15
  *
16
  * See: https://docs.mollie.com/reference/v2/orders-api/get-order
17
  */
18
- $order = $mollie->orders->get("ord_pbjz8x");
 
 
 
 
 
 
19
 
20
  if ($order->isPaid() || $order->isAuthorized()) {
21
- echo "The payment for your order " . $order->id . " has been processed.";
22
- echo "\nYour order is now being prepared for shipment.";
 
 
23
  } elseif ($order->isCanceled()) {
24
- echo "Your order " . $order->id . " has been canceled.";
 
 
25
  } elseif ($order->isRefunded()) {
26
- echo "Your order " . $order->id . " has been refunded.";
 
 
27
  } elseif ($order->isExpired()) {
28
- echo "Your order " . $order->id . " has expired.";
 
 
29
  } elseif ($order->isCompleted()) {
30
- echo "Your order " . $order->id . " is completed.";
 
 
31
  }
32
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
33
  echo "API call failed: " . htmlspecialchars($e->getMessage());
1
  <?php
2
  /*
3
+ * Handle an order status change using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * After your webhook has been called with the order ID in its body, you'd like
15
  *
16
  * See: https://docs.mollie.com/reference/v2/orders-api/get-order
17
  */
18
+ $order = $mollie->orders->get($_POST["id"]);
19
+ $orderId = $payment->metadata->order_id;
20
+
21
+ /*
22
+ * Update the order in the database.
23
+ */
24
+ database_write($orderId, $payment->status);
25
 
26
  if ($order->isPaid() || $order->isAuthorized()) {
27
+ /*
28
+ * The order is paid or authorized
29
+ * At this point you'd probably want to start the process of delivering the product to the customer.
30
+ */
31
  } elseif ($order->isCanceled()) {
32
+ /*
33
+ * The order is canceled.
34
+ */
35
  } elseif ($order->isRefunded()) {
36
+ /*
37
+ * The order is refunded.
38
+ */
39
  } elseif ($order->isExpired()) {
40
+ /*
41
+ * The order is expired.
42
+ */
43
  } elseif ($order->isCompleted()) {
44
+ /*
45
+ * The orderis completed.
46
+ */
47
  }
48
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
49
  echo "API call failed: " . htmlspecialchars($e->getMessage());
includes/mollie-api-php/examples/{04-ideal-payment.php → payments/create-ideal-payment.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- * Example 4 - How to prepare an iDEAL payment with the Mollie API.
4
  */
5
 
6
  try {
@@ -9,7 +9,7 @@ try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
- require "./initialize.php";
13
 
14
  /*
15
  * First, let the customer pick the bank in a simple HTML form. This step is actually optional.
@@ -58,8 +58,8 @@ try {
58
  ],
59
  "method" => \Mollie\Api\Types\PaymentMethod::IDEAL,
60
  "description" => "Order #{$orderId}",
61
- "redirectUrl" => "{$protocol}://{$hostname}{$path}/03-return-page.php?order_id={$orderId}",
62
- "webhookUrl" => "{$protocol}://{$hostname}{$path}/02-webhook-verification.php",
63
  "metadata" => [
64
  "order_id" => $orderId,
65
  ],
@@ -69,7 +69,7 @@ try {
69
  /*
70
  * In this example we store the order with its payment status in a database.
71
  */
72
- database_write($order_id, $payment->status);
73
 
74
  /*
75
  * Send the customer off to complete the payment.
@@ -79,15 +79,3 @@ try {
79
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
80
  echo "API call failed: " . htmlspecialchars($e->getMessage());
81
  }
82
-
83
- /*
84
- * NOTE: This example uses a text file as a database. Please use a real database like MySQL in production code.
85
- */
86
- function database_write($orderId, $status)
87
- {
88
- $orderId = intval($orderId);
89
- $database = dirname(__FILE__) . "/orders/order-{$orderId}.txt";
90
-
91
- file_put_contents($database, $status);
92
- }
93
-
1
  <?php
2
  /*
3
+ * How to prepare an iDEAL payment with the Mollie API.
4
  */
5
 
6
  try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
+ require "../initialize.php";
13
 
14
  /*
15
  * First, let the customer pick the bank in a simple HTML form. This step is actually optional.
58
  ],
59
  "method" => \Mollie\Api\Types\PaymentMethod::IDEAL,
60
  "description" => "Order #{$orderId}",
61
+ "redirectUrl" => "{$protocol}://{$hostname}{$path}/payments/return.php?order_id={$orderId}",
62
+ "webhookUrl" => "{$protocol}://{$hostname}{$path}/payments/webhook.php",
63
  "metadata" => [
64
  "order_id" => $orderId,
65
  ],
69
  /*
70
  * In this example we store the order with its payment status in a database.
71
  */
72
+ database_write($orderId, $payment->status);
73
 
74
  /*
75
  * Send the customer off to complete the payment.
79
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
80
  echo "API call failed: " . htmlspecialchars($e->getMessage());
81
  }
 
 
 
 
 
 
 
 
 
 
 
 
includes/mollie-api-php/examples/{10-oauth-new-payment.php → payments/create-payment-oauth.php} RENAMED
@@ -7,7 +7,7 @@ try
7
  /*
8
  * Initialize the Mollie API library with your OAuth access token.
9
  */
10
- require "initialize_with_oauth.php";
11
  /*
12
  * Generate a unique order id for this example. It is important to include this unique attribute
13
  * in the redirectUrl (below) so a proper return page can be shown to the customer.
@@ -25,31 +25,31 @@ try
25
  */
26
  $profiles = $mollie->profiles->page();
27
  $profile = reset($profiles);
28
- /*
29
- * Payment parameters:
30
- * amount Amount in EUROs. This example creates a 10,- payment.
31
- * description Description of the payment.
32
- * redirectUrl Redirect location. The customer will be redirected there after the payment.
33
- * webhookUrl Webhook location, used to report when the payment changes state.
34
- * metadata Custom metadata that is stored with the payment.
35
  */
36
- $payment = $mollie->payments->create(array(
37
  "amount" => [
38
  "value" => "10.00",
39
  "currency" => "EUR"
40
  ],
41
  "description" => "My first API payment",
42
- "redirectUrl" => "{$protocol}://{$hostname}{$path}/03-return-page.php?order_id={$orderId}",
43
- "webhookUrl" => "{$protocol}://{$hostname}{$path}/02-webhook-verification.php",
44
- "metadata" => array(
45
  "order_id" => $orderId,
46
- ),
47
  "profileId" => $profile->id // This is specifically necessary for payment resources via OAuth access.
48
- ));
 
49
  /*
50
  * In this example we store the order with its payment status in a database.
51
  */
52
  database_write($orderId, $payment->status);
 
53
  /*
54
  * Send the customer off to complete the payment.
55
  * This request should always be a GET, thus we enforce 303 http response code
@@ -64,13 +64,4 @@ try
64
  catch (\Mollie\Api\Exceptions\ApiException $e)
65
  {
66
  echo "API call failed: " . htmlspecialchars($e->getMessage());
67
- }
68
- /*
69
- * NOTE: This example uses a text file as a database. Please use a real database like MySQL in production code.
70
- */
71
- function database_write ($orderId, $status)
72
- {
73
- $orderId = intval($orderId);
74
- $database = dirname(__FILE__) . "/orders/order-{$orderId}.txt";
75
- file_put_contents($database, $status);
76
  }
7
  /*
8
  * Initialize the Mollie API library with your OAuth access token.
9
  */
10
+ require "../initialize_with_oauth.php";
11
  /*
12
  * Generate a unique order id for this example. It is important to include this unique attribute
13
  * in the redirectUrl (below) so a proper return page can be shown to the customer.
25
  */
26
  $profiles = $mollie->profiles->page();
27
  $profile = reset($profiles);
28
+
29
+ /**
30
+ * Paramaters for creating a payment via oAuth
31
+ *
32
+ * @See https://docs.mollie.com/reference/v2/payments-api/create-payment
 
 
33
  */
34
+ $payment = $mollie->payments->create([
35
  "amount" => [
36
  "value" => "10.00",
37
  "currency" => "EUR"
38
  ],
39
  "description" => "My first API payment",
40
+ "redirectUrl" => "{$protocol}://{$hostname}{$path}/payments/return.php?order_id={$orderId}",
41
+ "webhookUrl" => "{$protocol}://{$hostname}{$path}/payments/webhook.php",
42
+ "metadata" => [
43
  "order_id" => $orderId,
44
+ ],
45
  "profileId" => $profile->id // This is specifically necessary for payment resources via OAuth access.
46
+ ]);
47
+
48
  /*
49
  * In this example we store the order with its payment status in a database.
50
  */
51
  database_write($orderId, $payment->status);
52
+
53
  /*
54
  * Send the customer off to complete the payment.
55
  * This request should always be a GET, thus we enforce 303 http response code
64
  catch (\Mollie\Api\Exceptions\ApiException $e)
65
  {
66
  echo "API call failed: " . htmlspecialchars($e->getMessage());
 
 
 
 
 
 
 
 
 
67
  }
includes/mollie-api-php/examples/{01-new-payment.php → payments/create-payment.php} RENAMED
@@ -9,7 +9,7 @@ try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
- require "./initialize.php";
13
 
14
  /*
15
  * Generate a unique order id for this example. It is important to include this unique attribute
@@ -38,8 +38,8 @@ try {
38
  "value" => "10.00" // You must send the correct number of decimals, thus we enforce the use of strings
39
  ],
40
  "description" => "Order #{$orderId}",
41
- "redirectUrl" => "{$protocol}://{$hostname}{$path}/03-return-page.php?order_id={$orderId}",
42
- "webhookUrl" => "{$protocol}://{$hostname}{$path}/02-webhook-verification.php",
43
  "metadata" => [
44
  "order_id" => $orderId,
45
  ],
@@ -57,15 +57,4 @@ try {
57
  header("Location: " . $payment->getCheckoutUrl(), true, 303);
58
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
59
  echo "API call failed: " . htmlspecialchars($e->getMessage());
60
- }
61
-
62
- /*
63
- * NOTE: This example uses a text file as a database. Please use a real database like MySQL in production code.
64
- */
65
- function database_write($orderId, $status)
66
- {
67
- $orderId = intval($orderId);
68
- $database = dirname(__FILE__) . "/orders/order-{$orderId}.txt";
69
-
70
- file_put_contents($database, $status);
71
- }
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
+ require "../initialize.php";
13
 
14
  /*
15
  * Generate a unique order id for this example. It is important to include this unique attribute
38
  "value" => "10.00" // You must send the correct number of decimals, thus we enforce the use of strings
39
  ],
40
  "description" => "Order #{$orderId}",
41
+ "redirectUrl" => "{$protocol}://{$hostname}{$path}/payments/return.php?order_id={$orderId}",
42
+ "webhookUrl" => "{$protocol}://{$hostname}{$path}/payments/webhook.php",
43
  "metadata" => [
44
  "order_id" => $orderId,
45
  ],
57
  header("Location: " . $payment->getCheckoutUrl(), true, 303);
58
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
59
  echo "API call failed: " . htmlspecialchars($e->getMessage());
60
+ }
 
 
 
 
 
 
 
 
 
 
 
includes/mollie-api-php/examples/{06-list-activated-methods.php → payments/list-methods.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- * Example 6 - How to get the currently activated payment methods.
4
  */
5
 
6
  try {
@@ -9,9 +9,11 @@ try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
- require "./initialize.php";
13
  /*
14
  * Get all the activated methods for this API key.
 
 
15
  */
16
  $methods = $mollie->methods->all();
17
  foreach ($methods as $method) {
1
  <?php
2
  /*
3
+ * How to get the currently activated payment methods for the Payments API.
4
  */
5
 
6
  try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
+ require "../initialize.php";
13
  /*
14
  * Get all the activated methods for this API key.
15
+ * By default we are using the resource "payments".
16
+ * See the orders folder for an example with the Orders API.
17
  */
18
  $methods = $mollie->methods->all();
19
  foreach ($methods as $method) {
includes/mollie-api-php/examples/{05-payments-history.php → payments/list-payments.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- * Example 5 - How to retrieve your payments history.
4
  */
5
 
6
  try {
@@ -9,7 +9,7 @@ try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
- require "./initialize.php";
13
 
14
  /*
15
  * Determine the url parts to these example files.
@@ -41,7 +41,7 @@ try {
41
  }
42
 
43
  if ($payment->canBeRefunded() && $payment->amountRemaining->currency === 'EUR' && $payment->amountRemaining->value >= '2.00') {
44
- echo " (<a href=\"{$protocol}://{$hostname}{$path}/07-refund-payment.php?payment_id=" . htmlspecialchars($payment->id) . "\">refund</a>)";
45
  }
46
 
47
  echo "</li>";
@@ -72,7 +72,7 @@ try {
72
  }
73
 
74
  if ($payment->canBeRefunded() && $payment->amountRemaining->currency === 'EUR' && $payment->amountRemaining->value >= '2.00') {
75
- echo " (<a href=\"{$protocol}://{$hostname}{$path}/07-refund-payment.php?payment_id=" . htmlspecialchars($payment->id) . "\">refund</a>)";
76
  }
77
 
78
  echo "</li>";
1
  <?php
2
  /*
3
+ * How to list your payments.
4
  */
5
 
6
  try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
+ require "../initialize.php";
13
 
14
  /*
15
  * Determine the url parts to these example files.
41
  }
42
 
43
  if ($payment->canBeRefunded() && $payment->amountRemaining->currency === 'EUR' && $payment->amountRemaining->value >= '2.00') {
44
+ echo " (<a href=\"{$protocol}://{$hostname}{$path}/payments/refund-payment.php?payment_id=" . htmlspecialchars($payment->id) . "\">refund</a>)";
45
  }
46
 
47
  echo "</li>";
72
  }
73
 
74
  if ($payment->canBeRefunded() && $payment->amountRemaining->currency === 'EUR' && $payment->amountRemaining->value >= '2.00') {
75
+ echo " (<a href=\"{$protocol}://{$hostname}{$path}/payments/refund-payment.php?payment_id=" . htmlspecialchars($payment->id) . "\">refund</a>)";
76
  }
77
 
78
  echo "</li>";
includes/mollie-api-php/examples/{07-refund-payment.php → payments/refund-payment.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- * Example 7 - How to refund a payment programmatically
4
  */
5
 
6
  try {
@@ -9,7 +9,7 @@ try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
- require "./initialize.php";
13
 
14
  /*
15
  * Determine the url parts to these example files.
@@ -62,9 +62,9 @@ try {
62
  echo "<form method='get'><input name='payment_id' value='tr_xxx'/><input type='submit' /></form>";
63
 
64
  echo "<p>";
65
- echo '<a href="' . $protocol . '://' . $hostname . $path . '/01-new-payment.php">Create payment with example 1</a><br>';
66
- echo '<a href="' . $protocol . '://' . $hostname . $path . '/04-ideal-payment.php">Create iDEAL payment with example 4</a><br>';
67
- echo '<a href="' . $protocol . '://' . $hostname . $path . '/05-payments-history.php">List payments with example 5</a><br>';
68
  echo "</p>";
69
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
70
  echo "API call failed: " . htmlspecialchars($e->getMessage());
1
  <?php
2
  /*
3
+ * How to refund a payment programmatically
4
  */
5
 
6
  try {
9
  *
10
  * See: https://www.mollie.com/dashboard/developers/api-keys
11
  */
12
+ require "../initialize.php";
13
 
14
  /*
15
  * Determine the url parts to these example files.
62
  echo "<form method='get'><input name='payment_id' value='tr_xxx'/><input type='submit' /></form>";
63
 
64
  echo "<p>";
65
+ echo '<a href="' . $protocol . '://' . $hostname . $path . '/payments/create-payment.php">Create a payment</a><br>';
66
+ echo '<a href="' . $protocol . '://' . $hostname . $path . '/payments/create-ideal-payment.php">Create an iDEAL payment</a><br>';
67
+ echo '<a href="' . $protocol . '://' . $hostname . $path . '/payments/list-payments.php">List payments</a><br>';
68
  echo "</p>";
69
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
70
  echo "API call failed: " . htmlspecialchars($e->getMessage());
includes/mollie-api-php/examples/payments/return.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * How to show a return page to the customer.
4
+ *
5
+ * In this example we retrieve the order stored in the database.
6
+ * Here, it's unnecessary to use the Mollie API Client.
7
+ */
8
+
9
+ /*
10
+ * NOTE: The examples are using a text file as a database.
11
+ * Please use a real database like MySQL in production code.
12
+ */
13
+ require_once "../functions.php";
14
+
15
+ $status = database_read($_GET["order_id"]);
16
+
17
+ /*
18
+ * Determine the url parts to these example files.
19
+ */
20
+ $protocol = isset($_SERVER['HTTPS']) && strcasecmp('off', $_SERVER['HTTPS']) !== 0 ? "https" : "http";
21
+ $hostname = $_SERVER['HTTP_HOST'];
22
+ $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
23
+
24
+ echo "<p>Your payment status is '" . htmlspecialchars($status) . "'.</p>";
25
+ echo "<p>";
26
+ echo '<a href="' . $protocol . '://' . $hostname . $path . '/payments/create-payment.php">Create a payment</a><br>';
27
+ echo '<a href="' . $protocol . '://' . $hostname . $path . '/payments/create-ideal-payment.php">Create an iDEAL payment</a><br>';
28
+ echo '<a href="' . $protocol . '://' . $hostname . $path . '/payments/list-payments.php">List payments</a><br>';
29
+ echo "</p>";
includes/mollie-api-php/examples/{02-webhook-verification.php → payments/webhook.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- * Example 2 - How to verify Mollie API Payments in a webhook.
4
  *
5
  * See: https://docs.mollie.com/guides/webhooks
6
  */
@@ -11,7 +11,7 @@ try {
11
  *
12
  * See: https://www.mollie.com/dashboard/developers/api-keys
13
  */
14
- require "./initialize.php";
15
 
16
  /*
17
  * Retrieve the payment's current state.
@@ -62,15 +62,4 @@ try {
62
  }
63
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
64
  echo "API call failed: " . htmlspecialchars($e->getMessage());
65
- }
66
-
67
- /*
68
- * NOTE: This example uses a text file as a database. Please use a real database like MySQL in production code.
69
- */
70
- function database_write($orderId, $status)
71
- {
72
- $orderId = intval($orderId);
73
- $database = dirname(__FILE__) . "/orders/order-{$orderId}.txt";
74
-
75
- file_put_contents($database, $status);
76
- }
1
  <?php
2
  /*
3
+ * How to verify Mollie API Payments in a webhook.
4
  *
5
  * See: https://docs.mollie.com/guides/webhooks
6
  */
11
  *
12
  * See: https://www.mollie.com/dashboard/developers/api-keys
13
  */
14
+ require "../initialize.php";
15
 
16
  /*
17
  * Retrieve the payment's current state.
62
  }
63
  } catch (\Mollie\Api\Exceptions\ApiException $e) {
64
  echo "API call failed: " . htmlspecialchars($e->getMessage());
65
+ }
 
 
 
 
 
 
 
 
 
 
 
includes/mollie-api-php/examples/profiles/create-profile.php ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Create a profile via the Mollie API.
4
+ */
5
+ try
6
+ {
7
+ /*
8
+ * Initialize the Mollie API library with your API key or OAuth access token.
9
+ */
10
+ require "../initialize_with_oauth.php";
11
+
12
+ /**
13
+ * Create the profile
14
+ *
15
+ * @See https://docs.mollie.com/reference/v2/profiles-api/create-profile
16
+ */
17
+ $profile = $mollie->profiles->create([
18
+ "name" => "My website name",
19
+ "website" => "https://www.mywebsite.com",
20
+ "email" => "info@mywebsite.com",
21
+ "phone" => "+31208202070",
22
+ "categoryCode" => 5399,
23
+ "mode" => "live",
24
+ ]);
25
+ echo "<p>Profile created: " . htmlspecialchars($profile->name) . "</p>";
26
+ }
27
+ catch (\Mollie\Api\Exceptions\ApiException $e)
28
+ {
29
+ echo "<p>API call failed: " . htmlspecialchars($e->getMessage()) . "</p>";
30
+ }
includes/mollie-api-php/examples/profiles/delete-profile.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Delete a profile via the Mollie API.
4
+ */
5
+ try
6
+ {
7
+ /*
8
+ * Initialize the Mollie API library with your API key or OAuth access token.
9
+ */
10
+ require "../initialize_with_oauth.php";
11
+
12
+ /**
13
+ * Delete a profile via the profileId
14
+ *
15
+ * @See https://docs.mollie.com/reference/v2/profiles-api/delete-profile
16
+ */
17
+ $profile = $mollie->profiles->delete("pfl_v9hTwCvYqw");
18
+ echo "<p>Profile deleted</p>";
19
+ }
20
+ catch (\Mollie\Api\Exceptions\ApiException $e)
21
+ {
22
+ echo "<p>API call failed: " . htmlspecialchars($e->getMessage()) . "</p>";
23
+ }
includes/mollie-api-php/examples/{08-oauth-list-profiles.php → profiles/list-profiles.php} RENAMED
@@ -1,13 +1,14 @@
1
  <?php
2
  /*
3
- * Example 8 - Using OAuth access token to list profiles of an account.
4
  */
5
  try
6
  {
7
  /*
8
  * Initialize the Mollie API library with your OAuth access token.
9
  */
10
- require "initialize_with_oauth.php";
 
11
  /*
12
  * Get the all the profiles for this account.
13
  */
1
  <?php
2
  /*
3
+ * Using OAuth access token to list profiles of an account.
4
  */
5
  try
6
  {
7
  /*
8
  * Initialize the Mollie API library with your OAuth access token.
9
  */
10
+ require "../initialize_with_oauth.php";
11
+
12
  /*
13
  * Get the all the profiles for this account.
14
  */
includes/mollie-api-php/examples/{19-update-profile.php → profiles/update-profile.php} RENAMED
@@ -1,17 +1,19 @@
1
  <?php
2
  /*
3
- * Example 19 - Updating an existing profile via the Mollie API.
4
  */
5
  try
6
  {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "initialize_with_oauth.php";
 
11
  /*
12
  * Retrieve an existing profile by his profileId
13
  */
14
  $profile = $mollie->profiles->get("pfl_eA4MSz7Bvy");
 
15
  /**
16
  * Profile fields that can be updated.
17
  *
1
  <?php
2
  /*
3
+ * Updating an existing profile via the Mollie API.
4
  */
5
  try
6
  {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize_with_oauth.php";
11
+
12
  /*
13
  * Retrieve an existing profile by his profileId
14
  */
15
  $profile = $mollie->profiles->get("pfl_eA4MSz7Bvy");
16
+
17
  /**
18
  * Profile fields that can be updated.
19
  *
includes/mollie-api-php/examples/{09-oauth-list-settlements.php → settlements/list-settlements.php} RENAMED
@@ -1,13 +1,14 @@
1
  <?php
2
  /*
3
- * Example 9 - Using OAuth access token to list settlements of an account.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your OAuth access token.
9
  */
10
- require "./initialize_with_oauth.php";
 
11
  /*
12
  * Get the all the settlements for this account.
13
  */
1
  <?php
2
  /*
3
+ * Using OAuth access token to list settlements of an account.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your OAuth access token.
9
  */
10
+ require "../initialize_with_oauth.php";
11
+
12
  /*
13
  * Get the all the settlements for this account.
14
  */
includes/mollie-api-php/examples/{31-ship-order-completely.php → shipments/create-shipment-all.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 31 - Create a shipment for an entire order using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * Create a shipment for the entire order with ID "ord_8wmqcHMN4U"
@@ -15,7 +15,7 @@ try {
15
  * See: https://docs.mollie.com/reference/v2/shipments-api/create-shipment
16
  */
17
 
18
- $order = $this->getOrder('ord_8wmqcHMN4U');
19
  $shipment = $order->shipAll();
20
 
21
  echo 'A shipment with ID ' . $shipment->id. ' has been created for your order with ID ' . $order->id . '.';
1
  <?php
2
  /*
3
+ * Create a shipment for an entire order using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Create a shipment for the entire order with ID "ord_8wmqcHMN4U"
15
  * See: https://docs.mollie.com/reference/v2/shipments-api/create-shipment
16
  */
17
 
18
+ $order = $mollie->orders->get('ord_8wmqcHMN4U');
19
  $shipment = $order->shipAll();
20
 
21
  echo 'A shipment with ID ' . $shipment->id. ' has been created for your order with ID ' . $order->id . '.';
includes/mollie-api-php/examples/{32-ship-order-partially.php → shipments/create-shipment-partial.php} RENAMED
File without changes
includes/mollie-api-php/examples/{33-get-shipment.php → shipments/get-shipment.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 33 - Retrieve a shipment using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * Retrieve a shipment with ID "shp_3wmsgCJN4U" for the order with ID "ord_8wmqcHMN4U".
1
  <?php
2
  /*
3
+ * Retrieve a shipment using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Retrieve a shipment with ID "shp_3wmsgCJN4U" for the order with ID "ord_8wmqcHMN4U".
includes/mollie-api-php/examples/{34-list-order-shipments.php → shipments/list-shipments.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 34 - List shipment for an order using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * Listing shipments for the order with ID "ord_8wmqcHMN4U".
1
  <?php
2
  /*
3
+ * List shipment for an order using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Listing shipments for the order with ID "ord_8wmqcHMN4U".
includes/mollie-api-php/examples/{37-update-shipment-tracking.php → shipments/update-shipment.php} RENAMED
@@ -1,13 +1,13 @@
1
  <?php
2
  /*
3
- * Example 37 - Update shipment tracking information using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
 
12
  /*
13
  * Update the tracking information for a shipment with ID "shp_3wmsgCJN4U" and
1
  <?php
2
  /*
3
+ * Update shipment tracking information using the Mollie API.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
 
12
  /*
13
  * Update the tracking information for a shipment with ID "shp_3wmsgCJN4U" and
includes/mollie-api-php/examples/{17-cancel-subscription.php → subscriptions/cancel-subscription.php} RENAMED
@@ -1,29 +1,32 @@
1
  <?php
2
  /*
3
- * Example 17 - How to cancel a subscription.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
11
- /**
 
12
  * Retrieve the last created customer for this example.
13
- * If no customers are created yet, run example 11.
14
  */
15
  $customer = $mollie->customers->page(null, 1)[0];
 
16
  /*
17
- * Generate a unique subscription id for this example. It is important to include this unique attribute
18
- * in the webhookUrl (below) so new payments can be associated with this subscription.
19
  */
20
  $subscriptionId = isset($_GET['subscription_id']) ? $_GET['subscription_id'] : '';
 
21
  /*
22
  * Customer Subscription deletion parameters.
23
  *
24
  * See: https://www.mollie.com/nl/docs/reference/subscriptions/delete
25
  */
26
  $canceledSubscription = $customer->cancelSubscription($subscriptionId);
 
27
  /*
28
  * The subscription status should now be canceled
29
  */
1
  <?php
2
  /*
3
+ * How to cancel a subscription.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
+
12
+ /*
13
  * Retrieve the last created customer for this example.
14
+ * If no customers are created yet, run the create-customer example.
15
  */
16
  $customer = $mollie->customers->page(null, 1)[0];
17
+
18
  /*
19
+ * The subscription ID, starting with sub_
 
20
  */
21
  $subscriptionId = isset($_GET['subscription_id']) ? $_GET['subscription_id'] : '';
22
+
23
  /*
24
  * Customer Subscription deletion parameters.
25
  *
26
  * See: https://www.mollie.com/nl/docs/reference/subscriptions/delete
27
  */
28
  $canceledSubscription = $customer->cancelSubscription($subscriptionId);
29
+
30
  /*
31
  * The subscription status should now be canceled
32
  */
includes/mollie-api-php/examples/{16-recurring-subscription.php → subscriptions/create-subscription.php} RENAMED
@@ -1,13 +1,14 @@
1
  <?php
2
  /*
3
- * Example 16 - How to create a regular subscription.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
- require "./initialize.php";
 
11
  /*
12
  * Determine the url parts to these example files.
13
  */
@@ -15,20 +16,22 @@ try {
15
  $hostname = $_SERVER['HTTP_HOST'];
16
  $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
17
 
18
- /**
19
  * Retrieve the last created customer for this example.
20
- * If no customers are created yet, run example 11.
21
  */
22
  $customer = $mollie->customers->page(null, 1)[0];
 
23
  /*
24
  * Generate a unique subscription id for this example. It is important to include this unique attribute
25
  * in the webhookUrl (below) so new payments can be associated with this subscription.
26
  */
27
  $subscriptionId = time();
28
- /*
 
29
  * Customer Subscription creation parameters.
30
  *
31
- * See: https://www.mollie.com/nl/docs/reference/subscriptions/create
32
  */
33
  $subscription = $customer->createSubscription([
34
  "amount" => [
@@ -38,13 +41,16 @@ try {
38
  "times" => 12,
39
  "interval" => "1 month",
40
  "description" => "Subscription #{$subscriptionId}",
41
- "method" => NULL,
42
- "webhookUrl" => "https://example.com/webhook.php?subscription_id={$subscriptionId}",
 
 
43
  ]);
 
44
  /*
45
  * The subscription will be either pending or active depending on whether the customer has
46
  * a pending or valid mandate. If the customer has no mandates an error is returned. You
47
- * should then set up a "first payment" for the customer (example 14).
48
  */
49
  echo "<p>The subscription status is '" . htmlspecialchars($subscription->status) . "'.</p>\n";
50
  echo "<p>";
1
  <?php
2
  /*
3
+ * How to create a regular subscription.
4
  */
5
 
6
  try {
7
  /*
8
  * Initialize the Mollie API library with your API key or OAuth access token.
9
  */
10
+ require "../initialize.php";
11
+
12
  /*
13
  * Determine the url parts to these example files.
14
  */
16
  $hostname = $_SERVER['HTTP_HOST'];
17
  $path = dirname(isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']);
18
 
19
+ /*
20
  * Retrieve the last created customer for this example.
21
+ * If no customers are created yet, run create-customer example.
22
  */
23
  $customer = $mollie->customers->page(null, 1)[0];
24
+
25
  /*
26
  * Generate a unique subscription id for this example. It is important to include this unique attribute
27
  * in the webhookUrl (below) so new payments can be associated with this subscription.
28
  */
29
  $subscriptionId = time();
30
+
31
+ /**
32
  * Customer Subscription creation parameters.
33
  *
34
+ * @See: https://docs.mollie.com/reference/v2/subscriptions-api/create-subscription
35
  */
36
  $subscription = $customer->createSubscription([
37
  "amount" => [
41
  "times" => 12,
42
  "interval" => "1 month",
43
  "description" => "Subscription #{$subscriptionId}",
44
+ "webhookUrl" => "{$protocol}://{$hostname}{$path}/subscriptions/webhook.php",
45
+ "metadata" => [
46
+ "subscription_id" => $subscriptionId
47
+ ],
48
  ]);
49
+
50
  /*
51
  * The subscription will be either pending or active depending on whether the customer has
52
  * a pending or valid mandate. If the customer has no mandates an error is returned. You
53
+ * should then set up a "first payment" for the customer.
54
  */
55
  echo "<p>The subscription status is '" . htmlspecialchars($subscription->status) . "'.</p>\n";
56
  echo "<p>";
includes/mollie-api-php/examples/{25-update-subscription.php → subscriptions/update-subscription.php} RENAMED
@@ -1,16 +1,12 @@
1
  <?php
2
-
3
  /*
4
- * Example 25 - Updating an existing subscription via the Mollie API.
5
  */
6
-
7
- use Mollie\Api\Exceptions\ApiException;
8
-
9
  try {
10
  /*
11
  * Initialize the Mollie API library with your API key or OAuth access token.
12
  */
13
- require "./initialize.php";
14
 
15
  /*
16
  * Retrieve an existing subscription
@@ -30,6 +26,6 @@ try {
30
  $subscription->update();
31
 
32
  echo "<p>Subscription updated: " . $subscription->id . "</p>";
33
- } catch (ApiException $e) {
34
  echo "API call failed: " . htmlspecialchars($e->getMessage());
35
  }
1
  <?php
 
2
  /*
3
+ * Updating an existing subscription via the Mollie API.
4
  */
 
 
 
5
  try {
6
  /*
7
  * Initialize the Mollie API library with your API key or OAuth access token.
8
  */
9
+ require "../initialize.php";
10
 
11
  /*
12
  * Retrieve an existing subscription
26
  $subscription->update();
27
 
28
  echo "<p>Subscription updated: " . $subscription->id . "</p>";
29
+ } catch (\Mollie\Api\Exceptions\ApiException $e) {
30
  echo "API call failed: " . htmlspecialchars($e->getMessage());
31
  }
includes/mollie-api-php/src/MollieApiClient.php CHANGED
@@ -35,7 +35,7 @@ class MollieApiClient
35
  /**
36
  * Version of our client.
37
  */
38
- const CLIENT_VERSION = "2.1.2";
39
 
40
  /**
41
  * Endpoint of the remote API.
35
  /**
36
  * Version of our client.
37
  */
38
+ const CLIENT_VERSION = "2.1.4";
39
 
40
  /**
41
  * Endpoint of the remote API.
includes/mollie-api-php/src/Resources/Customer.php CHANGED
@@ -193,7 +193,7 @@ class Customer extends BaseResource
193
  */
194
  public function hasValidMandate()
195
  {
196
- $mandates = $this->client->mandates->listFor($this, null, null, $this->getPresetOptions());
197
  foreach ($mandates as $mandate) {
198
  if ($mandate->isValid()) {
199
  return true;
@@ -203,6 +203,23 @@ class Customer extends BaseResource
203
  return false;
204
  }
205
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  /**
207
  * When accessed by oAuth we want to pass the testmode by default
208
  *
193
  */
194
  public function hasValidMandate()
195
  {
196
+ $mandates = $this->mandates();
197
  foreach ($mandates as $mandate) {
198
  if ($mandate->isValid()) {
199
  return true;
203
  return false;
204
  }
205
 
206
+ /**
207
+ * Helper function to check for specific payment method mandate with status valid
208
+ *
209
+ * @return bool
210
+ */
211
+ public function hasValidMandateForMethod($method)
212
+ {
213
+ $mandates = $this->mandates();
214
+ foreach ($mandates as $mandate) {
215
+ if ($mandate->method === $method && $mandate->isValid()) {
216
+ return true;
217
+ }
218
+ }
219
+
220
+ return false;
221
+ }
222
+
223
  /**
224
  * When accessed by oAuth we want to pass the testmode by default
225
  *
includes/mollie-api-php/src/Resources/Order.php CHANGED
@@ -146,16 +146,26 @@ class Order extends BaseResource
146
 
147
  /**
148
  * The order lines contain the actual things the customer bought.
 
149
  * @var array|object[]
150
  */
151
  public $lines;
152
 
153
  /**
154
  * An object with several URL objects relevant to the customer. Every URL object will contain an href and a type field.
 
155
  * @var object[]
156
  */
157
  public $_links;
158
 
 
 
 
 
 
 
 
 
159
  /**
160
  * Is this order created?
161
  *
@@ -404,4 +414,25 @@ class Order extends BaseResource
404
 
405
  return $resourceCollection;
406
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
407
  }
146
 
147
  /**
148
  * The order lines contain the actual things the customer bought.
149
+ *
150
  * @var array|object[]
151
  */
152
  public $lines;
153
 
154
  /**
155
  * An object with several URL objects relevant to the customer. Every URL object will contain an href and a type field.
156
+ *
157
  * @var object[]
158
  */
159
  public $_links;
160
 
161
+ /**
162
+ * An organization name which can be provided by the shopper, if they do shopping for business purposes of their
163
+ * company.
164
+ *
165
+ * @var string|null
166
+ */
167
+ public $organizationName;
168
+
169
  /**
170
  * Is this order created?
171
  *
414
 
415
  return $resourceCollection;
416
  }
417
+
418
+ /**
419
+ * Saves the order's updated billingAddress and/or shippingAddress.
420
+ *
421
+ * @return Order
422
+ */
423
+ public function update()
424
+ {
425
+ if (!isset($this->_links->self->href)) {
426
+ return $this;
427
+ }
428
+
429
+ $body = json_encode(array(
430
+ "billingAddress" => $this->billingAddress,
431
+ "shippingAddress" => $this->shippingAddress,
432
+ ));
433
+
434
+ $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_PATCH, $this->_links->self->href, $body);
435
+
436
+ return ResourceFactory::createFromApiResult($result, new Order($this->client));
437
+ }
438
  }
includes/mollie-api-php/src/Resources/Settlement.php CHANGED
@@ -173,4 +173,26 @@ class Settlement extends BaseResource
173
 
174
  return $resourceCollection;
175
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  }
173
 
174
  return $resourceCollection;
175
  }
176
+
177
+ /**
178
+ * Retrieves all captures associated with this settlement
179
+ *
180
+ * @return CaptureCollection
181
+ * @throws ApiException
182
+ */
183
+ public function captures()
184
+ {
185
+ if (!isset($this->_links->captures->href)) {
186
+ return new CaptureCollection($this->client, 0, null);
187
+ }
188
+
189
+ $result = $this->client->performHttpCallToFullUrl(MollieApiClient::HTTP_GET, $this->_links->captures->href);
190
+
191
+ $resourceCollection = new CaptureCollection($this->client, $result->count, $result->_links);
192
+ foreach ($result->_embedded->captures as $dataResult) {
193
+ $resourceCollection[] = ResourceFactory::createFromApiResult($dataResult, new Capture($this->client));
194
+ }
195
+
196
+ return $resourceCollection;
197
+ }
198
  }
includes/mollie-api-php/vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitc9ac1131b10cd7a0dbf25c3dce68c45d::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitff51838293b10d1f9ba6a6fd550fd5e8::getLoader();
includes/mollie-api-php/vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitc9ac1131b10cd7a0dbf25c3dce68c45d
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitc9ac1131b10cd7a0dbf25c3dce68c45d
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitc9ac1131b10cd7a0dbf25c3dce68c45d', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitc9ac1131b10cd7a0dbf25c3dce68c45d', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInitc9ac1131b10cd7a0dbf25c3dce68c45d::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitc9ac1131b10cd7a0dbf25c3dce68c45d
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInitc9ac1131b10cd7a0dbf25c3dce68c45d::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequirec9ac1131b10cd7a0dbf25c3dce68c45d($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequirec9ac1131b10cd7a0dbf25c3dce68c45d($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitff51838293b10d1f9ba6a6fd550fd5e8
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitff51838293b10d1f9ba6a6fd550fd5e8', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitff51838293b10d1f9ba6a6fd550fd5e8', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInitff51838293b10d1f9ba6a6fd550fd5e8::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInitff51838293b10d1f9ba6a6fd550fd5e8::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequireff51838293b10d1f9ba6a6fd550fd5e8($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequireff51838293b10d1f9ba6a6fd550fd5e8($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
includes/mollie-api-php/vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitc9ac1131b10cd7a0dbf25c3dce68c45d
8
  {
9
  public static $files = array (
10
  'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
@@ -63,8 +63,8 @@ class ComposerStaticInitc9ac1131b10cd7a0dbf25c3dce68c45d
63
  public static function getInitializer(ClassLoader $loader)
64
  {
65
  return \Closure::bind(function () use ($loader) {
66
- $loader->prefixLengthsPsr4 = ComposerStaticInitc9ac1131b10cd7a0dbf25c3dce68c45d::$prefixLengthsPsr4;
67
- $loader->prefixDirsPsr4 = ComposerStaticInitc9ac1131b10cd7a0dbf25c3dce68c45d::$prefixDirsPsr4;
68
 
69
  }, null, ClassLoader::class);
70
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitff51838293b10d1f9ba6a6fd550fd5e8
8
  {
9
  public static $files = array (
10
  'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php',
63
  public static function getInitializer(ClassLoader $loader)
64
  {
65
  return \Closure::bind(function () use ($loader) {
66
+ $loader->prefixLengthsPsr4 = ComposerStaticInitff51838293b10d1f9ba6a6fd550fd5e8::$prefixLengthsPsr4;
67
+ $loader->prefixDirsPsr4 = ComposerStaticInitff51838293b10d1f9ba6a6fd550fd5e8::$prefixDirsPsr4;
68
 
69
  }, null, ClassLoader::class);
70
  }
includes/mollie/wc/gateway/abstract.php CHANGED
@@ -618,7 +618,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
618
  $payment_object->setActiveMolliePayment( $order->id );
619
 
620
  // Get Mollie Customer ID
621
- $mollie_customer_id = $payment_object->getMollieCustomerIdFromPaymentObject( $payment_object );
622
 
623
  // Set Mollie customer
624
  Mollie_WC_Plugin::getDataHelper()->setUserMollieCustomerId( $order->customer_user, $mollie_customer_id );
@@ -630,7 +630,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
630
  $payment_object->setActiveMolliePayment( $order->get_id() );
631
 
632
  // Get Mollie Customer ID
633
- $mollie_customer_id = $payment_object->getMollieCustomerIdFromPaymentObject( $payment_object );
634
 
635
  // Set Mollie customer
636
  Mollie_WC_Plugin::getDataHelper()->setUserMollieCustomerId( $order->get_customer_id(), $mollie_customer_id );
618
  $payment_object->setActiveMolliePayment( $order->id );
619
 
620
  // Get Mollie Customer ID
621
+ $mollie_customer_id = $payment_object->getMollieCustomerIdFromPaymentObject( $payment_object->data->id );
622
 
623
  // Set Mollie customer
624
  Mollie_WC_Plugin::getDataHelper()->setUserMollieCustomerId( $order->customer_user, $mollie_customer_id );
630
  $payment_object->setActiveMolliePayment( $order->get_id() );
631
 
632
  // Get Mollie Customer ID
633
+ $mollie_customer_id = $payment_object->getMollieCustomerIdFromPaymentObject( $payment_object->data->id );
634
 
635
  // Set Mollie customer
636
  Mollie_WC_Plugin::getDataHelper()->setUserMollieCustomerId( $order->get_customer_id(), $mollie_customer_id );
includes/mollie/wc/gateway/abstractsubscription.php CHANGED
@@ -221,19 +221,27 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
221
  // Overwrite gateway-wide
222
  $initial_order_status = apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_initial_order_status_' . $this->id, $initial_order_status);
223
 
 
 
 
224
  // Get Mollie customer ID
225
  $customer_id = $this->getOrderMollieCustomerId($renewal_order);
226
 
 
 
 
 
 
 
 
 
 
227
  // Get all data for the renewal payment
228
  $data = $this->getRecurringPaymentRequestData($renewal_order, $customer_id);
229
 
230
  // Allow filtering the renewal payment data
231
  $data = apply_filters('woocommerce_' . $this->id . '_args', $data, $renewal_order);
232
 
233
-
234
- // Check if test mode is enabled
235
- $test_mode = $this->isTestModeEnabledForRenewalOrder($renewal_order);
236
-
237
  // Create a renewal payment
238
  try
239
  {
@@ -468,50 +476,48 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
468
  return $renewal_order;
469
  }
470
 
471
- /**
472
- * @param $payment_meta
473
- * @param $subscription
474
- * @return mixed
475
- */
476
- public function add_subscription_payment_meta( $payment_meta, $subscription )
477
- {
478
- if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
479
- $payment_meta[ $this->id ] = array (
480
- 'post_meta' => array (
481
- '_mollie_payment_id' => array (
482
- 'value' => get_post_meta( $subscription->id, '_mollie_payment_id', true ),
483
- 'label' => 'Mollie Payment ID',
484
- ),
485
- '_mollie_payment_mode' => array (
486
- 'value' => get_post_meta( $subscription->id, '_mollie_payment_mode', true ),
487
- 'label' => 'Mollie Payment Mode',
488
- ),
489
- '_mollie_customer_id' => array (
490
- 'value' => get_post_meta( $subscription->id, '_mollie_customer_id', true ),
491
- 'label' => 'Mollie Customer ID',
492
- ),
493
- ),
494
- );
495
- } else {
496
- $payment_meta[ $this->id ] = array (
497
- 'post_meta' => array (
498
- '_mollie_payment_id' => array (
499
- 'value' => $subscription->get_meta( '_mollie_payment_id', true ),
500
- 'label' => 'Mollie Payment ID',
501
- ),
502
- '_mollie_payment_mode' => array (
503
- 'value' => $subscription->get_meta( '_mollie_payment_mode', true ),
504
- 'label' => 'Mollie Payment Mode',
505
- ),
506
- '_mollie_customer_id' => array (
507
- 'value' => $subscription->get_meta( '_mollie_customer_id', true ),
508
- 'label' => 'Mollie Customer ID',
509
- ),
510
- ),
511
- );
512
- }
513
- return $payment_meta;
514
- }
515
 
516
  /**
517
  * @param $payment_method_id
@@ -546,10 +552,13 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
546
  }
547
  }
548
 
549
- /**
550
- * @param int $order_id
551
- * @return array
552
- */
 
 
 
553
  public function process_payment ($order_id)
554
  {
555
  $isSubscription = Mollie_WC_Plugin::getDataHelper()->isSubscription($order_id);
@@ -563,4 +572,106 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
563
 
564
  }
565
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
  }
221
  // Overwrite gateway-wide
222
  $initial_order_status = apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_initial_order_status_' . $this->id, $initial_order_status);
223
 
224
+ // Check if test mode is enabled
225
+ $test_mode = $this->isTestModeEnabledForRenewalOrder($renewal_order);
226
+
227
  // Get Mollie customer ID
228
  $customer_id = $this->getOrderMollieCustomerId($renewal_order);
229
 
230
+ $subscriptions = wcs_get_subscriptions_for_renewal_order( $renewal_order->get_id() );
231
+ $subscription = array_pop( $subscriptions ); // Just need one valid subscription
232
+ $subscription_id = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $subscription->id : $subscription->get_id();
233
+ $subscription_mollie_payment_id = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? get_post_meta( $subscription_id, '_mollie_payment_id', $single = true ) : $subscription->get_meta( '_mollie_payment_id' );
234
+
235
+ if ( empty( $customer_id ) && ! empty( $subscription_mollie_payment_id ) ) {
236
+ $customer_id = $this->restore_mollie_customer_id( $subscription_mollie_payment_id, $subscription );
237
+ }
238
+
239
  // Get all data for the renewal payment
240
  $data = $this->getRecurringPaymentRequestData($renewal_order, $customer_id);
241
 
242
  // Allow filtering the renewal payment data
243
  $data = apply_filters('woocommerce_' . $this->id . '_args', $data, $renewal_order);
244
 
 
 
 
 
245
  // Create a renewal payment
246
  try
247
  {
476
  return $renewal_order;
477
  }
478
 
479
+ /**
480
+ * @param $payment_meta
481
+ * @param $subscription
482
+ *
483
+ * @return mixed
484
+ * @throws \Mollie\Api\Exceptions\ApiException
485
+ */
486
+ public function add_subscription_payment_meta( $payment_meta, $subscription ) {
487
+
488
+ if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
489
+ $mollie_payment_id = get_post_meta( $subscription->id, '_mollie_payment_id', true );
490
+ $mollie_payment_mode = get_post_meta( $subscription->id, '_mollie_payment_mode', true );
491
+ $mollie_customer_id = get_post_meta( $subscription->id, '_mollie_customer_id', true );
492
+ } else {
493
+ $mollie_payment_id = $subscription->get_meta( '_mollie_payment_id', true );
494
+ $mollie_payment_mode = $subscription->get_meta( '_mollie_payment_mode', true );
495
+ $mollie_customer_id = $subscription->get_meta( '_mollie_customer_id', true );
496
+ }
497
+
498
+ if ( empty( $mollie_customer_id ) && ! empty( $mollie_payment_id ) ) {
499
+ $mollie_customer_id = $this->restore_mollie_customer_id( $mollie_payment_id, $subscription );
500
+ }
501
+
502
+ $payment_meta[ $this->id ] = array (
503
+ 'post_meta' => array (
504
+ '_mollie_payment_id' => array (
505
+ 'value' => $mollie_payment_id,
506
+ 'label' => 'Mollie Payment ID',
507
+ ),
508
+ '_mollie_payment_mode' => array (
509
+ 'value' => $mollie_payment_mode,
510
+ 'label' => 'Mollie Payment Mode',
511
+ ),
512
+ '_mollie_customer_id' => array (
513
+ 'value' => $mollie_customer_id,
514
+ 'label' => 'Mollie Customer ID',
515
+ ),
516
+ ),
517
+ );
518
+
519
+ return $payment_meta;
520
+ }
 
 
521
 
522
  /**
523
  * @param $payment_method_id
552
  }
553
  }
554
 
555
+ /**
556
+ * @param int $order_id
557
+ *
558
+ * @return array
559
+ * @throws \Mollie\Api\Exceptions\ApiException
560
+ * @throws \Mollie_WC_Exception_InvalidApiKey
561
+ */
562
  public function process_payment ($order_id)
563
  {
564
  $isSubscription = Mollie_WC_Plugin::getDataHelper()->isSubscription($order_id);
572
 
573
  }
574
 
575
+ /**
576
+ * @param $mollie_payment_id
577
+ * @param $subscription
578
+ *
579
+ * @return bool
580
+ * @throws \Mollie\Api\Exceptions\ApiException
581
+ */
582
+ public function restore_mollie_customer_id( $mollie_payment_id, $subscription ) {
583
+
584
+ try {
585
+ // Get subscription ID
586
+ $subscription_id = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $subscription->id : $subscription->get_id();
587
+
588
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: no valid customer ID found, trying to restore from Mollie API.' );
589
+
590
+ // Get full payment object from Mollie API
591
+ $payment_object_resource = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( $mollie_payment_id );
592
+
593
+ // Try to get the customer ID from the payment object
594
+ $mollie_customer_id = $payment_object_resource->getMollieCustomerIdFromPaymentObject( $mollie_payment_id );
595
+
596
+ if ( empty( $mollie_customer_id ) ) {
597
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: stopped processing, no customer ID found for this customer/payment combination.' );
598
+
599
+ return '';
600
+ } else {
601
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: customer ID found, verifying status of customer and mandate(s).' );
602
+ }
603
+
604
+ // Also check for valid mandates
605
+ $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
606
+ $test_mode = $settings_helper->isTestModeEnabled();
607
+
608
+ // Get the WooCommerce payment gateway for this subscription
609
+ $gateway = Mollie_WC_Plugin::getDataHelper()->getWcPaymentGatewayByOrder( $subscription );
610
+
611
+ if ( ! $gateway || ! ( $gateway instanceof Mollie_WC_Gateway_Abstract ) ) {
612
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: stopped processing, not a Mollie payment gateway, could not restore customer ID.' );
613
+
614
+ return '';
615
+ }
616
+
617
+ $mollie_method = $gateway->getMollieMethodId();
618
+
619
+ // Check that first payment method is related to SEPA Direct Debit and update
620
+ $methods_needing_update = array (
621
+ 'bancontact',
622
+ 'belfius',
623
+ 'eps',
624
+ 'giropay',
625
+ 'ideal',
626
+ 'inghomepay',
627
+ 'kbc',
628
+ 'mistercash',
629
+ 'sofort',
630
+ );
631
+
632
+ if ( in_array( $mollie_method, $methods_needing_update ) != false ) {
633
+ $mollie_method = 'directdebit';
634
+ }
635
+
636
+ // Get all mandates for the customer
637
+ $mandates = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->customers->get( $mollie_customer_id );
638
+
639
+ // Check credit card payments and mandates
640
+ if ( $mollie_method == 'creditcard' && ! $mandates->hasValidMandateForMethod( $mollie_method ) ) {
641
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: failed! No valid mandate for payment method ' . $mollie_method . ' found.' );
642
+
643
+ return $mollie_customer_id;
644
+ }
645
+
646
+ // Get a Payment object from Mollie to check for paid status
647
+ $payment_object = $payment_object_resource->getPaymentObject( $mollie_payment_id );
648
+
649
+ // Check SEPA Direct Debit payments and mandates
650
+ if ( $mollie_method == 'directdebit' && ! $mandates->hasValidMandateForMethod( $mollie_method ) && $payment_object->isPaid() ) {
651
+
652
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: no valid mandate for payment method ' . $mollie_method . ' found, trying to create one.' );
653
+
654
+ $options = $payment_object_resource->getMollieCustomerIbanDetailsFromPaymentObject( $mollie_payment_id );
655
+ $options['method'] = $mollie_method;
656
+
657
+ $customer = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->customers->get( $mollie_customer_id );
658
+ Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->mandates->createFor( $customer, $options );
659
+
660
+ } else {
661
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: failed! No valid mandate(s) for payment method ' . $mollie_method . ' found, and no paid payment to create one from.' );
662
+ }
663
+
664
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: mandate created successfully, customer restored.' );
665
+
666
+ return $mollie_customer_id;
667
+
668
+ }
669
+ catch ( Mollie\Api\Exceptions\ApiException $e ) {
670
+
671
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Subscription ' . $subscription_id . ' renewal payment: failed. ' . $e->getMessage() );
672
+
673
+ return '';
674
+ }
675
+ }
676
+
677
  }
includes/mollie/wc/payment/order.php CHANGED
@@ -189,10 +189,14 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
189
  return null;
190
  }
191
 
192
- public function getMollieCustomerIdFromPaymentObject() {
193
 
194
  // TODO David: Quick fix, make sure payment object has payments embedded, there needs to be a better way to do this!
195
- $payment = $this->getPaymentObject($this->data->id);
 
 
 
 
196
 
197
  if ( isset( $payment->_embedded->payments{0}->customerId ) ) {
198
 
@@ -203,6 +207,29 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
203
  return null;
204
  }
205
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
  /**
207
  * @param WC_Order $order
208
  * @param Mollie\Api\Resources\Order $payment
189
  return null;
190
  }
191
 
192
+ public function getMollieCustomerIdFromPaymentObject( $payment = null ) {
193
 
194
  // TODO David: Quick fix, make sure payment object has payments embedded, there needs to be a better way to do this!
195
+ if ( $payment == null ) {
196
+ $payment = $this->data->id;
197
+ }
198
+
199
+ $payment = $this->getPaymentObject( $payment );
200
 
201
  if ( isset( $payment->_embedded->payments{0}->customerId ) ) {
202
 
207
  return null;
208
  }
209
 
210
+ public function getMollieCustomerIbanDetailsFromPaymentObject( $payment = null ) {
211
+
212
+ // TODO David: Quick fix, make sure payment object has payments embedded, there needs to be a better way to do this!
213
+ if ( $payment == null ) {
214
+ $payment = $this->data->id;
215
+ }
216
+
217
+ $payment = $this->getPaymentObject( $payment );
218
+
219
+ if ( isset( $payment->_embedded->payments{0}->id ) ) {
220
+
221
+ $actual_payment = new Mollie_WC_Payment_Payment( $payment->_embedded->payments{0}->id );
222
+ $actual_payment = $actual_payment->getPaymentObject( $actual_payment->data );
223
+
224
+ $iban_details['consumerName'] = $actual_payment->details->consumerName;
225
+ $iban_details['consumerAccount'] = $actual_payment->details->consumerAccount;
226
+
227
+ }
228
+
229
+ return $iban_details;
230
+
231
+ }
232
+
233
  /**
234
  * @param WC_Order $order
235
  * @param Mollie\Api\Resources\Order $payment
includes/mollie/wc/payment/payment.php CHANGED
@@ -73,7 +73,7 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
73
  // Add sequenceType for subscriptions first payments
74
  if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
75
  if ( Mollie_WC_Plugin::getDataHelper()->isSubscription( $order->id ) ) {
76
- $paymentRequestData['payment']['sequenceType'] = 'first';
77
  }
78
  }
79
 
@@ -143,17 +143,38 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
143
  return null;
144
  }
145
 
146
- public function getMollieCustomerIdFromPaymentObject() {
 
 
 
 
 
 
147
 
148
- if ( isset( $this->data->customerId ) ) {
149
 
150
- return $this->data->customerId;
151
 
152
  }
153
 
154
  return null;
155
  }
156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  /**
158
  * @param WC_Order $order
159
  * @param Mollie\Api\Resources\Payment $payment
73
  // Add sequenceType for subscriptions first payments
74
  if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
75
  if ( Mollie_WC_Plugin::getDataHelper()->isSubscription( $order->id ) ) {
76
+ $paymentRequestData['sequenceType'] = 'first';
77
  }
78
  }
79
 
143
  return null;
144
  }
145
 
146
+ public function getMollieCustomerIdFromPaymentObject( $payment = null ) {
147
+
148
+ if ( $payment == null ) {
149
+ $payment = $this->data->id;
150
+ }
151
+
152
+ $payment = $this->getPaymentObject( $payment );
153
 
154
+ if ( isset( $payment->customerId ) ) {
155
 
156
+ return $payment->customerId;
157
 
158
  }
159
 
160
  return null;
161
  }
162
 
163
+ public function getMollieCustomerIbanDetailsFromPaymentObject( $payment = null ) {
164
+
165
+ if ( $payment == null ) {
166
+ $payment = $this->data->id;
167
+ }
168
+
169
+ $payment = $this->getPaymentObject( $payment );
170
+
171
+ $iban_details['consumerName'] = $payment->details->consumerName;
172
+ $iban_details['consumerAccount'] = $payment->details->consumerAccount;
173
+
174
+ return $iban_details;
175
+
176
+ }
177
+
178
  /**
179
  * @param WC_Order $order
180
  * @param Mollie\Api\Resources\Payment $payment
includes/mollie/wc/plugin.php CHANGED
@@ -7,7 +7,7 @@ class Mollie_WC_Plugin
7
  {
8
  const PLUGIN_ID = 'mollie-payments-for-woocommerce';
9
  const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
10
- const PLUGIN_VERSION = '5.0.3';
11
 
12
  const DB_VERSION = '1.0';
13
  const DB_VERSION_PARAM_NAME = 'mollie-db-version';
7
  {
8
  const PLUGIN_ID = 'mollie-payments-for-woocommerce';
9
  const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
10
+ const PLUGIN_VERSION = '5.0.4';
11
 
12
  const DB_VERSION = '1.0';
13
  const DB_VERSION_PARAM_NAME = 'mollie-db-version';
mollie-payments-for-woocommerce.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Mollie Payments for WooCommerce
4
  * Plugin URI: https://www.mollie.com
5
  * Description: Accept payments in WooCommerce with the official Mollie plugin
6
- * Version: 5.0.3
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 3.8
3
  * Plugin Name: Mollie Payments for WooCommerce
4
  * Plugin URI: https://www.mollie.com
5
  * Description: Accept payments in WooCommerce with the official Mollie plugin
6
+ * Version: 5.0.4
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 3.8
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: daanvm, davdebcom, l.vangunst, ndijkstra, robin-mollie
3
  Tags: mollie, payments, woocommerce, payment gateway, e-commerce, credit card, ideal, sofort, bancontact, bitcoin, direct debit, subscriptions
4
  Requires at least: 3.8
5
  Tested up to: 4.9
6
- Stable tag: 5.0.3
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -181,6 +181,15 @@ Automatic updates should work like a charm; as always though, ensure you backup
181
 
182
  == Changelog ==
183
 
 
 
 
 
 
 
 
 
 
184
 
185
  = 5.0.3 - 01-11-2018 =
186
 
3
  Tags: mollie, payments, woocommerce, payment gateway, e-commerce, credit card, ideal, sofort, bancontact, bitcoin, direct debit, subscriptions
4
  Requires at least: 3.8
5
  Tested up to: 4.9
6
+ Stable tag: 5.0.4
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
181
 
182
  == Changelog ==
183
 
184
+ = 5.0.4 - 08-11-2018 =
185
+
186
+ IMPORTANT
187
+ This version requires PHP 5.6 or higher. If you are using an older PHP version, please read this article: [PHP & Mollie API v2](https://github.com/mollie/WooCommerce/wiki/PHP-&-Mollie-API-v2).
188
+
189
+ * Fix - Get test mode higher in scheduled_subscription_payment() process
190
+ * Fix - Add automated option to restore a customer ID from Mollie API
191
+ * Fix - Store sequenceType in the correct position for payments
192
+
193
 
194
  = 5.0.3 - 01-11-2018 =
195